### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java,v retrieving revision 1.112 diff -u -r1.112 MethodVerifier15.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 23 Jun 2010 08:25:53 -0000 1.112 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java 9 Jul 2010 03:21:58 -0000 @@ -541,6 +541,21 @@ int count = index + 1; while (--count > 0) { MethodBinding match = matchingInherited[count]; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556 + MethodBinding interfaceMethod = null, implementation = null; + if (first.declaringClass.isInterface()) { + interfaceMethod = first; + } else if (first.declaringClass.isClass()) { + implementation = first; + } + if (match.declaringClass.isInterface()) { + interfaceMethod = match; + } else if (match.declaringClass.isClass()) { + implementation = match; + } + if (interfaceMethod != null && implementation != null && !isAsVisible(implementation, interfaceMethod)) + problemReporter().inheritedMethodReducesVisibility(typeParameter, implementation, new MethodBinding [] {interfaceMethod}); + if (areReturnTypesCompatible(first, match)) continue; // unrelated interfaces - check to see if return types are compatible if (first.declaringClass.isInterface() && match.declaringClass.isInterface() && areReturnTypesCompatible(match, first)) Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v retrieving revision 1.412 diff -u -r1.412 ProblemReporter.java --- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 7 Jul 2010 05:56:10 -0000 1.412 +++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 9 Jul 2010 03:22:01 -0000 @@ -2747,7 +2747,7 @@ location.sourceStart, location.sourceEnd); } -public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { +private void inheritedMethodReducesVisibility(int sourceStart, int sourceEnd, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { StringBuffer concreteSignature = new StringBuffer(); concreteSignature .append(concreteMethod.declaringClass.readableName()) @@ -2767,8 +2767,14 @@ new String[] { shortSignature.toString(), new String(abstractMethods[0].declaringClass.shortReadableName())}, - type.sourceStart(), - type.sourceEnd()); + sourceStart, + sourceEnd); +} +public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { + inheritedMethodReducesVisibility(type.sourceStart(), type.sourceEnd(), concreteMethod, abstractMethods); +} +public void inheritedMethodReducesVisibility(TypeParameter typeParameter, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { + inheritedMethodReducesVisibility(typeParameter.sourceStart(), typeParameter.sourceEnd(), concreteMethod, abstractMethods); } public void inheritedMethodsHaveIncompatibleReturnTypes(ASTNode location, MethodBinding[] inheritedMethods, int length) { StringBuffer methodSignatures = new StringBuffer(); #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.821 diff -u -r1.821 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 24 Jun 2010 07:30:00 -0000 1.821 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 9 Jul 2010 03:22:29 -0000 @@ -50513,4 +50513,22 @@ "Type mismatch: cannot convert from AnotherClass to AnotherClass\n" + "----------\n"); } +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556 +public void test1463() { + this.runNegativeTest( + new String[] { + "BaseType.java", + "public interface BaseType {\n" + + " BaseType clone() throws CloneNotSupportedException;\n" + + "}\n" + + "interface SubType extends BaseType {\n" + + "}\n" + }, + "----------\n" + + "1. ERROR in BaseType.java (at line 4)\n" + + " interface SubType extends BaseType {\n" + + " ^\n" + + "The inherited method Object.clone() cannot hide the public abstract method in BaseType\n" + + "----------\n"); +} } \ No newline at end of file