| Summary: | Extract local could pull value outside loop | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | John Arthorne <john.arthorne> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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. |
3.7 M5 Given this code: for (int i = 0; i < 10; i++) { doSomething(expensiveMethod()); } If I select "expensiveMethod()" and perform extract local variable I get: for (int i = 0; i < 10; i++) { String expensiveMethod = expensiveMethod(); doSomething(expensiveMethod); } However since expensiveMethod is not influenced by i, it would be more efficient as: String expensiveMethod = expensiveMethod(); for (int i = 0; i < 10; i++) { doSomething(expensiveMethod); } Note if there are calls to expensiveMethod outside the for loop, then it will correctly place the local variable outside the loop.