Community
Participate
Working Groups
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.
Created attachment 9290 [details] 2 projects, both importing org.junit
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.
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()
Verified for 3.0 M9 with build I200405180816.