Bug 57749 - Search in working copies doesn't find all matches
Summary: Search in working copies doesn't find all matches
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 54457
  Show dependency tree
 
Reported: 2004-04-07 11:33 EDT by Markus Keller CLA
Modified: 2004-05-18 13:09 EDT (History)
0 users

See Also:


Attachments
2 projects, both importing org.junit (5.43 KB, application/zip)
2004-04-07 11:34 EDT, Markus Keller CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-04-07 11:33:29 EDT
I20040406

- import projects zz.base and zz.client from attached zip
- rename method base.Base#doit(Test) to "asdfasdf", click Preview
-> two wrong error messages.

To watch the cause, set breakpoint in RenameMethodProcessor#analyzeRenameChanges(.).

What we do there is searching for occurrences of the methods before the change
(-> oldOccurrences) and after the change (-> newOccurrences). The search in
getNewOccurrences(.) doesn't find all matches in the working copies, which makes
RenameAnalyzeUtil.analyzeRenameChanges(.) think that some references were shadowed.

As I see it, the search in getNewOccurrences(.) doesn't report all the matches
it should.
Comment 1 Markus Keller CLA 2004-04-07 11:34:40 EDT
Created attachment 9290 [details]
2 projects, both importing org.junit
Comment 2 Markus Keller CLA 2004-04-08 03:02:05 EDT
Might be related to 41534.

A problem could be that the type of the argument comes from another project. The
error doesn't occur if method doit(Test) has no argument. It also doesn't occur
iff there's only one Client class (e.g. BClient removed).

However, it still occurs if I set up JUnit as a normal java source project and
add the JUnit source project to the buildpaths of zz.base and zz.client.
Comment 3 Jerome Lanneluc CLA 2004-04-29 04:50:01 EDT
Conditions for this to fail:
1. The focus element must be in a different project than the potential match
2. There must be as least 2 potential matches in the second project
3. The focus element must be in a working copy
4. The focus element must not exist in the original compilation unit

It was assumed that since working copies are passed to the resolution, the name 
environment didn't have to take working copies into account. This is not true 
in this failing case where the working copy of the focus element is not 
resolved at the same time as the others since it is in a different project.

Changed JavaSearchNameEnvironment to take working copies into account.
Added regression test 
JavaSearchMultipleProjectsTests.testReferenceInWorkingCopies()
Comment 4 Frederic Fusier CLA 2004-05-18 13:09:42 EDT
Verified for 3.0 M9 with build I200405180816.