| Summary: | [inline] inlining same method twice gives duplicate local variable | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Genady Beryozkin <eclipse> |
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | b.muskalla |
| Version: | 3.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
happens in 3.2RC3 To reproduce:
public class Try {
void toInline(String arg) {
String temp= arg;
System.out.println(temp);
}
void caller() {
toInline("me");
toInline("too");
}
}
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. |
I have the following utility method (local variable named incorrectly): private static void saveTextualProperty(IProject proj, String name, String val) throws CoreException { IScopeContext context = new ProjectScope(proj); IEclipsePreferences eclipsePreferences = context.getNode(RMIPlugin.PLUGIN_ID); if (val == null || "".trim().equals(val)) { eclipsePreferences.remove(name); } else { eclipsePreferences.put(name, val); } } In another method I have two calls to this method: private static void xxxx() { saveTextualProperty(null, XXX1, "XXXX"); saveTextualProperty(null, XXX2, "XXXXX"); } When I inline the first method the result is: private static void xxxx() { IScopeContext context = new ProjectScope(null); IEclipsePreferences eclipsePreferences = context.getNode(RMIPlugin.PLUGIN_ID); if ("XXXX" == null || "".trim().equals("XXXX")) { eclipsePreferences.remove(XXX1); } else { eclipsePreferences.put(XXX2, "XXXX"); } IScopeContext context = new ProjectScope(null); IEclipsePreferences eclipsePreferences = context.getNode(RMIPlugin.PLUGIN_ID); if ("XXXXX" == null || "".trim().equals("XXXXX")) { eclipsePreferences.remove(XXX2); } else { eclipsePreferences.put(XXX2, "XXXXX"); } } If the method already has a variable named "context" then the new "context" variables are correctly renamed to "context1" and "context2".