Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 224082

Summary: [search] Search Engine still reports potential matches on missing types although they have bindings
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P5 CC: david_audel, jerome_lanneluc
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Frederic Fusier CLA 2008-03-26 08:15:48 EDT
Since bug 196200 has been fixed, Search Engine should be able to report accurate matches instead of potential ones while searching for references on class members which have a missing type in their declarations.

Here's a typical example:
public class X {
	Unknown foo;
}
class Y {
	X x;
	void foo(X param) {
		if (this.x == param.foo) {
			// ...
		}
	}
}

Searching for references to the field 'foo' currently reports one potential match. With the missing types support, we can expect the Search Engine to report an exact match instead...
Comment 1 Frederic Fusier CLA 2008-03-26 08:21:06 EDT
Following example may be better:
public class X {
	Unknown foo;
}
class Y {
	X x;
	void foo(X param) {
		if (this.x.foo.equals(param.foo)) {
			// ...
		}
	}
}

Where Search Engine find 2 potential matches.
Comment 2 Frederic Fusier CLA 2009-03-05 11:09:15 EST
Finally, I don't think that taking missing types into account will bring a great benefit for search engine...

The reason is that the missing type qualification is set to the package of the compilation unit where the missing type is encountered. Hence, if search engine tried to match the missing type in comment 1, then it would report an exact match.

However, as soon as the missing type would not be in the package where the match was found, then search engine would still need to report a potential match as the missing type had the wrong qualification.

E.g. the following test case:
A.java:
    package a;
    class A {}
B.java
    package b;
    import a.A;
    class B {
        A a;
    }

The type A is not visible from B, hence an error on the import and the reference to A flagged as a missing type. Here the missing type does not help to resolve the potential match :-(

IMO, this kind of situation is the most common one. The comment 1 test case is only a pure theoretic case to show what could be done but should be rare in the real life...

So, close as WONTFIX
Comment 3 David Audel CLA 2009-03-10 11:28:16 EDT
Reopened

The test case of comment 1 seems still valid 
In this test case the place where is really the missing type has no importance.
As the declaring type is not unknown it seems possible to find all the references of one of his field.
Comment 4 Eclipse Genie CLA 2019-10-24 15:52:48 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.