Index: compiler/org/eclipse/jdt/core/compiler/IProblem.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java,v retrieving revision 1.150 diff -u -r1.150 IProblem.java --- compiler/org/eclipse/jdt/core/compiler/IProblem.java 11 May 2005 23:55:36 -0000 1.150 +++ compiler/org/eclipse/jdt/core/compiler/IProblem.java 21 Jun 2005 13:10:04 -0000 @@ -943,8 +943,7 @@ int MissingArgumentsForParameterizedMemberType = TypeRelated + 562; /** @since 3.1 */ int StaticMemberOfParameterizedType = TypeRelated + 563; - /** @since 3.1 */ - int BoundHasConflictingArguments = TypeRelated + 564; + /** @since 3.1 */ int DuplicateParameterizedMethods = MethodRelated + 565; /** @since 3.1 */ Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.230 diff -u -r1.230 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 16 Jun 2005 08:57:07 -0000 1.230 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 21 Jun 2005 13:10:07 -0000 @@ -372,7 +372,8 @@ protected boolean connectTypeVariables(TypeParameter[] typeParameters) { boolean noProblems = true; if (typeParameters == null || compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return true; - + TypeBinding[] types = new TypeBinding[2]; + Map invocations = new HashMap(2); nextVariable : for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) { TypeParameter typeParameter = typeParameters[i]; TypeVariableBinding typeVariable = typeParameter.binding; @@ -415,10 +416,8 @@ typeVariable.superclass = superRefType; } else { typeVariable.superInterfaces = new ReferenceBinding[] {superRefType}; - typeVariable.modifiers |= AccInterface; } typeVariable.firstBound = superRefType; // first bound used to compute erasure - TypeReference[] boundRefs = typeParameter.bounds; if (boundRefs != null) { for (int j = 0, k = boundRefs.length; j < k; j++) { @@ -432,6 +431,7 @@ continue nextVariable; } typeRef.resolvedType = superType; // hold onto the problem type + types[0] = superType; if (superType.isArrayType()) { problemReporter().boundCannotBeArray(typeRef, superType); continue nextVariable; @@ -443,27 +443,44 @@ noProblems = false; continue nextVariable; } - if (superType.isParameterizedType()) { + // check against superclass + if (typeVariable.firstBound == typeVariable.superclass) { ReferenceBinding match = typeVariable.superclass.findSuperTypeWithSameErasure(superType); - boolean isCollision = match != null && match != superType; - for (int index = typeVariable.superInterfaces.length; !isCollision && --index >= 0;) { - ReferenceBinding temp = typeVariable.superInterfaces[index]; - isCollision = superType != temp && superType.erasure() == temp.erasure(); - } - if (isCollision) { - problemReporter().boundHasConflictingArguments(typeRef, superType); + if (match != null && match != superType) { + problemReporter().superinterfacesCollide(superType.erasure(), typeRef, superType, match); typeVariable.tagBits |= HierarchyHasProblems; noProblems = false; continue nextVariable; - } + } } + // check against superinterfaces for (int index = typeVariable.superInterfaces.length; --index >= 0;) { - if (superType.erasure() == typeVariable.superInterfaces[index].erasure()) { + ReferenceBinding previousInterface = typeVariable.superInterfaces[index]; + if (previousInterface == superRefType) { problemReporter().duplicateBounds(typeRef, superType); typeVariable.tagBits |= HierarchyHasProblems; noProblems = false; continue nextVariable; } + types[1] = previousInterface; + invocations.clear(); + TypeBinding[] mecs = minimalErasedCandidates(types, invocations); + if (mecs != null) { + nextCandidate: for (int m = 0, max = mecs.length; m < max; m++) { + TypeBinding mec = mecs[m]; + if (mec == null) continue nextCandidate; + Set invalidInvocations = (Set)invocations.get(mec); + int invalidSize = invalidInvocations.size(); + if (invalidSize > 1) { + TypeBinding[] collisions; + invalidInvocations.toArray(collisions = new TypeBinding[invalidSize]); + problemReporter().superinterfacesCollide(collisions[0].erasure(), typeRef, collisions[0], collisions[1]); + typeVariable.tagBits |= HierarchyHasProblems; + noProblems = false; + continue nextVariable; + } + } + } } int size = typeVariable.superInterfaces.length; System.arraycopy(typeVariable.superInterfaces, 0, typeVariable.superInterfaces = new ReferenceBinding[size + 1], 0, size); Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v retrieving revision 1.252 diff -u -r1.252 ProblemReporter.java --- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 6 Jun 2005 18:24:56 -0000 1.252 +++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 21 Jun 2005 13:10:11 -0000 @@ -314,14 +314,6 @@ location.sourceStart, location.sourceEnd); } -public void boundHasConflictingArguments(ASTNode location, TypeBinding type) { - this.handle( - IProblem.BoundHasConflictingArguments, - new String[] {new String(type.readableName())}, - new String[] {new String(type.shortReadableName())}, - location.sourceStart, - location.sourceEnd); -} public void boundMustBeAnInterface(ASTNode location, TypeBinding type) { this.handle( IProblem.BoundMustBeAnInterface, @@ -4888,13 +4880,13 @@ superInterfaceRef.sourceStart, superInterfaceRef.sourceEnd); } -public void superinterfacesCollide(TypeBinding type, TypeDeclaration typeDecl, TypeBinding superType, TypeBinding inheritedSuperType) { +public void superinterfacesCollide(TypeBinding type, ASTNode decl, TypeBinding superType, TypeBinding inheritedSuperType) { this.handle( IProblem.SuperInterfacesCollide, new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())}, new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())}, - typeDecl.sourceStart, - typeDecl.sourceEnd); + decl.sourceStart, + decl.sourceEnd); } public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) { String name = new String(type.sourceName()); Index: compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties,v retrieving revision 1.178 diff -u -r1.178 messages.properties --- compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 30 May 2005 15:53:25 -0000 1.178 +++ compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties 21 Jun 2005 13:10:12 -0000 @@ -456,7 +456,7 @@ 561 = The member type {0}<{1}> must be qualified with a parameterized type, since it is not static 562 = The member type {0} must be parameterized, since it is qualified with a parameterized type 563 = The member type {0} cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type {1} -564 = Bound conflict: {0} is inherited with conflicting arguments + 565 = Duplicate methods named {0} with the parameters ({2}) and ({3}) are defined by the type {1} 566 = Cannot allocate the member type {0} using a parameterized compound name; use its simple name and an enclosing instance of type {1} 567 = Duplicate bound {0}