Bug 82673

Summary: [search] Refactor->Rename on local class also renames references to different local classes with same name
Product: [Eclipse Project] JDT Reporter: Ingo Maier <i.maier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: All   
Whiteboard:

Description Ingo Maier CLA 2005-01-12 10:31:00 EST
The summary says all:

public class Test {
    void test1() {
        class Dummy {};
        Dummy d = new Dummy();
    }
    
    void test2() {
        class Dummy {};
        Dummy d = new Dummy();
    }
}

Renaming the first to DummyA gives:

public class Test {
    void test1() {
        class DummyA {};
        DummyA d = new DummyA();
    }
    
    void test2() {
        class Dummy {};
        DummyA d = new DummyA(); // <- wrong!
    }
}
Comment 1 Olivier Thomann CLA 2005-01-12 10:53:11 EST
Move to JDT/UI
Comment 2 Frederic Fusier CLA 2005-01-12 10:57:16 EST
This is a JDT/Core search issue.
Search for references to test1.Dummy class returns 4 matches instead of 2
expected ones...
Comment 3 Frederic Fusier CLA 2005-03-14 15:13:05 EST
If time permit
Comment 4 Frederic Fusier CLA 2005-04-25 17:05:49 EDT
Fixed and released in HEAD.

Search engine now verifies when focus is not null that its parent matches
enclosingMethod of method binding match (if exist).

[jdt-core-internal]
Changes done in TypeReferenceLocator.matchReportReference(Expression, int,
TypeBinding, MatchLocator).

Test case added in JavaSearchBugsTests.
Note that JavaSearchTests.testTypeReference37 has been also modified has this
fix detected that it was invalid (searched method didn't exist...)
Comment 5 Maxime Daniel CLA 2005-05-11 09:14:29 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.