### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.363 diff -u -r1.363 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 16 Oct 2009 19:44:10 -0000 1.363 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 2 Nov 2009 14:14:54 -0000 @@ -1393,17 +1393,19 @@ MethodBinding candidate = candidates[i]; if (candidate instanceof ParameterizedGenericMethodBinding) candidate = ((ParameterizedGenericMethodBinding) candidate).originalMethod; - if (candidate instanceof ParameterizedMethodBinding) + if (candidate.hasSubstitutedParameters()) { for (int j = i + 1; j < visiblesCount; j++) { MethodBinding otherCandidate = candidates[j]; - if (otherCandidate == candidate - || (candidate.declaringClass == otherCandidate.declaringClass && candidate.areParametersEqual(otherCandidate))) { - return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); + if (otherCandidate.hasSubstitutedParameters()) { + if (otherCandidate == candidate + || (candidate.declaringClass == otherCandidate.declaringClass && candidate.areParametersEqual(otherCandidate))) { + return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); + } } } + } } } - if (inStaticContext) { MethodBinding[] staticCandidates = new MethodBinding[visiblesCount]; int staticCount = 0; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java,v retrieving revision 1.72 diff -u -r1.72 AmbiguousMethodTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 16 Oct 2009 19:44:11 -0000 1.72 +++ src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java 2 Nov 2009 14:15:00 -0000 @@ -3502,4 +3502,30 @@ "" ); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384 +public void test080() { + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " static public abstract class BaseA {};\n" + + " static public abstract class BaseB extends BaseA {};\n" + + " static public class Real extends BaseB {};\n" + + " static BaseA ask(String prompt) {\n" + + " Real impl = new Real();\n" + + " return (BaseA) ask(prompt, impl);\n" + + " }\n" + + " static BaseA ask(String prompt, Real impl) {\n" + + " return null;\n" + + " }\n" + + " static T ask(String prompt, T impl) {\n" + + " return null;\n" + + " }\n" + + " static public void main(String[] args) {\n" + + " System.out.println(\"SUCCESS\");\n" + + " }\n" + + "}\n" + }, + "SUCCESS"); +} }