### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v retrieving revision 1.807 diff -u -r1.807 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 15 Oct 2009 18:57:45 -0000 1.807 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 29 Oct 2009 14:47:20 -0000 @@ -47,6 +47,33 @@ compilerOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.DISABLED); return compilerOptions; } + + public void test0000() { + 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"); + } + public void test0001() { this.runConformTest( #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 29 Oct 2009 14:47:25 -0000 @@ -1398,7 +1398,11 @@ 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 both candidates or neither candidates would have qualified for an exact match, + // on the grounds of having substituted parameters, report ambiguity + // see org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.getExactMethod(char[], TypeBinding[], CompilationUnitScope) + if (candidate.hasSubstitutedParameters() == otherCandidate.hasSubstitutedParameters()) + return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous); } } }