Project: JDT
Bug 395989 [generalize type] Generalize Declared Type does not consider use of variable in throw statement, which yields compilation error
Reported: 2012-12-06 16:38:06 | Status: resolved fixed

Steps to reproduce: 1. See the instructions in code below 2. The resulting code does not compile ("No exception of type Object can be thrown; an exception type must be a subclass of Throwable") class GeneralizeDeclaredTypeBug3 { void f() throws Exception { // Invoke "Generalize Declared Type" on "Exception" // and select "Object" as new type Exception e = new Exception(); throw e; } } (Thanks to Yilong Li for helping with the bug report.)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testThrowableSubtype_in.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ChangeTypeRefactoringTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/FullConstraintCreator.java