Community
Participate
Working Groups
Build Identifier: 20090920-1017 When you add an argument to a method signature using refactoring, it does not check for name clashes of that argument with existing instance variables of the class. This causes refactoring to change the behaviour (i.e. introduce bugs to) existing code. Reproducible: Always Steps to Reproduce: 1. Create the short class "Main1" which is pasted below. 2. Highlight the method "func" and do "refactor: change method signature". Add an argument of type double, and call it "a". No default value necessary. 3. The bug is that before the refactoring, the line "if (a!=2)..." referred to the instance variable a, but after refactoring it will refer to the local variable a (the argument). hence this changes the program's functionality: the refactor script should alter the line to "if (Main1.a!=2)...", or produce a warning/error. This bug also occurs for non static instance variables. Thank you for an excellent product! End of bug report (code sample follows)... public class Main1 { final static double a=2; public static void func(double b) { if (a!=2) throw new RuntimeException(); } }
Moving to JDT/UI
*** This bug has been marked as a duplicate of bug 26374 ***