Community
Participate
Working Groups
from bug 165701 Code select behavior is not the same inside code and javadoc with a similar test case ## test case 1: 2 nothing is proposed public <T extends Date> T getMax(final Iterable<T> ip1) { return null; } public <T extends Number> T getMax(final Iterable<T> ip2) { return null; } public void bar(Iterable i) { getMax(i); // do code select here } ## test case 2: 2 getMax methods are proposed public <T extends Date> T getMax(final Iterable<T> ip1) { return null; } public <T extends Number> T getMax(final Iterable<T> ip2) { return null; } public void bar(Iterable<?> i) { getMax(i); // do code select here } test case 3: one method foo is proposed public void foo(Number n) {} public void foo(Integer i) {} public void bar() { foo(null); // do code select here } test case 4: 2 getMax methods are proposed public <T extends Date> T getMax(final Iterable<T> ip1) { return null; } public <T extends Number> T getMax(final Iterable<T> ip2) { return null; } /** * @see #getMax(Iterable) // do code select here */ public void bar() {}
test case 5: nothing is proposed public void foo(Date d) {} public void foo(Integer i) {} public void bar() { foo(null); // do code select here }
Created attachment 54768 [details] Proposed fix
Philippe - what do you think about this patch ? Especially about the changes in compiler (MessageSend, ProblemMethodBinding, Scope, CodeSnippetScope) which add a closest match for ambiguous methods. All our tests succeed with this patch.
Patch looks good.
Created attachment 55230 [details] Better fix Add changes in JavadocMessageSend (thanks Frederic).
Released for 3.3M4. Tests added ResolveTests#testAmbiguousMethod1() ResolveTests_1_5#test103() -> test106() Test updated SelectionJavadocModelTests#testBug165794()
Verified for 3.3M4 with I20061211-1119