Bug 82673 - [search] Refactor->Rename on local class also renames references to different local classes with same name
Summary: [search] Refactor->Rename on local class also renames references to different...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-12 10:31 EST by Ingo Maier CLA
Modified: 2005-05-11 09:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.