Bug 5862 - search : too many matches on search with OrPattern
Summary: search : too many matches on search with OrPattern
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-13 13:39 EST by Adam Kiezun CLA
Modified: 2002-01-11 09:22 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.