Bug 29366 - Search reporting invalid inaccurate match
Summary: Search reporting invalid inaccurate match
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-13 05:18 EST by Philipe Mulet CLA
Modified: 2003-02-10 09:48 EST (History)
0 users

See Also:


Attachments
BlockScope.java (54.78 KB, text/plain)
2003-01-13 05:18 EST, Philipe Mulet CLA
no flags Details

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