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 40029 Details for
Bug 139525
[1.5][compiler] Valid generics involved assignment is flagged as an error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
139525.txt (text/plain), 5.22 KB, created by
Philipe Mulet
on 2006-05-02 09:14:53 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2006-05-02 09:14:53 EDT
Size:
5.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java,v >retrieving revision 1.70 >diff -u -r1.70 LookupEnvironment.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 20 Apr 2006 07:29:03 -0000 1.70 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 2 May 2006 11:32:26 -0000 >@@ -408,6 +408,8 @@ > originalType = type.leafComponentType(); > break; > default: >+ if (type.id == TypeIds.T_JavaLangObject) >+ return type; // Object is not generic > dimension = 0; > originalType = type; > } >@@ -440,11 +442,10 @@ > } else { > convertedEnclosing = convertToParameterizedType(originalEnclosing); > } >- ReferenceBinding originalGeneric = (ReferenceBinding) originalType.erasure(); > if (needToConvert) { >- convertedType = createRawType(originalGeneric, convertedEnclosing); >+ convertedType = createRawType((ReferenceBinding) originalType.erasure(), convertedEnclosing); > } else if (originalEnclosing != convertedEnclosing) { >- convertedType = createParameterizedType(originalGeneric, null, convertedEnclosing); >+ convertedType = createParameterizedType((ReferenceBinding) originalType.erasure(), null, convertedEnclosing); > } else { > convertedType = originalType; > } >@@ -470,6 +471,8 @@ > originalType = type.leafComponentType(); > break; > default: >+ if (type.id == TypeIds.T_JavaLangObject) >+ return type; // Object is not generic > dimension = 0; > originalType = type; > } >@@ -494,12 +497,16 @@ > convertedType = needToConvert ? createRawType((ReferenceBinding)originalType.erasure(), null) : originalType; > } else { > ReferenceBinding convertedEnclosing = (ReferenceBinding) convertUnresolvedBinaryToRawType(originalEnclosing); >- ReferenceBinding originalGeneric = (ReferenceBinding) originalType.erasure(); >- if (needToConvert || originalEnclosing != convertedEnclosing) { >- convertedType = createRawType(originalGeneric, convertedEnclosing); >+ if (convertedEnclosing != originalEnclosing) { >+ needToConvert |= !((ReferenceBinding)originalType).isStatic(); >+ } >+ if (needToConvert) { >+ convertedType = createRawType((ReferenceBinding) originalType.erasure(), convertedEnclosing); >+ } else if (originalEnclosing != convertedEnclosing) { >+ convertedType = createParameterizedType((ReferenceBinding) originalType.erasure(), null, convertedEnclosing); > } else { > convertedType = originalType; >- } >+ } > } > if (originalType != convertedType) { > return dimension > 0 ? (TypeBinding)createArrayType(convertedType, dimension) : convertedType; >#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.481 >diff -u -r1.481 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 26 Apr 2006 22:49:22 -0000 1.481 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 2 May 2006 11:32:43 -0000 >@@ -30705,4 +30705,51 @@ > "Bean cannot be resolved to a type\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139525 >+public void test0976() { >+ this.runConformTest( >+ new String[] { >+ "S.java", // ================= >+ "import java.util.Collection;\n" + >+ "public class S {\n" + >+ " public static void cow(IDA<?, ?, ?, ?, ?, ?> s) {\n" + >+ " Collection<IDA.Enum1> ids = s.getIds(); // Error here\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ "}\n", // ================= >+ "ID.java", // ================= >+ "import java.util.Collection;\n" + >+ "public interface ID {\n" + >+ " Collection<? extends Comparable<?>> getIds();\n" + >+ "}\n", // ================= >+ "IDA.java", // ================= >+ "import java.util.Collection;\n" + >+ "public interface IDA<T1, C1, E1, E2, C2, T2> extends ID {\n" + >+ " enum Enum1 {\n" + >+ " ONE, TWO\n" + >+ " }\n" + >+ " Collection<IDA.Enum1> getIds();\n" + >+ "}\n", // ================= >+ }, >+ "SUCCESS"); >+ this.runConformTest( >+ new String[] { >+ "S.java", // ================= >+ "import java.util.Collection;\n" + >+ "public class S {\n" + >+ " public static void cow(IDA<?, ?, ?, ?, ?, ?> s) {\n" + >+ " Collection<IDA.Enum1> ids = s.getIds(); // Error here\n" + >+ " }\n" + >+ " public static void main(String[] args) {\n" + >+ " System.out.println(\"SUCCESS2\");\n" + >+ " }\n" + >+ "}\n", // ================= >+ }, >+ "SUCCESS2", >+ null, >+ false, >+ null); >+} > }
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 139525
:
40025
| 40029