| Summary: | [extract method] Refactor > Extract Constant does not extract case literal as a constant | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Lukas Eder <lukas.eder> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | deepakazad, lukas.eder |
| Version: | 3.7.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Please try with the latest 3.8 or 4.2 build. *** This bug has been marked as a duplicate of bug 211529 *** |
Build Identifier: Build Identifier: Version: Indigo Release Build id: 20110615-0604 I cannot extract case literals from a switch statement as constants (or variables) Reproducible: Always Steps to Reproduce: 1. Create this class: ------------------------------------ public class Test { public void x(int i) { switch (i) { case 0: case 1: } } } ------------------------------------ 2. Select 0 or 1, the case literals 3. Choose Refactor > Extract Constant from the context menu 4. Choose any options and click OK 5. A constant is created, but the original is not replaced, resulting in: ------------------------------------ public class Test { private static final int _1 = 1; public void x(int i) { switch (i) { case 0: case 1: // The literal is still here } } } ------------------------------------