Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369294

Summary: [rename] Renaming a field of an anonymous class
Product: [Eclipse Project] JDT Reporter: Milos Gligoric <milos.gligoric>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, reprogrammer
Version: 3.7.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Milos Gligoric CLA 2012-01-20 15:59:58 EST
Build Identifier: Version: 3.7.1 Build id: I20110613-1736

Renaming a field of an anonymous class renames a field of inner class that has the same name.

Reproducible: Always

Steps to Reproduce:
1. Rename "foo" field in anonymous class in the example below.  Refactoring would try to rename a referece to "foo" field in the "Inner" class.

class Top {

    class Inner {
        int foo;

        void innerMethod() {
            if (foo > 0) { // THIS WILL BE RENAMED TOO
            }
        }
    }

    Object topMethod() {
        return new Object() {
            int foo; // RENAME THIS FIELD

            void anonymousMethod() {
                if (foo > 0) {
                }
            }
        };
    }
}
Comment 1 Mohsen Vakilian CLA 2012-01-21 08:00:11 EST
This bug might be related to Bug 213144.
Comment 2 Dani Megert CLA 2012-02-21 08:09:28 EST
Can reproduce using 3.8 M5.

Similar to bug 213144.
Comment 3 Eclipse Genie CLA 2018-11-14 19:03:15 EST
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.

If you have further information on the current state of the bug, please add it. 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.