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 130282 Details for
Bug 159851
[1.5] [compiler] Eclipse compiler fails to report type parameter bounds errors when generic instance is a type argument
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch and testcase
patch.txt (text/plain), 3.67 KB, created by
Kent Johnson
on 2009-03-30 14:14:45 EDT
(
hide
)
Description:
Proposed patch and testcase
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2009-03-30 14:14:45 EDT
Size:
3.67 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java,v >retrieving revision 1.112 >diff -u -r1.112 ParameterizedTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 8 Jan 2009 20:51:05 -0000 1.112 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java 30 Mar 2009 18:09:31 -0000 >@@ -80,7 +80,17 @@ > } > } > } >- if (!hasErrors) this.tagBits |= TagBits.PassedBoundCheck; // no need to recheck it in the future >+ if (!hasErrors) { >+ this.tagBits |= TagBits.PassedBoundCheck; // no need to recheck it in the future >+ if (this.arguments != null) { >+ for (int i = 0, length = this.arguments.length; i < length; i++) { >+ if (this.arguments[i].leafComponentType() instanceof ParameterizedTypeBinding) { >+ ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) this.arguments[i].leafComponentType(); >+ parameterizedType.boundCheck(scope, argumentReferences); >+ } >+ } >+ } >+ } > } > } > /** >#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 30 Mar 2009 18:09:37 -0000 >@@ -49455,4 +49455,41 @@ > "" > ); > } >+//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<T extends A> {}\n" + >+ "class X<T extends ArrayList<B<Integer>>> extends TreeMap<Integer, B<String>> {}\n" + >+ "\n" + >+ "class D<T> {}\n" + >+ "class E<T extends Number> {}\n" + >+ "class Y<T> extends E<D<T>> {}", >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " class X<T extends ArrayList<B<Integer>>> extends TreeMap<Integer, B<String>> {}\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<T extends ArrayList<B<Integer>>> extends TreeMap<Integer, B<String>> {}\n" + >+ " ^\n" + >+ "Bound mismatch: The type Integer is not a valid substitute for the bounded parameter <T extends A> of the type B<T>\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 4)\n" + >+ " class X<T extends ArrayList<B<Integer>>> extends TreeMap<Integer, B<String>> {}\n" + >+ " ^^^^^^^\n" + >+ "Bound mismatch: The type String is not a valid substitute for the bounded parameter <T extends A> of the type B<T>\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 8)\n" + >+ " class Y<T> extends E<D<T>> {}\n" + >+ " ^\n" + >+ "Bound mismatch: The type D<T> is not a valid substitute for the bounded parameter <T extends Number> of the type E<T>\n" + >+ "----------\n" >+ ); >+} > } >\ No newline at end of file
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 159851
:
130282
|
130461