Project: JDT
Bug 154936 [quick fix] "Convert switch to if-else" introduces error
Reported: 2006-08-23 16:49:49 | Status: resolved fixed

Eclipse SDK Version: 3.2.0 Build id: M20060629-1905 Consider the following snippet: --- public static int getPower(TimeUnit unit) { switch (unit) { case SECONDS: return 0; case MILLISECONDS: return -3; case MICROSECONDS: return -6; case NANOSECONDS: return -9; default: throw new InternalError(); } } --- Run the quick fix "Convert switch to if-else" on the switch keyword, and the new code will have compiler errors, one for each enum constant: SECONDS cannot be resolved. Et cetera. The constants should be preceded by "TimeUnit."

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/AdvancedQuickAssistTest.java org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/AdvancedQuickAssistProcessor.java