Community
Participate
Working Groups
A project in my workspace was behaving in the way described in the following bug report: (https://bugs.eclipse.org/bugs/show_bug.cgi?id=30530) That is, although the project was completely compiled and free of errors and warnings, when finding references to a method only "inexact" matches were found. For example, given two methods: public void foo(String arg) { bar(arg); } public void bar(String arg) { ... } When searching on references to bar(String), the result would be a list of "inexact" matches that matched on the method name with one argument, regardless of the parameter type. WHAT I FOUND OUT: After much hair pulling I discovered that I had a corrupt .jar file in my class path. That was the culprit. Even thought that .jar was corrupt and there was no reference to it in the code, (since the project compiled correctly), it caused this strange search behavior. WHAT I WOULD HAVE EXPECTED: I would expect that if I had a corrupt .jar on my class path that either: a. I would be notified about the bad .jar in the form of an error, or b. If the .jar was not referenced (thus causing no other compile errors) that the search code would ignore the .jar and work correctly. Cheers to y'all at (OTI)BM
Moving to JDT Core since both issues are handled by JDT Core.
Colin, would it be possible for you to attach the corrupt jar to this bug report? I'd like to understand how it is corrupt.
Created attachment 5804 [details] the corrupt .jar file
Thanks a lot for the test case. Problem was in JavaSearchEnvironment.computeClasspathLocations(...). If it could not open the jar, it would consider that the classpath was empty, thus not even finding the Java class library. Thus all matches were found inexact. Fixed and added regression test JavaSearchTests.testTypeReferenceWithCorruptJar ()
Verified.