Bug 29366

Summary: Search reporting invalid inaccurate match
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
BlockScope.java none

Description Philipe Mulet CLA 2003-01-13 05:18:25 EST
Build 2.1M4

Using the attached incorrect source for BlockScope, searching for references to 
ProblemFieldBinding will report inaccurate matches, inside BlockScope itself.

The match inside #getExactEmulationPath is expected, however the match inside 
#getBinding is wrong.
Comment 1 Philipe Mulet CLA 2003-01-13 05:18:54 EST
Created attachment 2954 [details]
BlockScope.java
Comment 2 Jerome Lanneluc CLA 2003-01-13 07:22:56 EST
SingleTypeReference.resolveType is null, thus the MatchLocator can only report 
an inaccurate match.
Comment 3 Jerome Lanneluc CLA 2003-01-13 08:50:43 EST
Simpler test case:
1. Create the following cu in default package:
public class A {
	public void foo() {
		A a;
	}
	public void bar() {
		new Object[]{ new Object()
	}
}
2. Search for references to A
Observe: 2 matches are found: 1 inexact, the other is exact
Comment 4 Jerome Lanneluc CLA 2003-01-13 09:26:42 EST
Recovery is creating 2 SingleTypeReferences. The first one is forgotten but 
MatchLocator doesn't know about it. Thus this first node is never resolved and 
the MatchLocator thinks it is unresolved.
Comment 5 Philipe Mulet CLA 2003-01-17 07:15:10 EST
It could ignore references for which it has a match/no-match already with the 
same source positions (filtering out duplicate cached references).
Comment 6 Jerome Lanneluc CLA 2003-01-24 06:53:31 EST
Changed MatchSet to remove nodes that are at the same source position and that 
have the same class as a matching node.

Added regression test JavaSearchTests.testTypeReferenceWithRecovery()
Comment 7 David Audel CLA 2003-02-10 09:48:47 EST
Verified.