Community
Participate
Working Groups
2.1.2 + jdt.core from R2_1_maintenance branch. This problem breaks a constructed corner case in our upcoming contribution to bug 47509. I'll attach a .zip with a valid but somewhat strange workspace consisting of three projects. In that setup, I do the following search: Pattern (IType<<xxx>> is a concrete JavaElement): SearchEngine.createOrSearchPattern( SearchEngine.createSearchPattern(IType<</project0/p/A>>, REFERENCES), SearchEngine.createSearchPattern(IType<</projectB/p/B>>, REFERENCES), ) Scope: JavaSearchScope on [ /projectB/test/Ref.java /projectA/p ] The search gives these results: [ <Search Result start:49 end:50 resource:/projectB/test/Ref.java javaElement:A a [in Ref [in Ref.java [in test [in [project root] [in projectB]]]]](instanceof class org.eclipse.jdt.internal.core.SourceField)[offset=49, length=4] Accuracy:0/>, <Search Result start:56 end:57 resource:/projectB/test/Ref.java javaElement:B b [in Ref [in Ref.java [in test [in [project root] [in projectB]]]]](instanceof class org.eclipse.jdt.internal.core.SourceField)[offset=56, length=4] Accuracy:0/>] The second result is fine, but the first one wrong: A in Ref is a reference to /projectA/p/A, but not a reference to /project0/p/A as requested by the search pattern. The search should only give the second search result.
Created attachment 7107 [details] 3 projects for workspace
Marcus: is this a 2.1.x problem only? Or does it also happen in the 3.0 stream? If its just a 2.1.x problem then we likely won't fix it.
Hi Cent ;-) It's also a 3.0 "problem" (I don't think it's too severe): To look at it, - set up the zipped workspace in a run-time eclipse - set a breakpoint in RenamePackageProcessor#getReferencesToTypesInNamesakes(..), in the third-to-last line (before ... RefactoringSearchEngine.search(..) ...). - select package p from projectA - Refactor > Rename... to "asdf", with updating references to the renamed element - click 'Preview >' - when you hit the breakpoint, step into the search, and soon you'll hit familiar jdt-core land ;-)
The problem was with the TypeReferencePattern. It didn't consult with the supplied focus.
I cannot reproduce in 3.0 M7. Kent which build did you use to reproduce it?
Not sure exactly but I suspect it was M7 (or an integration build shortly after).
Kent can you please verify the bug is fixed in latest integration build?