| Summary: | [extract local] "Extract to local variable (replace all occurrences)" is too aggressive | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Roland Illig <roland.illig> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, srikanth_sankaran |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Move to JDT/UI for comment. |
Build Identifier: 20100218-1602 When replacing all occurrences of a (syntactically) common subexpression, Eclipse doesn't check whether some of the subexpressions are modified meanwhile in an obvious way. package de.roland_illig.eclipse.bugs; public class RefactorCommonExpressions { public static void main(String[] args) { int i = 1; System.out.println(i + 1); i++; System.out.println(i + 1); } } When I tell Eclipse to refactor the expression "i + 1", it doesn't notice that i is modified in between. This changes the program output from "2 3" to "2 2". Reproducible: Always