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 51157 Details for
Bug 159245
[1.5][compiler] Missing raw type usage warning for array type ref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
159245.txt (text/plain), 29.87 KB, created by
Philipe Mulet
on 2006-09-29 05:46:20 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2006-09-29 05:46:20 EDT
Size:
29.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java,v >retrieving revision 1.96 >diff -u -r1.96 MethodVerifyTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 6 Sep 2006 18:14:25 -0000 1.96 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java 29 Sep 2006 09:49:32 -0000 >@@ -1021,7 +1021,12 @@ > "class A<T> {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 2)\n" + >+ "1. WARNING in X.java (at line 1)\n" + >+ " class X { void foo(A[] a) {} }\n" + >+ " ^\n" + >+ "A is a raw type. References to generic type A<T> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 2)\n" + > " class Y extends X { void foo(A<String>[] a) {} }\n" + > " ^^^^^^^^^^^^^^^^^^\n" + > "Name clash: The method foo(A<String>[]) of type Y has the same erasure as foo(A[]) of type X but does not override it\n" + >@@ -1101,10 +1106,15 @@ > "class A<T> {}\n" > }, > "----------\n" + >- "1. ERROR in X.java (at line 1)\r\n" + >- " abstract class X extends Y implements I { }\r\n" + >+ "1. ERROR in X.java (at line 1)\n" + >+ " abstract class X extends Y implements I { }\n" + > " ^\n" + > "Name clash: The method foo(A<String>[]) of type Y has the same erasure as foo(A[]) of type I but does not override it\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 2)\n" + >+ " interface I { void foo(A[] a); }\n" + >+ " ^\n" + >+ "A is a raw type. References to generic type A<T> should be parameterized\n" + > "----------\n" > // name clash: foo(A<java.lang.String>[]) in Y and foo(A[]) in I have the same erasure, yet neither overrides the other > ); >@@ -1553,6 +1563,11 @@ > " abstract class Z implements X { public abstract X[] 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 3)\n" + >+ " abstract class Z implements X { public abstract X[] x(); }\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + > "----------\n" > ); > } >@@ -2430,13 +2445,23 @@ > "----------\n" + > "1. WARNING in X.java (at line 2)\n" + > " abstract class Y<S> implements X<S> { public abstract X[] 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 2)\n" + >+ " abstract class Y<S> implements X<S> { public abstract X[] x(); }\n" + > " ^^^\n" + > "Type safety: The return type X[] for x() from the type Y<S> needs unchecked conversion to conform to X<T>[] from the type X<T>\n" + > "----------\n" + >- "2. WARNING in X.java (at line 3)\n" + >+ "3. WARNING in X.java (at line 3)\n" + > " abstract class Z implements X { public abstract X[] 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 3)\n" + >+ " abstract class Z implements X { public abstract X[] x(); }\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + > "----------\n" > ); > } >@@ -3882,10 +3907,15 @@ > "}" > }, > "----------\n" + >- "1. ERROR in I3.java (at line 4)\r\n" + >- " public static class TestClass implements I3 {\r\n" + >+ "1. ERROR in I3.java (at line 4)\n" + >+ " public static class TestClass implements I3 {\n" + > " ^^^^^^^^^\n" + > "The type I3.TestClass must implement the inherited abstract method I3.method(Iterator<Object>[])\n" + >+ "----------\n" + >+ "2. WARNING in I3.java (at line 5)\n" + >+ " public void method(Iterator[][] iter) {}\n" + >+ " ^^^^^^^^\n" + >+ "Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" + > "----------\n" > // does not override abstract method method(java.util.Iterator<java.lang.Object>[]) in I3 > ); >@@ -5541,11 +5571,15 @@ > "}\n", // ================= > }, > "----------\n" + >- "1. ERROR in X.java (at line 9)\n" + >+ "1. WARNING in X.java (at line 7)\n" + >+ " void foo(Y[] array)\n" + >+ " ^\n" + >+ "Y is a raw type. References to generic type Y<T> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 9)\n" + > " y.addAll(Arrays.asList(array));\n" + > " ^^^^^^\n" + >- "The method addAll(Collection<? extends Y<X>>) in the type ArrayList" + >- "<Y<X>> is not applicable for the arguments (List<Y>)\n" + >+ "The method addAll(Collection<? extends Y<X>>) in the type ArrayList<Y<X>> is not applicable for the arguments (List<Y>)\n" + > "----------\n" > ); > } >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.525 >diff -u -r1.525 GenericTypeTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 28 Sep 2006 23:17:50 -0000 1.525 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 29 Sep 2006 09:49:29 -0000 >@@ -7675,17 +7675,22 @@ > "}\n" > }, > "----------\n" + >- "1. WARNING in X.java (at line 4)\n" + >+ "1. WARNING in X.java (at line 3)\n" + >+ " X[] foo() {\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 4)\n" + > " ArrayList<X> list = new ArrayList();\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 4)\n" + >+ "3. WARNING in X.java (at line 4)\n" + > " ArrayList<X> list = new ArrayList();\n" + > " ^^^^^^^^^^^^^^^\n" + > "Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<X>\n" + > "----------\n" + >- "3. WARNING in X.java (at line 4)\n" + >+ "4. WARNING in X.java (at line 4)\n" + > " ArrayList<X> list = new ArrayList();\n" + > " ^^^^^^^^^\n" + > "ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + >@@ -13570,7 +13575,12 @@ > " ^^^^\n" + > "Zork cannot be resolved to a type\n" + > "----------\n" + >- "2. WARNING in X.java (at line 6)\n" + >+ "2. WARNING in X.java (at line 5)\n" + >+ " Set[] sets = new Set[10];\n" + >+ " ^^^\n" + >+ "Set is a raw type. References to generic type Set<E> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in X.java (at line 6)\n" + > " return sets;\n" + > " ^^^^\n" + > "Type safety: The expression of type Set[] needs unchecked conversion to conform to Set<String>[]\n" + >@@ -24592,17 +24602,22 @@ > "}\n", > }, > "----------\n" + >- "1. WARNING in X.java (at line 7)\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " Constructor[] constrs = X.class.getConstructors();\n" + >+ " ^^^^^^^^^^^\n" + >+ "Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 7)\n" + > " for (Constructor constructor : constrs) {\n" + > " ^^^^^^^^^^^\n" + > "Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" + > "----------\n" + >- "2. WARNING in X.java (at line 8)\n" + >+ "3. WARNING in X.java (at line 8)\n" + > " final String message = constructor.getAnnotation(AnnClass).message();\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Type safety: The method getAnnotation(Class) belongs to the raw type Constructor. References to generic type Constructor<T> should be parameterized\n" + > "----------\n" + >- "3. ERROR in X.java (at line 8)\n" + >+ "4. ERROR in X.java (at line 8)\n" + > " final String message = constructor.getAnnotation(AnnClass).message();\n" + > " ^^^^^^^\n" + > "The method message() is undefined for the type Annotation\n" + >@@ -25223,12 +25238,17 @@ > " ^^^^^^^^^^^^^^^^^\n" + > "Cannot perform instanceof check against parameterized type List<? extends String>. Use instead its raw form List since generic type information will be erased at runtime\n" + > "----------\n" + >- "7. WARNING in X.java (at line 19)\n" + >+ "7. WARNING in X.java (at line 18)\n" + >+ " void foo(List[] ls) {\n" + >+ " ^^^^\n" + >+ "List is a raw type. References to generic type List<E> should be parameterized\n" + >+ "----------\n" + >+ "8. WARNING in X.java (at line 19)\n" + > " if (ls instanceof List<?>[]) {}\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^\n" + > "The expression of type List[] is already an instance of type List<?>\n" + > "----------\n" + >- "8. ERROR in X.java (at line 20)\n" + >+ "9. ERROR in X.java (at line 20)\n" + > " if (ls instanceof List<? extends String>[]) {}\n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Cannot perform instanceof check against parameterized type List<? extends String>[]. Use instead its raw form List[] since generic type information will be erased at runtime\n" + >@@ -28500,12 +28520,17 @@ > "}\n", > }, > "----------\n" + >- "1. ERROR in X.java (at line 5)\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " void foo(List<? extends Collection<String>[]> l1, List<Collection[]> l2) {\n" + >+ " ^^^^^^^^^^\n" + >+ "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + > " l1 = l2;\n" + > " ^^\n" + > "Type mismatch: cannot convert from List<Collection[]> to List<? extends Collection<String>[]>\n" + > "----------\n" + >- "2. ERROR in X.java (at line 6)\n" + >+ "3. ERROR in X.java (at line 6)\n" + > " l2 = l1;\n" + > " ^^\n" + > "Type mismatch: cannot convert from List<capture#2-of ? extends Collection<String>[]> to List<Collection[]>\n" + >@@ -28539,42 +28564,52 @@ > "}\n", > }, > "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " List<Collection[]> lc1 = null;\n" + >+ " ^^^^^^^^^^\n" + >+ "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 7)\n" + >+ " List<? extends Collection[]> lc4 = null;\n" + >+ " ^^^^^^^^^^\n" + >+ "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 8)\n" + > " lc1 = lc2; //1 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<Collection<?>[]> to List<Collection[]>\n" + > "----------\n" + >- "2. ERROR in X.java (at line 9)\n" + >+ "4. ERROR in X.java (at line 9)\n" + > " lc1 = lc3; //2 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#1-of ? extends Collection<?>[]> to List<Collection[]>\n" + > "----------\n" + >- "3. ERROR in X.java (at line 10)\n" + >+ "5. ERROR in X.java (at line 10)\n" + > " lc1 = lc4; //3 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#2-of ? extends Collection[]> to List<Collection[]>\n" + > "----------\n" + >- "4. ERROR in X.java (at line 11)\n" + >+ "6. ERROR in X.java (at line 11)\n" + > " lc2 = lc1; //4 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<Collection[]> to List<Collection<?>[]>\n" + > "----------\n" + >- "5. ERROR in X.java (at line 12)\n" + >+ "7. ERROR in X.java (at line 12)\n" + > " lc2 = lc3; //5 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#3-of ? extends Collection<?>[]> to List<Collection<?>[]>\n" + > "----------\n" + >- "6. ERROR in X.java (at line 13)\n" + >+ "8. ERROR in X.java (at line 13)\n" + > " lc2 = lc4; //6 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#4-of ? extends Collection[]> to List<Collection<?>[]>\n" + > "----------\n" + >- "7. ERROR in X.java (at line 14)\n" + >+ "9. ERROR in X.java (at line 14)\n" + > " lc3 = lc1; //7 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<Collection[]> to List<? extends Collection<?>[]>\n" + > "----------\n" + >- "8. ERROR in X.java (at line 16)\n" + >+ "10. ERROR in X.java (at line 16)\n" + > " lc3 = lc4; //9 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#8-of ? extends Collection[]> to List<? extends Collection<?>[]>\n" + >@@ -28608,42 +28643,52 @@ > "}\n", > }, > "----------\n" + >- "1. ERROR in X.java (at line 8)\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " List<Collection[]> lc1 = null;\n" + >+ " ^^^^^^^^^^\n" + >+ "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 7)\n" + >+ " List<? super Collection[]> lc4 = null;\n" + >+ " ^^^^^^^^^^\n" + >+ "Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 8)\n" + > " lc1 = lc2; //1 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<Collection<?>[]> to List<Collection[]>\n" + > "----------\n" + >- "2. ERROR in X.java (at line 9)\n" + >+ "4. ERROR in X.java (at line 9)\n" + > " lc1 = lc3; //2 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#1-of ? super Collection<?>[]> to List<Collection[]>\n" + > "----------\n" + >- "3. ERROR in X.java (at line 10)\n" + >+ "5. ERROR in X.java (at line 10)\n" + > " lc1 = lc4; //3 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#2-of ? super Collection[]> to List<Collection[]>\n" + > "----------\n" + >- "4. ERROR in X.java (at line 11)\n" + >+ "6. ERROR in X.java (at line 11)\n" + > " lc2 = lc1; //4 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<Collection[]> to List<Collection<?>[]>\n" + > "----------\n" + >- "5. ERROR in X.java (at line 12)\n" + >+ "7. ERROR in X.java (at line 12)\n" + > " lc2 = lc3; //5 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#3-of ? super Collection<?>[]> to List<Collection<?>[]>\n" + > "----------\n" + >- "6. ERROR in X.java (at line 13)\n" + >+ "8. ERROR in X.java (at line 13)\n" + > " lc2 = lc4; //6 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#4-of ? super Collection[]> to List<Collection<?>[]>\n" + > "----------\n" + >- "7. ERROR in X.java (at line 18)\n" + >+ "9. ERROR in X.java (at line 18)\n" + > " lc4 = lc2; //11 ko\n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<Collection<?>[]> to List<? super Collection[]>\n" + > "----------\n" + >- "8. ERROR in X.java (at line 19)\n" + >+ "10. ERROR in X.java (at line 19)\n" + > " lc4 = lc3; //12 ko \n" + > " ^^^\n" + > "Type mismatch: cannot convert from List<capture#12-of ? super Collection<?>[]> to List<? super Collection[]>\n" + >@@ -32785,6 +32830,11 @@ > " x.bar2(\"\");\n" + > " ^^^^\n" + > "The method bar2(Class...) in the type X is not applicable for the arguments (String)\n" + >+ "----------\n" + >+ "5. WARNING in X.java (at line 9)\n" + >+ " void bar2(Class... classes) {}\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + > "----------\n"); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=158519 >@@ -33370,4 +33420,52 @@ > assertTrue(false); > } > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159245 >+public void test1041() { >+ this.runNegativeTest( >+ new String[] { >+ "p/X.java", >+ "package p;\n" + >+ "\n" + >+ "public class X<T> {\n" + >+ " {\n" + >+ " X rawx = null;\n" + >+ " X[] rawxs = { rawx };\n" + >+ " System.out.println(rawxs.length);\n" + >+ " }\n" + >+ " {\n" + >+ " p.X rawx = null;\n" + >+ " p.X[] rawxs = { rawx };\n" + >+ " System.out.println(rawxs.length);\n" + >+ " }\n" + >+ " Zork z;\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. WARNING in p\\X.java (at line 5)\n" + >+ " X rawx = null;\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in p\\X.java (at line 6)\n" + >+ " X[] rawxs = { rawx };\n" + >+ " ^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "3. WARNING in p\\X.java (at line 10)\n" + >+ " p.X rawx = null;\n" + >+ " ^^^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "4. WARNING in p\\X.java (at line 11)\n" + >+ " p.X[] rawxs = { rawx };\n" + >+ " ^^^^^\n" + >+ "X is a raw type. References to generic type X<T> should be parameterized\n" + >+ "----------\n" + >+ "5. ERROR in p\\X.java (at line 14)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n"); >+} > } >\ No newline at end of file >Index: src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java,v >retrieving revision 1.47 >diff -u -r1.47 VarargsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 8 Jun 2006 13:07:59 -0000 1.47 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java 29 Sep 2006 09:49:33 -0000 >@@ -1712,12 +1712,17 @@ > "}\n", > }, > "----------\n" + >- "1. WARNING in X.java (at line 9)\n" + >+ "1. WARNING in X.java (at line 5)\n" + >+ " void bar(Y... y) {\n" + >+ " ^\n" + >+ "Y is a raw type. References to generic type Y<E> should be parameterized\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 9)\n" + > " bar((Y[])foo());\n" + > " ^^^^^^^^^^\n" + > "Unnecessary cast from Y<String>[] to Y[]\n" + > "----------\n" + >- "2. ERROR in X.java (at line 10)\n" + >+ "3. ERROR in X.java (at line 10)\n" + > " Zork z;\n" + > " ^^^^\n" + > "Zork cannot be resolved to a type\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java,v >retrieving revision 1.154 >diff -u -r1.154 AnnotationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 13 Sep 2006 02:25:29 -0000 1.154 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 29 Sep 2006 09:49:14 -0000 >@@ -3495,7 +3495,7 @@ > " }\n" + > "}\n", > }, >- "----------\n" + >+ "----------\n" + > "1. WARNING in X.java (at line 8)\n" + > " interface Iface extends Ann {\n" + > " ^^^\n" + >@@ -3535,6 +3535,11 @@ > " Class c = SubKlass.class;\n" + > " ^^^^^\n" + > "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "9. WARNING in X.java (at line 41)\n" + >+ " Class[] i = c.getInterfaces();\n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + > "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86291 >Index: src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java,v >retrieving revision 1.60 >diff -u -r1.60 Compliance_1_5.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java 23 Aug 2006 16:33:07 -0000 1.60 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java 29 Sep 2006 09:49:15 -0000 >@@ -2868,10 +2868,25 @@ > " ^^^^^\n" + > "Class is a raw type. References to generic type Class<T> should be parameterized\n" + > "----------\n" + >- "5. WARNING in p\\X.java (at line 39)\n" + >+ "5. WARNING in p\\X.java (at line 32)\n" + >+ " Class _getClasses [] = X.class.getClasses(); \n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "6. WARNING in p\\X.java (at line 36)\n" + >+ " Constructor _getConstructors[] = c.getConstructors(); \n" + >+ " ^^^^^^^^^^^\n" + >+ "Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" + >+ "----------\n" + >+ "7. WARNING in p\\X.java (at line 39)\n" + > " Method _getMethod = c.getMethod(\"d\",null);\n" + > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation\n" + >+ "----------\n" + >+ "8. WARNING in p\\X.java (at line 39)\n" + >+ " Method _getMethod = c.getMethod(\"d\",null);\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Type safety: The method getMethod(String, Class...) belongs to the raw type Class. References to generic type Class<T> should be parameterized\n" + > "----------\n"; > if (System.getProperty("java.version").startsWith("1.6")) { > errorMessage = >@@ -2896,12 +2911,22 @@ > " ^^^^^\n" + > "Class is a raw type. References to generic type Class<T> should be parameterized\n" + > "----------\n" + >- "5. WARNING in p\\X.java (at line 39)\n" + >+ "5. WARNING in p\\X.java (at line 32)\n" + >+ " Class _getClasses [] = X.class.getClasses(); \n" + >+ " ^^^^^\n" + >+ "Class is a raw type. References to generic type Class<T> should be parameterized\n" + >+ "----------\n" + >+ "6. WARNING in p\\X.java (at line 36)\n" + >+ " Constructor _getConstructors[] = c.getConstructors(); \n" + >+ " ^^^^^^^^^^^\n" + >+ "Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" + >+ "----------\n" + >+ "7. WARNING in p\\X.java (at line 39)\n" + > " Method _getMethod = c.getMethod(\"d\",null);\n" + > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation\n" + > "----------\n" + >- "6. WARNING in p\\X.java (at line 39)\n" + >+ "8. WARNING in p\\X.java (at line 39)\n" + > " Method _getMethod = c.getMethod(\"d\",null);\n" + > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "Type safety: The method getMethod(String, Class...) belongs to the raw type Class. References to generic type Class<T> should be parameterized\n" + >Index: src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java,v >retrieving revision 1.24 >diff -u -r1.24 DeprecatedTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java 29 Jun 2006 09:40:25 -0000 1.24 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java 29 Sep 2006 09:49:15 -0000 >@@ -485,7 +485,62 @@ > customOptions); > } > } >- >+public void test014() { >+ this.runNegativeTest( >+ new String[] { >+ "p/X.java", >+ "package p;\n" + >+ "/**\n" + >+ " * @deprecated\n" + >+ " */\n" + >+ "public class X {\n" + >+ "}\n", >+ "Y.java", >+ "import p.X;\n" + >+ "public class Y {\n" + >+ " Zork z;\n" + >+ " void foo() {\n" + >+ " X x;\n" + >+ " X[] xs = { x };\n" + >+ " }\n" + >+ " void bar() {\n" + >+ " p.X x;\n" + >+ " p.X[] xs = { x };\n" + >+ " }\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. WARNING in Y.java (at line 1)\n" + >+ " import p.X;\n" + >+ " ^^^\n" + >+ "The type X is deprecated\n" + >+ "----------\n" + >+ "2. ERROR in Y.java (at line 3)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n" + >+ "3. WARNING in Y.java (at line 5)\n" + >+ " X x;\n" + >+ " ^\n" + >+ "The type X is deprecated\n" + >+ "----------\n" + >+ "4. WARNING in Y.java (at line 6)\n" + >+ " X[] xs = { x };\n" + >+ " ^\n" + >+ "The type X is deprecated\n" + >+ "----------\n" + >+ "5. WARNING in Y.java (at line 9)\n" + >+ " p.X x;\n" + >+ " ^^^\n" + >+ "The type X is deprecated\n" + >+ "----------\n" + >+ "6. WARNING in Y.java (at line 10)\n" + >+ " p.X[] xs = { x };\n" + >+ " ^^^^^\n" + >+ "The type X is deprecated\n" + >+ "----------\n"); >+} > public static Class testClass() { > return DeprecatedTest.class; > } >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.321 >diff -u -r1.321 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 28 Sep 2006 23:17:26 -0000 1.321 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 29 Sep 2006 09:49:37 -0000 >@@ -1179,13 +1179,18 @@ > if (location == null) return; // 1G828DN - no type ref for synthetic arguments > int severity = computeSeverity(IProblem.UsingDeprecatedType); > if (severity == ProblemSeverities.Ignore) return; >+ type = type.leafComponentType(); >+ int end = location.sourceEnd; >+ if (location instanceof ArrayTypeReference) { >+ end = ((ArrayTypeReference) location).originalSourceEnd; >+ } > this.handle( > IProblem.UsingDeprecatedType, > new String[] {new String(type.readableName())}, > new String[] {new String(type.shortReadableName())}, > severity, > location.sourceStart, >- location.sourceEnd); >+ end); > } > public void disallowedTargetForAnnotation(Annotation annotation) { > this.handle( >@@ -5276,12 +5281,17 @@ > location.sourceEnd); > } > public void rawTypeReference(ASTNode location, TypeBinding type) { >+ type = type.leafComponentType(); >+ int end = location.sourceEnd; >+ if (location instanceof ArrayTypeReference) { >+ end = ((ArrayTypeReference) location).originalSourceEnd; >+ } > this.handle( > IProblem.RawTypeReference, > new String[] {new String(type.readableName()), new String(type.erasure().readableName()), }, > new String[] {new String(type.shortReadableName()),new String(type.erasure().shortReadableName()),}, > location.sourceStart, >- location.sourceEnd); >+ end); > } > public void recursiveConstructorInvocation(ExplicitConstructorCall constructorCall) { > >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java,v >retrieving revision 1.32 >diff -u -r1.32 TypeReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java 28 Mar 2006 20:29:56 -0000 1.32 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java 29 Sep 2006 09:49:34 -0000 >@@ -134,10 +134,11 @@ > reportInvalidType(scope); > return null; > } >- if (isTypeUseDeprecated(this.resolvedType, scope)) >+ if (isTypeUseDeprecated(type, scope)) > reportDeprecatedType(scope); >+ > type = scope.environment().convertToRawType(type); >- if (type.isRawType() >+ if (type.leafComponentType().isRawType() > && (this.bits & IgnoreRawTypeCheck) == 0 > && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) { > scope.problemReporter().rawTypeReference(this, type); >@@ -157,10 +158,11 @@ > reportInvalidType(scope); > return null; > } >- if (isTypeUseDeprecated(this.resolvedType, scope)) >+ if (isTypeUseDeprecated(type, scope)) > reportDeprecatedType(scope); >+ > type = scope.environment().convertToRawType(type); >- if (type.isRawType() >+ if (type.leafComponentType().isRawType() > && (this.bits & IgnoreRawTypeCheck) == 0 > && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) { > scope.problemReporter().rawTypeReference(this, type);
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 159245
: 51157