Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 82360 Details for
Bug 77918
[compiler] Unnecessary implementation of interface in class declaration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
patch.txt (text/plain), 23.57 KB, created by
Kent Johnson
on 2007-11-07 15:09:34 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2007-11-07 15:09:34 EST
Size:
23.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/core/compiler/IProblem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java,v >retrieving revision 1.195 >diff -u -r1.195 IProblem.java >--- compiler/org/eclipse/jdt/core/compiler/IProblem.java 2 Nov 2007 11:23:24 -0000 1.195 >+++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 7 Nov 2007 18:30:28 -0000 >@@ -111,6 +111,8 @@ > * IBM Corporation - added the following constants > * InvalidUsageOfTypeParametersForAnnotationDeclaration > * InvalidUsageOfTypeParametersForEnumDeclaration >+ * IBM Corporation - added the following constants >+ * RedundantSuperinterface > *******************************************************************************/ > package org.eclipse.jdt.core.compiler; > >@@ -614,6 +616,8 @@ > int ObjectCannotHaveSuperTypes = Internal + 329; > /** @since 3.1 */ > int ObjectMustBeClass = Internal + 330; >+ /** @since 3.4 */ >+ int RedundantSuperinterface = TypeRelated + 331; > > /** @deprecated - problem is no longer generated, use {@link #UndefinedType} instead */ > int SuperclassNotFound = TypeRelated + 329 + ProblemReasons.NotFound; // TypeRelated + 330 >Index: compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties,v >retrieving revision 1.228 >diff -u -r1.228 messages.properties >--- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 2 Nov 2007 11:24:41 -0000 1.228 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 7 Nov 2007 18:30:29 -0000 >@@ -251,6 +251,7 @@ > 328 = The declared package "{1}" does not match the expected package "{0}" > 329 = The type java.lang.Object cannot have a superclass or superinterfaces > 330 = The type java.lang.Object must be a class >+331 = Redundant superinterface {0} for the type {1}, already defined by {2} > > ###[obsolete] 330 = {0} cannot be resolved or is not a valid superclass > ###[obsolete] 331 = Superclass {0} is not visible >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.359 >diff -u -r1.359 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 2 Nov 2007 11:24:51 -0000 1.359 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 7 Nov 2007 18:30:28 -0000 >@@ -311,6 +311,9 @@ > case IProblem.UnusedTypeArgumentsForMethodInvocation: > case IProblem.UnusedTypeArgumentsForConstructorInvocation: > return CompilerOptions.UnusedTypeArguments; >+ >+ case IProblem.RedundantSuperinterface: >+ return CompilerOptions.RedundantSuperinterface; > } > return 0; > } >@@ -409,6 +412,7 @@ > > case (int)(CompilerOptions.UnhandledWarningToken >>> 32): > case (int)(CompilerOptions.UnusedLabel >>> 32): >+ case (int)(CompilerOptions.RedundantSuperinterface >>> 32): > return CategorizedProblem.CAT_UNNECESSARY_CODE; > > case (int)(CompilerOptions.ForbiddenReference >>> 32): >@@ -5707,7 +5711,24 @@ > localDecl.sourceStart, > localDecl.sourceEnd); > } >- >+public void redundantSuperInterface(SourceTypeBinding type, TypeReference reference, ReferenceBinding superinterface, ReferenceBinding declaringType) { >+ int severity = computeSeverity(IProblem.RedundantSuperinterface); >+ if (severity != ProblemSeverities.Ignore) { >+ this.handle( >+ IProblem.RedundantSuperinterface, >+ new String[] { >+ new String(superinterface.readableName()), >+ new String(type.readableName()), >+ new String(declaringType.readableName())}, >+ new String[] { >+ new String(superinterface.shortReadableName()), >+ new String(type.shortReadableName()), >+ new String(declaringType.shortReadableName())}, >+ severity, >+ reference.sourceStart, >+ reference.sourceEnd); >+ } >+} > public void referenceMustBeArrayTypeAt(TypeBinding arrayType, ArrayReference arrayRef) { > this.handle( > IProblem.ArrayReferenceRequired, >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.591 >diff -u -r1.591 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 6 Nov 2007 11:08:26 -0000 1.591 >+++ model/org/eclipse/jdt/core/JavaCore.java 7 Nov 2007 18:30:29 -0000 >@@ -75,6 +75,8 @@ > * COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_NO_TAG > * COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_RETURN_TAG > * COMPILER_PB_MISSING_JAVADOC_TAG_DESCRIPTION_ALL_TAGS >+ * IBM Corporation - added the following constants: >+ * COMPILER_PB_REDUNDANT_SUPERINTERFACE > *******************************************************************************/ > package org.eclipse.jdt.core; > >@@ -760,6 +762,12 @@ > /** > * Possible configurable option ID. > * @see #getDefaultOptions() >+ * @since 3.4 >+ */ >+ public static final String COMPILER_PB_REDUNDANT_SUPERINTERFACE = PLUGIN_ID + ".compiler.problem.redundantSuperinterface"; //$NON-NLS-1$ >+ /** >+ * Possible configurable option ID. >+ * @see #getDefaultOptions() > */ > public static final String CORE_JAVA_BUILD_ORDER = PLUGIN_ID + ".computeJavaBuildOrder"; //$NON-NLS-1$ > /** >@@ -2610,6 +2618,14 @@ > * - possible values: { "error", "warning", "ignore" } > * - default: "warning" > * >+ * COMPILER / Reporting Redundant Superinterface >+ * When enabled, the compiler will issue an error or a warning if a type >+ * explicitly implements an interface that is already implemented by any >+ * of its supertypes. >+ * - option id: "org.eclipse.jdt.core.compiler.problem.redundantSuperinterface" >+ * - possible values: { "error", "warning", "ignore" } >+ * - default: "ignore" >+ * > * BUILDER / Specifying Filters for Resource Copying Control > * Allow to specify some filters to control the resource copy process. > * - option id: "org.eclipse.jdt.core.builder.resourceCopyExclusionFilter" >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.193 >diff -u -r1.193 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 2 Nov 2007 11:23:58 -0000 1.193 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 7 Nov 2007 18:30:28 -0000 >@@ -117,6 +117,7 @@ > public static final String OPTION_ReportOverridingMethodWithoutSuperInvocation = "org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation"; //$NON-NLS-1$ > public static final String OPTION_GenerateClassFiles = "org.eclipse.jdt.core.compiler.generateClassFiles"; //$NON-NLS-1$ > public static final String OPTION_Process_Annotations = "org.eclipse.jdt.core.compiler.processAnnotations"; //$NON-NLS-1$ >+ public static final String OPTION_ReportRedundantSuperinterface = "org.eclipse.jdt.core.compiler.problem.redundantSuperinterface"; //$NON-NLS-1$ > > // Backward compatibility > public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$ >@@ -210,6 +211,7 @@ > public static final long MissingJavadocTagDescription = ASTNode.Bit53L; > public static final long UnusedTypeArguments = ASTNode.Bit54L; > public static final long UnusedWarningToken = ASTNode.Bit55L; >+ public static final long RedundantSuperinterface = ASTNode.Bit56L; > > // Map: String optionKey --> Long irritant> > private static Map OptionToIrritants; >@@ -453,6 +455,7 @@ > optionsMap.put(OPTION_ReportOverridingMethodWithoutSuperInvocation, getSeverityString(OverridingMethodWithoutSuperInvocation)); > optionsMap.put(OPTION_GenerateClassFiles, this.generateClassFiles ? ENABLED : DISABLED); > optionsMap.put(OPTION_Process_Annotations, this.processAnnotations ? ENABLED : DISABLED); >+ optionsMap.put(OPTION_ReportRedundantSuperinterface, getSeverityString(RedundantSuperinterface)); > return optionsMap; > } > >@@ -581,6 +584,8 @@ > return OPTION_ReportUnusedTypeArgumentsForMethodInvocation; > case (int)(UnusedWarningToken >>> 32) : > return OPTION_ReportUnusedWarningToken; >+ case (int)(RedundantSuperinterface >>> 32) : >+ return OPTION_ReportRedundantSuperinterface; > } > } > return null; >@@ -862,6 +867,7 @@ > if ((optionValue = optionsMap.get(OPTION_ReportFallthroughCase)) != null) updateSeverity(FallthroughCase, optionValue); > if ((optionValue = optionsMap.get(OPTION_ReportOverridingMethodWithoutSuperInvocation)) != null) updateSeverity(OverridingMethodWithoutSuperInvocation, optionValue); > if ((optionValue = optionsMap.get(OPTION_ReportUnusedTypeArgumentsForMethodInvocation)) != null) updateSeverity(UnusedTypeArguments, optionValue); >+ if ((optionValue = optionsMap.get(OPTION_ReportRedundantSuperinterface)) != null) updateSeverity(RedundantSuperinterface, optionValue); > > // Javadoc options > if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { >@@ -1056,6 +1062,7 @@ > buf.append("\n\t- generate class files: ").append(this.generateClassFiles ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- process annotations: ").append(this.processAnnotations ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- unused type arguments for method/constructor invocation: ").append(getSeverityString(UnusedTypeArguments)); //$NON-NLS-1$ >+ buf.append("\n\t- redundant superinterface: ").append(getSeverityString(RedundantSuperinterface)); //$NON-NLS-1$ > return buf.toString(); > } > >@@ -1178,6 +1185,7 @@ > OPTION_ReportNullReference, > OPTION_ReportPotentialNullReference, > OPTION_ReportRedundantNullCheck, >+ OPTION_ReportRedundantSuperinterface, > OPTION_ReportOverridingPackageDefaultMethod, > OPTION_ReportParameterAssignment, > OPTION_ReportPossibleAccidentalBooleanAssignment, >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java,v >retrieving revision 1.90 >diff -u -r1.90 MethodVerifier.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 2 Nov 2007 18:12:34 -0000 1.90 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java 7 Nov 2007 18:30:28 -0000 >@@ -10,8 +10,7 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.lookup; > >-import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; >-import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; >+import org.eclipse.jdt.internal.compiler.ast.*; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; >@@ -235,6 +234,67 @@ > void checkForBridgeMethod(MethodBinding currentMethod, MethodBinding inheritedMethod, MethodBinding[] allInheritedMethods) { > // no op before 1.5 > } >+void checkForRedundantSuperinterfaces(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) { >+ if (superInterfaces == Binding.NO_SUPERINTERFACES) return; >+ >+ SimpleSet interfacesToCheck = new SimpleSet(superInterfaces.length); >+ for (int i = 0, l = superInterfaces.length; i < l; i++) >+ interfacesToCheck.add(superInterfaces[i]); >+ ReferenceBinding[] itsInterfaces = null; >+ SimpleSet inheritedInterfaces = new SimpleSet(5); >+ ReferenceBinding superType = superclass; >+ while (superType != null && superType.isValidBinding()) { >+ if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) { >+ for (int i = 0, l = itsInterfaces.length; i < l; i++) { >+ ReferenceBinding inheritedInterface = itsInterfaces[i]; >+ if (!inheritedInterfaces.includes(inheritedInterface) && inheritedInterface.isValidBinding()) { >+ if (interfacesToCheck.includes(inheritedInterface)) { >+ TypeReference[] refs = this.type.scope.referenceContext.superInterfaces; >+ for (int r = 0, rl = refs.length; r < rl; r++) { >+ if (refs[r].resolvedType == inheritedInterface) { >+ problemReporter().redundantSuperInterface(this.type, refs[r], inheritedInterface, superType); >+ break; >+ } >+ } >+ } else { >+ inheritedInterfaces.add(inheritedInterface); >+ } >+ } >+ } >+ } >+ superType = superType.superclass(); >+ } >+ >+ int nextPosition = inheritedInterfaces.elementSize; >+ if (nextPosition == 0) return; >+ ReferenceBinding[] interfacesToVisit = new ReferenceBinding[nextPosition]; >+ inheritedInterfaces.asArray(interfacesToVisit); >+ for (int i = 0; i < nextPosition; i++) { >+ superType = interfacesToVisit[i]; >+ if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) { >+ int itsLength = itsInterfaces.length; >+ if (nextPosition + itsLength >= interfacesToVisit.length) >+ System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); >+ for (int a = 0; a < itsLength; a++) { >+ ReferenceBinding inheritedInterface = itsInterfaces[a]; >+ if (!inheritedInterfaces.includes(inheritedInterface) && inheritedInterface.isValidBinding()) { >+ if (interfacesToCheck.includes(inheritedInterface)) { >+ TypeReference[] refs = this.type.scope.referenceContext.superInterfaces; >+ for (int r = 0, rl = refs.length; r < rl; r++) { >+ if (refs[r].resolvedType == inheritedInterface) { >+ problemReporter().redundantSuperInterface(this.type, refs[r], inheritedInterface, superType); >+ break; >+ } >+ } >+ } else { >+ inheritedInterfaces.add(inheritedInterface); >+ interfacesToVisit[nextPosition++] = inheritedInterface; >+ } >+ } >+ } >+ } >+ } >+} > void checkInheritedMethods(MethodBinding[] methods, int length) { > if (length > 1) { > int[] overriddenInheritedMethods = findOverriddenInheritedMethods(methods, length); >@@ -418,6 +478,7 @@ > ? this.type.scope.getJavaLangObject() // check interface methods against Object > : this.type.superclass(); // class or enum > computeInheritedMethods(superclass, type.superInterfaces()); >+ checkForRedundantSuperinterfaces(superclass, type.superInterfaces()); > } > /* > Binding creation is responsible for reporting: >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/SuperTypeTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuperTypeTest.java,v >retrieving revision 1.4 >diff -u -r1.4 SuperTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/SuperTypeTest.java 16 Oct 2007 10:24:52 -0000 1.4 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/SuperTypeTest.java 7 Nov 2007 18:30:32 -0000 >@@ -11,7 +11,9 @@ > package org.eclipse.jdt.core.tests.compiler.regression; > > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > >+import java.util.Map; > import junit.framework.Test; > > public class SuperTypeTest extends AbstractRegressionTest { >@@ -265,4 +267,109 @@ > "----------\n" > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// default is silent >+public void test008() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X implements I {}\n" + >+ "class Y extends X implements I, J {}" + >+ "interface I {}\n" + >+ "interface J {}\n" >+ }, >+ "" >+ ); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// raising an error >+public void test009() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X implements I {}\n" + >+ "class Y extends X implements I, J {}\n" + >+ "interface I {}\n" + >+ "interface J {}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " class Y extends X implements I, J {}\n" + >+ " ^\n" + >+ "Redundant superinterface I for the type Y, already defined by X\n" + >+ "----------\n", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ customOptions); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// raising an error - deeper hierarchy >+public void test010() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X implements I {}\n" + >+ "class Y extends X {}\n" + >+ "class Z extends Y implements J, I {}\n" + >+ "interface I {}\n" + >+ "interface J {}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " class Z extends Y implements J, I {}\n" + >+ " ^\n" + >+ "Redundant superinterface I for the type Z, already defined by X\n" + >+ "----------\n", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ customOptions); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// no error - deeper hierarchy >+public void test011() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X implements I {}\n" + >+ "class Y extends X {}\n" + >+ "class Z extends Y implements J {}" + >+ "interface I {}\n" + >+ "interface J {}\n" >+ }, >+ "", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ null /* no vm arguments */, >+ customOptions, >+ null /* no custom requestor*/); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// error - extending interfaces >+public void test012() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X implements J {}\n" + >+ "class Y extends X implements I {}\n" + >+ "interface I {}\n" + >+ "interface J extends I {}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " class Y extends X implements I {}\n" + >+ " ^\n" + >+ "Redundant superinterface I for the type Y, already defined by J\n" + >+ "----------\n", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ customOptions); >+} > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.130 >diff -u -r1.130 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 7 Nov 2007 17:05:55 -0000 1.130 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 7 Nov 2007 18:30:30 -0000 >@@ -37,7 +37,7 @@ > > static { > // TESTS_NAMES = new String[] { "test000" }; >-// TESTS_NUMBERS = new int[] { 152 }; >+// TESTS_NUMBERS = new int[] { 24 }; > // TESTS_RANGE = new int[] { 107, -1 }; > } > public BatchCompilerTest(String name) { >@@ -1273,6 +1273,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + >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.670 >diff -u -r1.670 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 2 Nov 2007 14:02:21 -0000 1.670 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 7 Nov 2007 18:30:32 -0000 >@@ -40593,4 +40593,53 @@ > "Unused type arguments for the non generic constructor Local() of type Local; it should not be parameterized with arguments <String>\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// generic variants >+public void test1212() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> implements I<T> {}\n" + >+ "class Y<T extends Z> extends X<T> implements I<T>, J {}\n" + >+ "class Z {}" + >+ "interface I <T> {}\n" + >+ "interface J {}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " class Y<T extends Z> extends X<T> implements I<T>, J {}\n" + >+ " ^\n" + >+ "Redundant superinterface I<T> for the type Y<T>, already defined by X<T>\n" + >+ "----------\n", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ customOptions); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918 >+// generic variants - the 'different arguments' error overrides the >+// redundant error >+public void test1213() { >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X<T> implements I<T> {}\n" + >+ "class Y<T extends Z, U extends T> extends X<T> implements I<U>, J {}\n" + >+ "class Z {}" + >+ "interface I <T> {}\n" + >+ "interface J {}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " class Y<T extends Z, U extends T> extends X<T> implements I<U>, J {}\n" + >+ " ^\n" + >+ "The interface I cannot be implemented more than once with different arguments: I<T> and I<U>\n" + >+ "----------\n", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ customOptions); >+} > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 77918
:
71591
| 82360 |
82461