Bug 39831 - Search finds only "inexact" matches
Summary: Search finds only "inexact" matches
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-09 15:04 EDT by Colin Phillips CLA
Modified: 2003-08-28 04:45 EDT (History)
0 users

See Also:


Attachments
the corrupt .jar file (2.66 KB, application/octet-stream)
2003-08-20 11:06 EDT, Colin Phillips CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Phillips CLA 2003-07-09 15:04:06 EDT
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
Comment 1 Dani Megert CLA 2003-07-10 03:22:20 EDT
Moving to JDT Core since both issues are handled by JDT Core.
Comment 2 Jerome Lanneluc CLA 2003-08-20 07:20:32 EDT
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.
Comment 3 Colin Phillips CLA 2003-08-20 11:06:01 EDT
Created attachment 5804 [details]
the corrupt .jar file
Comment 4 Jerome Lanneluc CLA 2003-08-22 07:30:56 EDT
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
()
Comment 5 David Audel CLA 2003-08-28 04:45:10 EDT
Verified.