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 204248 Details for
Bug 355838
[compiler] ecj compiles the code that javac6 rejects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
fix + tests
HEAD--Fixed-bug-355838-compiler-ecj-compiles-the-cod.patch (text/plain), 6.71 KB, created by
Ayushman Jain
on 2011-09-29 02:28:26 EDT
(
hide
)
Description:
fix + tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-09-29 02:28:26 EDT
Size:
6.71 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >index 6eb1299..0deb894 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >@@ -11239,24 +11239,7 @@ > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 > public void test200() { > Map options = getCompilerOptions(); >- String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE); >- String errorMessage = compliance == JavaCore.VERSION_1_6 ? >- "----------\n" + >- "1. WARNING in X.java (at line 3)\n" + >- " int foo(Collection bar) { return 0; }\n" + >- " ^^^^^^^^^^^^^^^^^^^\n" + >- "Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + >- "----------\n" + >- "2. WARNING in X.java (at line 3)\n" + >- " int foo(Collection bar) { return 0; }\n" + >- " ^^^^^^^^^^\n" + >- "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >- "----------\n" + >- "3. WARNING in X.java (at line 4)\n" + >- " double foo(Collection<String> bar) {return 0; }\n" + >- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >- "Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + >- "----------\n" : >+ String errorMessage = > "----------\n" + > "1. ERROR in X.java (at line 3)\n" + > " int foo(Collection bar) { return 0; }\n" + >@@ -13512,4 +13495,50 @@ > "Name clash: The method foo(A<Integer>) of type Sub has the same erasure as foo(A<Number>) of type Super but does not hide it\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=355838 >+public void testBug355838() throws Exception { >+ String output = >+ "----------\n" + >+ "1. ERROR in ErasureBug.java (at line 4)\n" + >+ " public String output(List<String> integers) {\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Method output(List<String>) has the same erasure output(List<E>) as another method in type ErasureBug\n" + >+ "----------\n" + >+ "2. ERROR in ErasureBug.java (at line 7)\n" + >+ " public String output(List doubles) {\n" + >+ " ^^^^^^^^^^^^^^^^^^^^\n" + >+ "Method output(List) has the same erasure output(List<E>) as another method in type ErasureBug\n" + >+ "----------\n" + >+ "3. WARNING in ErasureBug.java (at line 7)\n" + >+ " public String output(List doubles) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "4. WARNING in ErasureBug.java (at line 10)\n" + >+ " public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + >+ " ^^^^^^^^^^^^^^^\n" + >+ "Type safety: The expression of type ArrayList needs unchecked conversion to conform to List<String>\n" + >+ "----------\n" + >+ "5. WARNING in ErasureBug.java (at line 10)\n" + >+ " public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + >+ " ^^^^^^^^^\n" + >+ "ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + >+ "----------\n"; >+ this.runNegativeTest( >+ new String[] { >+ "ErasureBug.java", >+ "import java.util.ArrayList;\n" + >+ "import java.util.List;\n" + >+ "public class ErasureBug {\n" + >+ " public String output(List<String> integers) {\n" + >+ " return \"1\";\n" + >+ " }\n" + >+ " public String output(List doubles) {\n" + >+ " return \"2\";\n" + >+ " }\n" + >+ " public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + >+ "}\n" >+ }, >+ output); >+} > } >diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html >index 90eaf1e..4a0fe46 100644 >--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html >+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html >@@ -52,7 +52,9 @@ > <h2>What's new in this drop</h2> > > <h3>Problem Reports Fixed</h3> >-<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=349326">349326</a> >+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=355838">355838</a> >+[compiler] ecj compiles the code that javac6 rejects >+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=349326">349326</a> > [1.7] new warning for missing try-with-resources > <br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=354502">354502</a> > Incorrect Compiler Warning: "Method can be declared as static" >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >index b346908..d1f9cf4 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >@@ -1240,8 +1240,16 @@ > int index = pLength; > // is erasure of signature of m2 same as signature of m1? > for (; --index >= 0;) { >- if (params1[index] != params2[index].erasure()) >- break; >+ if (params1[index] != params2[index].erasure()) { >+ // If one of them is a raw type >+ if (params1[index] instanceof RawTypeBinding) { >+ if (params2[index].erasure() != ((RawTypeBinding)params1[index]).actualType()) { >+ break; >+ } >+ } else { >+ break; >+ } >+ } > if (params1[index] == params2[index]) { > TypeBinding type = params1[index].leafComponentType(); > if (type instanceof SourceTypeBinding && type.typeVariables() != Binding.NO_TYPE_VARIABLES) { >@@ -1253,8 +1261,16 @@ > if (index >= 0 && index < pLength) { > // is erasure of signature of m1 same as signature of m2? > for (index = pLength; --index >= 0;) >- if (params1[index].erasure() != params2[index]) >- break; >+ if (params1[index].erasure() != params2[index]) { >+ // If one of them is a raw type >+ if (params2[index] instanceof RawTypeBinding) { >+ if (params1[index].erasure() != ((RawTypeBinding)params2[index]).actualType()) { >+ break; >+ } >+ } else { >+ break; >+ } >+ } > > } > if (index >= 0) {
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 355838
:
202217
| 204248