Community
Participate
Working Groups
When I choose Source->Clean-Up "Pull down common code from if/else statement" on the example below, it results into a compilation failure. Example: public class Test { private static final int ERROR_ACTION = 0; private static final int ACCEPT_ACTION = 1; private static final int NUM_RULES = 2; public String reduce(int act) { String reduceName = ""; if (act <= NUM_RULES) { act--; } else if (act > ERROR_ACTION) { return reduceName; } else { if (act < ACCEPT_ACTION) { return reduceName; } return reduceName; } return reduceName; } } Result: public class Test { private static final int ERROR_ACTION = 0; private static final int ACCEPT_ACTION = 1; private static final int NUM_RULES = 2; public String reduce(int act) { String reduceName = ""; if (act <= NUM_RULES) { act--; } else { if () { } return reduceName; } return reduceName; } } The empty expression inside the if causes the compilation error. The example is simplified from the orginal code of org.eclipse.jdt.internal.codeassist.complete.CompletionParser.reduce(int)
Version: 2021-12 (4.22.0) Build id: 20211202-1639
See also this similar bug, already resolved https://github.com/JnRouvignac/AutoRefactor/issues/487
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.