This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Example: class Test { int foo; int f(int bar) { return foo + bar; } } By renaming 'bar' to 'foo', the existing occurrence of "foo" in f()'s body changes its meaning: It no longer refers to the instance variable 'foo', but to the method parameter 'foo' (formerly 'bar'): class Test { int foo; int f(int foo) { return foo + foo; // now returns 2 * foo instead of this.foo + foo } } More generally, renaming an element to some name X changes the meaning of occurrences of X in the element's scope that previously referred to elements in an enclosing scope. Sometimes that's the intent, but usually it isn't, and it easily goes unnoticed in non-trivial code. What I propose is to enhance instant rename by highlighting such colliding occurrences to alert the user of the collision (some shade of red would be an appropriate default). The occurrence currently being edited should be highlighted that way as well (as long as there's a collision), as the colliding occurrences might not be located within the document's current viewport and hence not directly visible. Conceivable alternatives: - Have instant rename add qualifications to colliding occurrences so that they retain their meaning (like changing "foo" to "this.foo" in the example above). This is not always possible, though, for example when hiding inherited instance fields. - Add a confirmation dialog that warns about such collisions upon leaving instant rename mode.
Overtake.