Bug 41534 - incorrect shadowing reported by rename [refactoring]
Summary: incorrect shadowing reported by rename [refactoring]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 30267 41533 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-14 07:14 EDT by Adam Kiezun CLA
Modified: 2003-10-08 07:28 EDT (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 Adam Kiezun CLA 2003-08-14 07:14:56 EDT
happens on 20030813

from bug 38797:
 
1 - New workspace, create two Java projects Foo and Bar (Bar references Foo)
2 - Create an interface in Foo:
public interface SimpleInterface {
	public int CONSTANT = 10;
}
3 - Create a class in Foo:
public class SimpleClass {
	public static void method() {}
}
3 - Create a class in Bar:
public class ClientClass {
	void m1() {
		int i = SimpleInterface.CONSTANT;
		SimpleClass.method(); 
	}
}

4 - Select CONSTANT in SimpleInterface and "Refactor->Rename..."
5 - Choose the name you want (e.g. CONSTANT_)
6 - Press ok. Bug: "another name shadows access to the renamed element" warning
in ClientClass.
7 - Continuing, no errors will be reported, and the operation finishes properly.
Comment 1 Adam Kiezun CLA 2003-08-14 07:30:35 EDT
it looks like SearchEngine is not reporting 1 match in a working copy.
i create working copies for SimpleInterface.java and ClientClass.java, 
i modify them in memory by renaming CONSTANT to C and reconciling.
i then call SearchEngine.search to find ALL_OCCURENCES and give it the 2 
working copies.
only the declaration is found, the reference is not.

this only happens if SimpleInterface and ClientClass are in different projects
(both projects are in the search scope)

asking jcore for comment
Comment 2 Adam Kiezun CLA 2003-08-14 07:32:10 EDT
*** Bug 41533 has been marked as a duplicate of this bug. ***
Comment 3 Adam Kiezun CLA 2003-08-14 11:44:29 EDT
*** Bug 30267 has been marked as a duplicate of this bug. ***
Comment 4 Jerome Lanneluc CLA 2003-08-28 10:40:57 EDT
Fixed MatchLocator.locateMatches(JavaProject,PotentialMatch[],int,int)  to take 
working copies in other projects into account as well.

Added regression test 
JavaSearchMultipleProjectsTests.testFieldOccurencesInWorkingCopies()
Comment 5 David Audel CLA 2003-10-08 07:28:35 EDT
Verified.