### Eclipse Workspace Patch 1.0 #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.793 diff -u -r1.793 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 25 Mar 2009 20:17:48 -0000 1.793 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 31 Mar 2009 20:34:02 -0000 @@ -49455,4 +49455,81 @@ "" ); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159851 +public void test1450() { + this.runNegativeTest( + new String[] { + "X.java", + "import java.util.*;\n" + + "class A {}\n" + + "class B {}\n" + + "class X>> extends TreeMap> {}\n" + + "\n" + + "class D {}\n" + + "class E {}\n" + + "class Y extends E> {}", + }, + "----------\n" + + "1. WARNING in X.java (at line 4)\n" + + " class X>> extends TreeMap> {}\n" + + " ^\n" + + "The serializable class X does not declare a static final serialVersionUID field of type long\n" + + "----------\n" + + "2. ERROR in X.java (at line 4)\n" + + " class X>> extends TreeMap> {}\n" + + " ^^^^^^^\n" + + "Bound mismatch: The type Integer is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + + "3. ERROR in X.java (at line 4)\n" + + " class X>> extends TreeMap> {}\n" + + " ^^^^^^\n" + + "Bound mismatch: The type String is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + + "4. ERROR in X.java (at line 8)\n" + + " class Y extends E> {}\n" + + " ^\n" + + "Bound mismatch: The type D is not a valid substitute for the bounded parameter of the type E\n" + + "----------\n" + ); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159851 +public void test1451() { + this.runNegativeTest( + new String[] { + "X.java", + "class A {}\n" + + "class B {}\n" + + "class C {}\n" + + "class X extends C>>, A>> {}\n" + + "class Y extends A>> {}\n" + + "class Z extends C, A>> {}", + }, + "----------\n" + + "1. ERROR in X.java (at line 4)\n" + + " class X extends C>>, A>> {}\n" + + " ^^\n" + + "Bound mismatch: The type T1 is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + + "2. ERROR in X.java (at line 4)\n" + + " class X extends C>>, A>> {}\n" + + " ^^\n" + + "Bound mismatch: The type T2 is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + + "3. ERROR in X.java (at line 5)\n" + + " class Y extends A>> {}\n" + + " ^\n" + + "Bound mismatch: The type T is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + + "4. ERROR in X.java (at line 6)\n" + + " class Z extends C, A>> {}\n" + + " ^\n" + + "Bound mismatch: The type T is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + + "5. ERROR in X.java (at line 6)\n" + + " class Z extends C, A>> {}\n" + + " ^\n" + + "Bound mismatch: The type T is not a valid substitute for the bounded parameter of the type B\n" + + "----------\n" + ); +} } \ No newline at end of file #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java,v retrieving revision 1.49 diff -u -r1.49 ParameterizedSingleTypeReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 8 Dec 2008 14:19:29 -0000 1.49 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java 31 Mar 2009 20:34:04 -0000 @@ -231,9 +231,10 @@ ParameterizedTypeBinding parameterizedType = scope.environment().createParameterizedType(currentOriginal, argTypes, enclosingType); // check argument type compatibility - if (checkBounds) { // otherwise will do it in Scope.connectTypeVariables() or generic method resolution + if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution parameterizedType.boundCheck(scope, this.typeArguments); - } + else + scope.rememberTypeReference(this); if (isTypeUseDeprecated(parameterizedType, scope)) reportDeprecatedType(parameterizedType, scope); Index: compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java,v retrieving revision 1.53 diff -u -r1.53 ParameterizedQualifiedTypeReference.java --- compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 8 Dec 2008 14:19:29 -0000 1.53 +++ compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java 31 Mar 2009 20:34:04 -0000 @@ -261,6 +261,8 @@ // check argument type compatibility if (checkBounds) // otherwise will do it in Scope.connectTypeVariables() or generic method resolution parameterizedType.boundCheck(scope, args); + else + scope.rememberTypeReference(this); qualifyingType = parameterizedType; } else { ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original(); Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.353 diff -u -r1.353 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 27 Mar 2009 19:33:56 -0000 1.353 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 31 Mar 2009 20:34:04 -0000 @@ -3907,6 +3907,18 @@ return null; } + public void rememberTypeReference(TypeReference typeRef) { + if (this.kind == CLASS_SCOPE) { + ClassScope classScope = (ClassScope) this; + if (classScope.typeReferences == null) { + classScope.typeReferences = new ArrayList(3); + classScope.typeReferences.add(typeRef); + } else if (!classScope.typeReferences.contains(typeRef)) { + classScope.typeReferences.add(typeRef); + } + } + } + // start position in this scope - for ordering scopes vs. variables int startIndex() { return 0; Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v retrieving revision 1.170 diff -u -r1.170 ClassScope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 30 Mar 2009 06:24:30 -0000 1.170 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 31 Mar 2009 20:34:04 -0000 @@ -32,10 +32,12 @@ public TypeDeclaration referenceContext; public TypeReference superTypeReference; + java.util.ArrayList typeReferences; public ClassScope(Scope parent, TypeDeclaration context) { super(Scope.CLASS_SCOPE, parent); this.referenceContext = context; + this.typeReferences = null; // initialized if required } void buildAnonymousTypeBinding(SourceTypeBinding enclosingType, ReferenceBinding supertype) { @@ -813,19 +815,9 @@ // Perform deferred bound checks for parameterized type references (only done after hierarchy is connected) public void checkParameterizedTypeBounds() { - TypeReference superclass = this.referenceContext.superclass; - if (superclass != null) - superclass.checkBounds(this); - - TypeReference[] superinterfaces = this.referenceContext.superInterfaces; - if (superinterfaces != null) - for (int i = 0, length = superinterfaces.length; i < length; i++) - superinterfaces[i].checkBounds(this); - - TypeParameter[] typeParameters = this.referenceContext.typeParameters; - if (typeParameters != null) - for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) - typeParameters[i].checkBounds(this); + for (int i = 0, l = this.typeReferences == null ? 0 : this.typeReferences.size(); i < l; i++) + ((TypeReference) this.typeReferences.get(i)).checkBounds(this); + this.typeReferences = null; ReferenceBinding[] memberTypes = this.referenceContext.binding.memberTypes; if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES)