Bug 80890

Summary: [search] Strange search engine behaviour
Product: [Eclipse Project] JDT Reporter: Dirk Baeumer <dirk_baeumer>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dirk Baeumer CLA 2004-12-13 18:58:09 EST
public class A {

	protected void foo(String s) {
		System.out.println("A.foo()");
	}

	protected void foo(Integer i) {
		System.out.println("A.foo()");
	}
}

public class B1 extends A {

	public void bar1() {
		foo(null);
	}
}

public class B2 extends A {

	public void bar2() {
		foo(null);
	}
}


- search for references to foo(String s): you get two exact matches
- search for references to foo(Integer i): you get zero matches
Comment 1 Frederic Fusier CLA 2004-12-14 03:04:50 EST
foo(null) is an ambiguous call (you should have a compiler errors for that,
shouldn't you?). So, the current behavior is to store a ProblemReferenceBinding
with an original MethodBinding to the first method which may match the call.
I guess the first method in the list of class A is foo(String)...
To demonstrate this, write foo(Integer) before foo(String) in class A... and
then you get 2 references for foo(Integer) and 0 for foo(String)!
I'm not sure if we can change this behavior but, I'll have a look on it if time
permit.
Waiting this, I reduce the severity as this behavior disappears when compiler
errors are fixed...
Comment 2 Frederic Fusier CLA 2004-12-24 06:26:12 EST
Fixed.

Now search engine reports 2 potential matches for both methods.

[jdt-core-internal]
Change done in MethodLocator.matchMethod(MethodBinding).
Test case added in JavaSearchBugsTests: testMethodReferenceBug80890()
Comment 3 David Audel CLA 2005-02-14 11:32:06 EST
Verified for 3.1M5