Project: JDT
Bug 252104 [quick assist] Convert to switch produces compile errors for conditional expression
Reported: 2008-10-25 19:23:14 | Status: resolved fixed

N20081005-2000 See the following snippet: ------------- package p; public class B { public static void main(String[] args) { switch(getFoo() ? getBar() : getBar()) { case 1: System.out.println(); break; } } private static int getBar() { return 0; } private static boolean getFoo() { return false; } } ------ Using the "Convert switch to if/else" quick assist fails to add the correct parentheses to the expression. After the quick assist is done there are currently two quick fixes: * add cast to boolean * Insert null check In this case these two quick fixes are not really useful as we don't come closer to a compilable output.

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