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 78424 Details for
Bug 169049
[1.5][compiler] Bogus bound mismatch errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
169049.txt (text/plain), 10.94 KB, created by
Philipe Mulet
on 2007-09-14 09:19:06 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2007-09-14 09:19:06 EDT
Size:
10.94 KB
patch
obsolete
>### 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<E> {}\n" + >+ "class B<E> extends A<E> {}\n" + >+ "\n" + >+ "public interface Container<T, U extends T, V extends A<T>> {\n" + >+ " <T1, U1 extends T1, V1 extends A<T1>> void f(\n" + >+ " Container<?, ?, ?> a, \n" + >+ " Container<?, ? extends T1, ?> b, \n" + >+ " Container<T1, U1, V1> c, \n" + >+ " Container<? extends T1, ? extends U1, ? extends V1> d, \n" + >+ " Container<T1, ? extends U1, ? extends V1> e, \n" + >+ " Container<T1, ? extends U1, A<T>> f, \n" + >+ " Container<T1, U1, A<U1>> g,\n" + >+ " Container<T1, U1, A<T1>> h);\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in example\\Container.java (at line 12)\n" + >+ " Container<T1, ? extends U1, A<T>> f, \n" + >+ " ^\n" + >+ "Bound mismatch: The type A<T> is not a valid substitute for the bounded parameter <V extends A<T>> of the type Container<T,U,V>\n" + >+ "----------\n" + >+ "2. ERROR in example\\Container.java (at line 13)\n" + >+ " Container<T1, U1, A<U1>> g,\n" + >+ " ^\n" + >+ "Bound mismatch: The type A<U1> is not a valid substitute for the bounded parameter <V extends A<T>> of the type Container<T,U,V>\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<E> {}\n" + >+ "class B<E> extends A<E> {}\n" + >+ "\n" + >+ "public interface Container2<T, U extends T, V extends A<? extends T>> {\n" + >+ " <T1, U1 extends T1, V1 extends A<? extends T1>> void g(\n" + >+ " Container2<?, ?, ?> a, \n" + >+ " Container2<?, ? extends T1, ?> b, \n" + >+ " Container2<T1, U1, V1> c, \n" + >+ " Container2<? extends T1, ? extends U1, ? extends V1> d, \n" + >+ " Container2<T1, ? extends U1, ? extends V1> e, \n" + >+ " Container2<T1, ? extends U1, A<T>> f, \n" + >+ " Container2<T1, U1, A<U1>> g, \n" + >+ " Container2<? extends T1, U1, ? extends V1> h);\n" + >+ "\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in example\\Container2.java (at line 12)\n" + >+ " Container2<T1, ? extends U1, A<T>> f, \n" + >+ " ^\n" + >+ "Bound mismatch: The type A<T> is not a valid substitute for the bounded parameter <V extends A<? extends T>> of the type Container2<T,U,V>\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<E> {}\n" + >+ "class B<E> extends A<E> {}\n" + >+ "class A<E> {}\n" + >+ "class B<E> extends A<E> {}\n" + >+ "\n" + >+ "public interface Container3<T, U extends T, V extends A<? super T>> {\n" + >+ " <T1, U1 extends T1, V1 extends A<? super T1>> void g(\n" + >+ " Container3<?, ?, ?> a, \n" + >+ " Container3<?, ? extends T1, ?> b, \n" + >+ " Container3<T1, U1, V1> c, \n" + >+ " Container3<? extends T1, ? extends U1, ? extends V1> d, \n" + >+ " Container3<T1, ? extends U1, ? extends V1> e, \n" + >+ " Container3<T1, ? extends U1, A<T>> f, \n" + >+ " Container3<T1, U1, A<U1>> g, \n" + >+ " Container3<? extends T1, U1, ? extends V1> h, \n" + >+ " Container3<T1, ? extends U1, A<? super T>> i, \n" + >+ " Container3<T1, ? extends U1, A> j);\n" + >+ "\n" + >+ " <T1, U1 extends T1, V1 extends B<? super T1>> void h(\n" + >+ " Container3<?, ?, ?> a, \n" + >+ " Container3<?, ? extends T1, ?> b, \n" + >+ " Container3<T1, U1, V1> c, \n" + >+ " Container3<? extends T1, ? extends U1, ? extends V1> d, \n" + >+ " Container3<T1, ? extends U1, ? extends V1> e, \n" + >+ " Container3<T1, ? extends U1, B<T>> f, \n" + >+ " Container3<T1, U1, B<U1>> g, \n" + >+ " Container3<? extends T1, U1, ? extends V1> h, \n" + >+ " Container3<T1, ? extends U1, B<? super T>> i, \n" + >+ " Container3<T1, ? extends U1, B> j);\n" + >+ "}\n", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in example\\Container3.java (at line 4)\n" + >+ " class A<E> {}\n" + >+ " ^\n" + >+ "The type A is already defined\n" + >+ "----------\n" + >+ "2. ERROR in example\\Container3.java (at line 5)\n" + >+ " class B<E> extends A<E> {}\n" + >+ " ^\n" + >+ "The type B is already defined\n" + >+ "----------\n" + >+ "3. ERROR in example\\Container3.java (at line 14)\n" + >+ " Container3<T1, ? extends U1, A<T>> f, \n" + >+ " ^\n" + >+ "Bound mismatch: The type A<T> is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "4. ERROR in example\\Container3.java (at line 15)\n" + >+ " Container3<T1, U1, A<U1>> g, \n" + >+ " ^\n" + >+ "Bound mismatch: The type A<U1> is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "5. ERROR in example\\Container3.java (at line 17)\n" + >+ " Container3<T1, ? extends U1, A<? super T>> i, \n" + >+ " ^\n" + >+ "Bound mismatch: The type A<? super T> is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "6. WARNING in example\\Container3.java (at line 18)\n" + >+ " Container3<T1, ? extends U1, A> j);\n" + >+ " ^\n" + >+ "A is a raw type. References to generic type A<E> should be parameterized\n" + >+ "----------\n" + >+ "7. ERROR in example\\Container3.java (at line 18)\n" + >+ " Container3<T1, ? extends U1, A> j);\n" + >+ " ^\n" + >+ "Bound mismatch: The type A is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "8. ERROR in example\\Container3.java (at line 26)\n" + >+ " Container3<T1, ? extends U1, B<T>> f, \n" + >+ " ^\n" + >+ "Bound mismatch: The type B<T> is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "9. ERROR in example\\Container3.java (at line 27)\n" + >+ " Container3<T1, U1, B<U1>> g, \n" + >+ " ^\n" + >+ "Bound mismatch: The type B<U1> is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "10. ERROR in example\\Container3.java (at line 29)\n" + >+ " Container3<T1, ? extends U1, B<? super T>> i, \n" + >+ " ^\n" + >+ "Bound mismatch: The type B<? super T> is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\n" + >+ "----------\n" + >+ "11. WARNING in example\\Container3.java (at line 30)\n" + >+ " Container3<T1, ? extends U1, B> j);\n" + >+ " ^\n" + >+ "B is a raw type. References to generic type B<E> should be parameterized\n" + >+ "----------\n" + >+ "12. ERROR in example\\Container3.java (at line 30)\n" + >+ " Container3<T1, ? extends U1, B> j);\n" + >+ " ^\n" + >+ "Bound mismatch: The type B is not a valid substitute for the bounded parameter <V extends A<? super T>> of the type Container3<T,U,V>\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 <E extends Enum<E>> (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 <E extends Enum<E>> (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; > }
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 169049
:
56175
| 78424