Community
Participate
Working Groups
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
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...
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()
Verified for 3.1M5