### 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.644 diff -u -r1.644 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 13 Sep 2007 22:43:45 -0000 1.644 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 14 Sep 2007 13:18:47 -0000 @@ -38973,4 +38973,165 @@ }, ""); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=169049 +public void test1168() { + this.runNegativeTest( + new String[] { + "example/Container.java", + "package example;\n" + + "class A {}\n" + + "class B extends A {}\n" + + "\n" + + "public interface Container> {\n" + + " > void f(\n" + + " Container a, \n" + + " Container b, \n" + + " Container c, \n" + + " Container d, \n" + + " Container e, \n" + + " Container> f, \n" + + " Container> g,\n" + + " Container> h);\n" + + "}\n", // ================= + }, + "----------\n" + + "1. ERROR in example\\Container.java (at line 12)\n" + + " Container> f, \n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container\n" + + "----------\n" + + "2. ERROR in example\\Container.java (at line 13)\n" + + " Container> g,\n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=169049 - variation +public void test1169() { + this.runNegativeTest( + new String[] { + "example/Container2.java", + "package example;\n" + + "class A {}\n" + + "class B extends A {}\n" + + "\n" + + "public interface Container2> {\n" + + " > void g(\n" + + " Container2 a, \n" + + " Container2 b, \n" + + " Container2 c, \n" + + " Container2 d, \n" + + " Container2 e, \n" + + " Container2> f, \n" + + " Container2> g, \n" + + " Container2 h);\n" + + "\n" + + "}\n", // ================= + }, + "----------\n" + + "1. ERROR in example\\Container2.java (at line 12)\n" + + " Container2> f, \n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container2\n" + + "----------\n"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=169049 - variation +public void test1170() { + this.runNegativeTest( + new String[] { + "example/Container3.java", + "package example;\n" + + "class A {}\n" + + "class B extends A {}\n" + + "class A {}\n" + + "class B extends A {}\n" + + "\n" + + "public interface Container3> {\n" + + " > void g(\n" + + " Container3 a, \n" + + " Container3 b, \n" + + " Container3 c, \n" + + " Container3 d, \n" + + " Container3 e, \n" + + " Container3> f, \n" + + " Container3> g, \n" + + " Container3 h, \n" + + " Container3> i, \n" + + " Container3 j);\n" + + "\n" + + " > void h(\n" + + " Container3 a, \n" + + " Container3 b, \n" + + " Container3 c, \n" + + " Container3 d, \n" + + " Container3 e, \n" + + " Container3> f, \n" + + " Container3> g, \n" + + " Container3 h, \n" + + " Container3> i, \n" + + " Container3 j);\n" + + "}\n", // ================= + }, + "----------\n" + + "1. ERROR in example\\Container3.java (at line 4)\n" + + " class A {}\n" + + " ^\n" + + "The type A is already defined\n" + + "----------\n" + + "2. ERROR in example\\Container3.java (at line 5)\n" + + " class B extends A {}\n" + + " ^\n" + + "The type B is already defined\n" + + "----------\n" + + "3. ERROR in example\\Container3.java (at line 14)\n" + + " Container3> f, \n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "4. ERROR in example\\Container3.java (at line 15)\n" + + " Container3> g, \n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "5. ERROR in example\\Container3.java (at line 17)\n" + + " Container3> i, \n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "6. WARNING in example\\Container3.java (at line 18)\n" + + " Container3 j);\n" + + " ^\n" + + "A is a raw type. References to generic type A should be parameterized\n" + + "----------\n" + + "7. ERROR in example\\Container3.java (at line 18)\n" + + " Container3 j);\n" + + " ^\n" + + "Bound mismatch: The type A is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "8. ERROR in example\\Container3.java (at line 26)\n" + + " Container3> f, \n" + + " ^\n" + + "Bound mismatch: The type B is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "9. ERROR in example\\Container3.java (at line 27)\n" + + " Container3> g, \n" + + " ^\n" + + "Bound mismatch: The type B is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "10. ERROR in example\\Container3.java (at line 29)\n" + + " Container3> i, \n" + + " ^\n" + + "Bound mismatch: The type B is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n" + + "11. WARNING in example\\Container3.java (at line 30)\n" + + " Container3 j);\n" + + " ^\n" + + "B is a raw type. References to generic type B should be parameterized\n" + + "----------\n" + + "12. ERROR in example\\Container3.java (at line 30)\n" + + " Container3 j);\n" + + " ^\n" + + "Bound mismatch: The type B is not a valid substitute for the bounded parameter > of the type Container3\n" + + "----------\n"); +} } #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java,v retrieving revision 1.61 diff -u -r1.61 TypeVariableBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 13 Sep 2007 22:22:57 -0000 1.61 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java 14 Sep 2007 13:18:48 -0000 @@ -127,24 +127,20 @@ } boolean unchecked = false; if (this.superclass.id != TypeIds.T_JavaLangObject) { - TypeBinding superType = this.superclass; - if (superType != argumentType) { // check identity before substituting (104649) - TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, superType) : superType; - if (!argumentType.isCompatibleWith(substitutedSuperType)) { - return TypeConstants.MISMATCH; - } - TypeBinding match = argumentType.findSuperTypeWithSameErasure(substitutedSuperType); - if (match != null){ - // Enum#RAW is not a substitute for > (86838) - if (match.isRawType() && substitutedSuperType.isBoundParameterizedType()) - unchecked = true; - } + TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, this.superclass) : this.superclass; + if (!argumentType.isCompatibleWith(substitutedSuperType)) { + return TypeConstants.MISMATCH; + } + TypeBinding match = argumentType.findSuperTypeWithSameErasure(substitutedSuperType); + if (match != null){ + // Enum#RAW is not a substitute for > (86838) + if (match.isRawType() && substitutedSuperType.isBoundParameterizedType()) + unchecked = true; } } for (int i = 0, length = this.superInterfaces.length; i < length; i++) { - TypeBinding superType = this.superInterfaces[i]; - if (superType != argumentType) { // check identity before substituting (104649) - TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, superType) : superType; + TypeBinding substitutedSuperType = hasSubstitution ? Scope.substitute(substitution, this.superInterfaces[i]) : this.superInterfaces[i]; + if (substitutedSuperType != argumentType) { // check identity before substituting (104649) if (!argumentType.isCompatibleWith(substitutedSuperType)) { return TypeConstants.MISMATCH; }