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 117313 Details for
Bug 236242
[compiler][1.7] compiler difference to javac 7 involving parameterized uses of raw methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
236242.txt (text/plain), 7.09 KB, created by
Philipe Mulet
on 2008-11-07 09:01:57 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2008-11-07 09:01:57 EST
Size:
7.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.343 >diff -u -r1.343 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 31 Oct 2008 15:45:04 -0000 1.343 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 7 Nov 2008 14:01:15 -0000 >@@ -422,7 +422,9 @@ > if (method instanceof ParameterizedGenericMethodBinding) { > if (!((ParameterizedGenericMethodBinding) method).wasInferred) { > // attempt to invoke generic method of raw type with type hints <String>foo() >- return new ProblemMethodBinding(method, method.selector, genericTypeArguments, ProblemReasons.TypeArgumentsForRawGenericMethod); >+ if (compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { >+ return new ProblemMethodBinding(method, method.selector, genericTypeArguments, ProblemReasons.TypeArgumentsForRawGenericMethod); >+ } > } > } else { > if (compilerOptions().complianceLevel < ClassFileConstants.JDK1_7) { >#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.763 >diff -u -r1.763 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 7 Nov 2008 10:40:19 -0000 1.763 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 7 Nov 2008 14:01:23 -0000 >@@ -7369,37 +7369,104 @@ > } > // generic method of raw type > public void test0245() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_7) { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X <T> { \n" + >+ " <G> T foo(G g) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " T bar(T t) {\n" + >+ " return zork;\n" + >+ " }\n" + >+ "\n" + >+ " public static void main(String[] args) {\n" + >+ " X rx = new X();\n" + >+ " rx.<String>foo(\"hello\"); // Eclipse error here\n" + >+ " rx.<String>bar(\"hello\"); // Eclipse error here\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " return zork;\n" + >+ " ^^^^\n" + >+ "zork cannot be resolved\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 10)\n" + >+ " X rx = new X();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 10)\n" + >+ " X rx = new X();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 11)\n" + >+ " rx.<String>foo(\"hello\"); // Eclipse error here\n" + >+ " ^^^\n" + >+ "The method foo(Object) of raw type X is no longer generic; it cannot be parameterized with arguments <String>\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 12)\n" + >+ " rx.<String>bar(\"hello\"); // Eclipse error here\n" + >+ " ^^^\n" + >+ "The method bar(Object) of type X is not generic; it cannot be parameterized with arguments <String>\n" + >+ "----------\n", >+ JavacTestOptions.EclipseHasABug.EclipseBug236242); >+ return; >+ } > this.runNegativeTest( >- new String[] { >- "X.java", >- "public class X <T> { \n" + >- " <G> T foo(G g) {\n" + >- " return null;\n" + >- " }\n" + >- " \n" + >- " public static void main(String[] args) {\n" + >- " X rx = new X();\n" + >- " rx.<String>foo(\"hello\");\n" + >- " }\n" + >- "}\n" >- }, >- "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >- " X rx = new X();\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<T> should be parameterized\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 7)\n" + >- " X rx = new X();\n" + >- " ^\n" + >- "X is a raw type. References to generic type X<T> should be parameterized\n" + >- "----------\n" + >- "3. ERROR in X.java (at line 8)\n" + >- " rx.<String>foo(\"hello\");\n" + >- " ^^^\n" + >- "The method foo(Object) of raw type X is no longer generic; it cannot be parameterized with arguments <String>\n" + >- "----------\n", >- JavacTestOptions.EclipseHasABug.EclipseBug236242); >+ new String[] { >+ "X.java", >+ "public class X <T> { \n" + >+ " <G> T foo(G g) {\n" + >+ " return null;\n" + >+ " }\n" + >+ " T bar(T t) {\n" + >+ " return zork;\n" + >+ " }\n" + >+ "\n" + >+ " public static void main(String[] args) {\n" + >+ " X rx = new X();\n" + >+ " rx.<String>foo(\"hello\"); // Eclipse error here\n" + >+ " rx.<String>bar(\"hello\"); // Eclipse error here\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " return zork;\n" + >+ " ^^^^\n" + >+ "zork cannot be resolved\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 10)\n" + >+ " X rx = new X();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 10)\n" + >+ " X rx = new X();\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "4. WARNING in X.java (at line 11)\n" + >+ " rx.<String>foo(\"hello\"); // Eclipse error here\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The method foo(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 12)\n" + >+ " rx.<String>bar(\"hello\"); // Eclipse error here\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The method bar(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "6. WARNING in X.java (at line 12)\n" + >+ " rx.<String>bar(\"hello\"); // Eclipse error here\n" + >+ " ^^^^^^\n" + >+ "Unused type arguments for the non generic method bar(Object) of type X; it should not be parameterized with arguments <String>\n" + >+ "----------\n", >+ JavacTestOptions.EclipseHasABug.EclipseBug236242); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=69320 parameterized type compatibility > public void test0246() {
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 236242
:
117313
|
117331