Community
Participate
Working Groups
Build ID does not matter, I guess this happens for a while... I have following simple test case: A.java class A {} B.java class B { A a; } Of course searching for reference to A find match in B.java. Now I export this test case in a jar with source, attach the exported jar to a new project. In package explorer I get: P + test.jar + A + B Select A without having opened any file of this jar, search for references in project => I get 0 match! Now I open editor on B or A and search again => I find 1 match... Close all editor and search again => I still find the match! This is not a normal behavior, search engine should find the match even if no source has been opened before...
This is a problem with source attachement. In PackageFragmentRoot.getSourceMapper method first call, mapper == null but unfortunately sourcePath is also null... Search Engine then considers there's no source and uses ClassFileMatchLocator which fails to find this kind of reference (known limitation...). Note that it works properly after having opened editor either on A.java or B.java even after a shutdown/restart of eclipse session. It only fails just after having created the project or closed/reopened it...
Changed PackageFragmentRoot#getSourceMapper() to attach the root to itself if none specified. Also removed code in ClassFile#openBuffer(...) that was duplicating this work and improved SourceMapper to pass in the IBinaryType when possible. Added regression test JavaSearchBugs#test126330() and changed existing Java search tests that assumed that attaching a null souurce path would not find the source by extracting the source of existing jars in a different zip file.
Verified for 3.2 M5 using build I20060214-0010.
*** Bug 130978 has been marked as a duplicate of this bug. ***