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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (+15 lines)
Lines 541-546 Link Here
541
				int count = index + 1;
541
				int count = index + 1;
542
				while (--count > 0) {
542
				while (--count > 0) {
543
					MethodBinding match = matchingInherited[count];
543
					MethodBinding match = matchingInherited[count];
544
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556
545
					MethodBinding interfaceMethod = null, implementation = null;
546
					if (first.declaringClass.isInterface()) {
547
						interfaceMethod = first;
548
					} else if (first.declaringClass.isClass()) {
549
						implementation = first;
550
					}
551
					if (match.declaringClass.isInterface()) {
552
						interfaceMethod = match;
553
					} else if (match.declaringClass.isClass()) {
554
						implementation = match;
555
					}
556
					if (interfaceMethod != null && implementation != null && !isAsVisible(implementation, interfaceMethod))
557
						problemReporter().visibilityConflict(typeParameter, implementation, interfaceMethod);
558
					
544
					if (areReturnTypesCompatible(first, match)) continue;
559
					if (areReturnTypesCompatible(first, match)) continue;
545
					// unrelated interfaces - check to see if return types are compatible
560
					// unrelated interfaces - check to see if return types are compatible
546
					if (first.declaringClass.isInterface() && match.declaringClass.isInterface() && areReturnTypesCompatible(match, first))
561
					if (first.declaringClass.isInterface() && match.declaringClass.isInterface() && areReturnTypesCompatible(match, first))
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +12 lines)
Lines 7430-7439 Link Here
7430
		// 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method.
7430
		// 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method.
7431
		IProblem.MethodReducesVisibility,
7431
		IProblem.MethodReducesVisibility,
7432
		new String[] {new String(inheritedMethod.declaringClass.readableName())},
7432
		new String[] {new String(inheritedMethod.declaringClass.readableName())},
7433
		new String[] {new String(inheritedMethod.declaringClass.shortReadableName())},
7433
		new String[] {new String(""), new String(inheritedMethod.declaringClass.shortReadableName())}, //$NON-NLS-1$
7434
		currentMethod.sourceStart(),
7434
		currentMethod.sourceStart(),
7435
		currentMethod.sourceEnd());
7435
		currentMethod.sourceEnd());
7436
}
7436
}
7437
public void visibilityConflict(TypeParameter typeParameter, MethodBinding currentMethod, MethodBinding inheritedMethod) {
7438
	this.handle(
7439
		//	Cannot reduce the visibility of the inherited method from %1
7440
		// 8.4.6.3 - The access modifier of an hiding method must provide at least as much access as the hidden method.
7441
		// 8.4.6.3 - The access modifier of an overiding method must provide at least as much access as the overriden method.
7442
		IProblem.MethodReducesVisibility,
7443
		new String[] {new String(inheritedMethod.declaringClass.readableName())},
7444
		new String[] {new String(inheritedMethod.shortReadableName()), new String(inheritedMethod.declaringClass.shortReadableName())},
7445
		typeParameter.sourceStart(),
7446
		typeParameter.sourceEnd());
7447
}
7437
public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
7448
public void wildcardAssignment(TypeBinding variableType, TypeBinding expressionType, ASTNode location) {
7438
	this.handle(
7449
	this.handle(
7439
		IProblem.WildcardFieldAssignment,
7450
		IProblem.WildcardFieldAssignment,
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-1 / +1 lines)
Lines 348-354 Link Here
348
406 = This instance method cannot override the static method from {0}
348
406 = This instance method cannot override the static method from {0}
349
407 = This static method cannot hide the instance method from {0}
349
407 = This static method cannot hide the instance method from {0}
350
408 = The static method {0} conflicts with the abstract method in {1}
350
408 = The static method {0} conflicts with the abstract method in {1}
351
409 = Cannot reduce the visibility of the inherited method from {0}
351
409 = Cannot reduce the visibility of the inherited method {0} from {1}
352
410 = The method {0} does not override the inherited method from {1} since it is private to a different package
352
410 = The method {0} does not override the inherited method from {1} since it is private to a different package
353
411 = This class must implement the inherited abstract method {1}, but cannot override it since it is not visible from {0}. Either make the type abstract or make the inherited method visible
353
411 = This class must implement the inherited abstract method {1}, but cannot override it since it is not visible from {0}. Either make the type abstract or make the inherited method visible
354
412 = The method {0} overrides a deprecated method from {1}
354
412 = The method {0} overrides a deprecated method from {1}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (+18 lines)
Lines 50513-50516 Link Here
50513
		"Type mismatch: cannot convert from AnotherClass<capture#1-of ? extends IReferencedInterface> to AnotherClass<IReferencedInterface>\n" + 
50513
		"Type mismatch: cannot convert from AnotherClass<capture#1-of ? extends IReferencedInterface> to AnotherClass<IReferencedInterface>\n" + 
50514
		"----------\n");
50514
		"----------\n");
50515
}
50515
}
50516
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556
50517
public void test1463() {
50518
	this.runNegativeTest(
50519
		new String[] {
50520
			"BaseType.java",
50521
            "public interface BaseType {\n" +
50522
            "	   BaseType clone() throws CloneNotSupportedException;\n" +
50523
            "}\n" +
50524
            "interface SubType<T extends BaseType & java.io.Closeable> extends BaseType {\n" +
50525
            "}\n"
50526
		},
50527
		"----------\n" + 
50528
		"1. ERROR in BaseType.java (at line 4)\n" + 
50529
		"	interface SubType<T extends BaseType & java.io.Closeable> extends BaseType {\n" + 
50530
		"	                  ^\n" + 
50531
		"Cannot reduce the visibility of the inherited method clone() from BaseType\n" + 
50532
		"----------\n");
50533
}
50516
}
50534
}

Return to bug 314556