Bug 149252 - [search] reports references in anonymous that is not connected
Summary: [search] reports references in anonymous that is not connected
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-29 18:02 EDT by Brian Miller CLA
Modified: 2008-02-04 11:29 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Miller CLA 2006-06-29 18:02:02 EDT
On line 4, rename field 'x'.

------------------------ Bug.java --------------------
class Bug {
    {
        new Object(){
            int x; // LINE 4
            int foo(){return x;}
          };
          
          new Object(){
              int x;
              int foo(){return x;}
            };
    }
}
Comment 1 Martin Aeschlimann CLA 2006-07-04 09:24:07 EDT
Reproduced in I20060628-1135
- Select 'x' on line 4 and use Refactor > Replace
- Refactoring shoes error that 'x' is shadowed by an other declaration
- Pressing 'OK' anyways' will alse rename 'x' in the second annonymous class.

The bug seems to be with the search engine that also reports the 'x' in the second annonymous class as connected to the first 'x'
Comment 2 Frederic Fusier CLA 2006-07-04 10:39:29 EDT
FieldPattern built on give IJavaElement does not include local type occurenceCount => each anonymous x field matches the pattern...
Comment 3 Frederic Fusier CLA 2007-12-19 11:50:15 EST
Looks like a pure theoretical uncommon test case. Even if it's a real case, there's a real simple workaround: just use a different name for the field in the second anonymous.

No plan to fix this issue
Comment 4 David Audel CLA 2008-02-04 11:29:29 EST
Verified for 3.4M5.