Bug 80890 - [search] Strange search engine behaviour
Summary: [search] Strange search engine behaviour
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-13 18:58 EST by Dirk Baeumer CLA
Modified: 2005-02-14 11:32 EST (History)
0 users

See Also:


Attachments

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