Bug 5862

Summary: search : too many matches on search with OrPattern
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2    
Version: 2.0   
Target Milestone: 2.0 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2001-11-13 13:39:38 EST
//renaming I.m to k
package p;
interface I{
void m();
}

class A1 implements I{
public void m(){}
}
interface I1{
void m();
}

1. programatically create an orpattern on I::m and A1::m (ALL_OCCURRENCES)
2. search in project
3. you get 3 results (all have accurracy 1 (potential))
   the one in I1 is incorrect and should not be reported

(it seems like it's the or pattern that's causing the problem here - works ok 
with simple patterns)
Comment 1 Jerome Lanneluc CLA 2001-11-14 10:29:57 EST
The created OrPattern is as follows:
  OrPattern
    OrPattern
      MethodDeclarationPattern I::m
      MethodReferencePattern I::m
    OrPattern
      MethodDeclarationPattern A1::m
      MethodReferencePattern A1::m
When initializing the second reference pattern for polymorphic search, we 
didn't realize that the compilation unit had already been parsed. As a 
consequence we overwrote the first one and only the second one was being 
resolved. The first one was left unresolved and reported inaccurate matches.

Fixed by checking if the compilation unit is known before attempting to parse 
it.