View | Details | Raw Unified | Return to bug 293384 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-5 / +7 lines)
Lines 1393-1409 Link Here
1393
				MethodBinding candidate = candidates[i];
1393
				MethodBinding candidate = candidates[i];
1394
				if (candidate instanceof ParameterizedGenericMethodBinding)
1394
				if (candidate instanceof ParameterizedGenericMethodBinding)
1395
					candidate = ((ParameterizedGenericMethodBinding) candidate).originalMethod;
1395
					candidate = ((ParameterizedGenericMethodBinding) candidate).originalMethod;
1396
				if (candidate instanceof ParameterizedMethodBinding)
1396
				if (candidate.hasSubstitutedParameters()) {
1397
					for (int j = i + 1; j < visiblesCount; j++) {
1397
					for (int j = i + 1; j < visiblesCount; j++) {
1398
						MethodBinding otherCandidate = candidates[j];
1398
						MethodBinding otherCandidate = candidates[j];
1399
						if (otherCandidate == candidate
1399
						if (otherCandidate.hasSubstitutedParameters()) {
1400
								|| (candidate.declaringClass == otherCandidate.declaringClass && candidate.areParametersEqual(otherCandidate))) {
1400
							if (otherCandidate == candidate
1401
							return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous);
1401
									|| (candidate.declaringClass == otherCandidate.declaringClass && candidate.areParametersEqual(otherCandidate))) {
1402
								return new ProblemMethodBinding(candidates[i], candidates[i].selector, candidates[i].parameters, ProblemReasons.Ambiguous);
1403
							}
1402
						}
1404
						}
1403
					}
1405
					}
1406
				}
1404
			}
1407
			}
1405
		}
1408
		}
1406
1407
		if (inStaticContext) {
1409
		if (inStaticContext) {
1408
			MethodBinding[] staticCandidates = new MethodBinding[visiblesCount];
1410
			MethodBinding[] staticCandidates = new MethodBinding[visiblesCount];
1409
			int staticCount = 0;
1411
			int staticCount = 0;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (+26 lines)
Lines 3502-3505 Link Here
3502
		""
3502
		""
3503
	);
3503
	);
3504
}
3504
}
3505
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384
3506
public void test080() {
3507
	this.runConformTest(
3508
		new String[] {
3509
			"X.java",
3510
			"public class X<Tout extends Object> {\n" +
3511
			"   static public abstract class BaseA {};\n" +
3512
			"	static public abstract class BaseB extends BaseA {};\n" +
3513
			"	static public class Real extends BaseB {};\n" +
3514
			"	static BaseA ask(String prompt) {\n" +
3515
			"	    Real impl = new Real();\n" +
3516
			"	    return (BaseA) ask(prompt, impl);\n" +
3517
			"	}\n" +
3518
			"	static BaseA ask(String prompt, Real impl) {\n" +
3519
			"	    return null;\n" +
3520
			"	}\n" +
3521
			"	static <T extends BaseA> T ask(String prompt, T impl) {\n" +
3522
			"	    return null;\n" +
3523
			"	}\n" +
3524
			"	static public void main(String[] args) {\n" +
3525
			"        System.out.println(\"SUCCESS\");\n" +
3526
			"	}\n" +
3527
			"}\n"
3528
		},
3529
		"SUCCESS");
3530
}
3505
}
3531
}

Return to bug 293384