Community
Participate
Working Groups
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.
Created attachment 2954 [details] BlockScope.java
SingleTypeReference.resolveType is null, thus the MatchLocator can only report an inaccurate match.
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
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.
It could ignore references for which it has a match/no-match already with the same source positions (filtering out duplicate cached references).
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()
Verified.