Lines 5308-5324
Link Here
|
5308 |
"1. ERROR in X.java (at line 4)\n" + |
5308 |
"1. ERROR in X.java (at line 4)\n" + |
5309 |
" if (t instanceof X<T>) {\n" + |
5309 |
" if (t instanceof X<T>) {\n" + |
5310 |
" ^^^^^^^^^^^^^^\n" + |
5310 |
" ^^^^^^^^^^^^^^\n" + |
5311 |
"Cannot perform instanceof check against parameterized type X<T>. Use instead its raw form X since generic type information will be erased at runtime\n" + |
5311 |
"Cannot perform instanceof check against parameterized type X<T>. Use the form X<?> instead since further generic type information will be erased at runtime\n" + |
5312 |
"----------\n" + |
5312 |
"----------\n" + |
5313 |
"2. ERROR in X.java (at line 6)\n" + |
5313 |
"2. ERROR in X.java (at line 6)\n" + |
5314 |
" } else if (t instanceof X<String>) {\n" + |
5314 |
" } else if (t instanceof X<String>) {\n" + |
5315 |
" ^^^^^^^^^^^^^^\n" + |
5315 |
" ^^^^^^^^^^^^^^\n" + |
5316 |
"Cannot perform instanceof check against parameterized type X<String>. Use instead its raw form X since generic type information will be erased at runtime\n" + |
5316 |
"Cannot perform instanceof check against parameterized type X<String>. Use the form X<?> instead since further generic type information will be erased at runtime\n" + |
5317 |
"----------\n" + |
5317 |
"----------\n" + |
5318 |
"3. ERROR in X.java (at line 10)\n" + |
5318 |
"3. ERROR in X.java (at line 10)\n" + |
5319 |
" } else if (t instanceof T) {\n" + |
5319 |
" } else if (t instanceof T) {\n" + |
5320 |
" ^^^^^^^^^^^^^^\n" + |
5320 |
" ^^^^^^^^^^^^^^\n" + |
5321 |
"Cannot perform instanceof check against type parameter T. Use instead its erasure Object since generic type information will be erased at runtime\n" + |
5321 |
"Cannot perform instanceof check against type parameter T. Use instead its erasure Object instead since further generic type information will be erased at runtime\n" + |
5322 |
"----------\n" + |
5322 |
"----------\n" + |
5323 |
"4. WARNING in X.java (at line 12)\n" + |
5323 |
"4. WARNING in X.java (at line 12)\n" + |
5324 |
" } else if (t instanceof X) {\n" + |
5324 |
" } else if (t instanceof X) {\n" + |
Lines 25733-25768
Link Here
|
25733 |
" }\n" + |
25733 |
" }\n" + |
25734 |
"}\n", |
25734 |
"}\n", |
25735 |
}, |
25735 |
}, |
25736 |
"----------\n" + |
25736 |
"----------\n" + |
25737 |
"1. ERROR in X.java (at line 4)\n" + |
25737 |
"1. ERROR in X.java (at line 4)\n" + |
25738 |
" if (o instanceof E[]) { //incorrect: cannot test non-reifiable type\n" + |
25738 |
" if (o instanceof E[]) { //incorrect: cannot test non-reifiable type\n" + |
25739 |
" ^^^^^^^^^^^^^^^^\n" + |
25739 |
" ^^^^^^^^^^^^^^^^\n" + |
25740 |
"Cannot perform instanceof check against parameterized type E[]. Use instead its raw form Object[] since generic type information will be erased at runtime\n" + |
25740 |
"Cannot perform instanceof check against type parameter E[]. Use instead its erasure Object[] instead since further generic type information will be erased at runtime\n" + |
25741 |
"----------\n" + |
25741 |
"----------\n" + |
25742 |
"2. WARNING in X.java (at line 5)\n" + |
25742 |
"2. WARNING in X.java (at line 5)\n" + |
25743 |
" E[] es = (E[]) o;\n" + |
25743 |
" E[] es = (E[]) o;\n" + |
25744 |
" ^^^^^^^\n" + |
25744 |
" ^^^^^^^\n" + |
25745 |
"Type safety: Unchecked cast from Object to E[]\n" + |
25745 |
"Type safety: Unchecked cast from Object to E[]\n" + |
25746 |
"----------\n" + |
25746 |
"----------\n" + |
25747 |
"3. ERROR in X.java (at line 7)\n" + |
25747 |
"3. ERROR in X.java (at line 7)\n" + |
25748 |
" if (o instanceof List<E>[]) { //incorrect too\n" + |
25748 |
" if (o instanceof List<E>[]) { //incorrect too\n" + |
25749 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
25749 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
25750 |
"Cannot perform instanceof check against parameterized type List<E>[]. Use instead its raw form List[] since generic type information will be erased at runtime\n" + |
25750 |
"Cannot perform instanceof check against parameterized type List<E>[]. Use the form List<?>[] instead since further generic type information will be erased at runtime\n" + |
25751 |
"----------\n" + |
25751 |
"----------\n" + |
25752 |
"4. WARNING in X.java (at line 8)\n" + |
25752 |
"4. WARNING in X.java (at line 8)\n" + |
25753 |
" List<E>[] es = (List<E>[]) o; \n" + |
25753 |
" List<E>[] es = (List<E>[]) o; \n" + |
25754 |
" ^^^^^^^^^^^^^\n" + |
25754 |
" ^^^^^^^^^^^^^\n" + |
25755 |
"Type safety: Unchecked cast from Object to List<E>[]\n" + |
25755 |
"Type safety: Unchecked cast from Object to List<E>[]\n" + |
25756 |
"----------\n" + |
25756 |
"----------\n" + |
25757 |
"5. ERROR in X.java (at line 15)\n" + |
25757 |
"5. ERROR in X.java (at line 15)\n" + |
25758 |
" if (al instanceof List<E>[]) { //incorrect too\n" + |
25758 |
" if (al instanceof List<E>[]) { //incorrect too\n" + |
25759 |
" ^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25759 |
" ^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25760 |
"Cannot perform instanceof check against parameterized type List<E>[]. Use instead its raw form List[] since generic type information will be erased at runtime\n" + |
25760 |
"Cannot perform instanceof check against parameterized type List<E>[]. Use the form List<?>[] instead since further generic type information will be erased at runtime\n" + |
25761 |
"----------\n" + |
25761 |
"----------\n" + |
25762 |
"6. WARNING in X.java (at line 16)\n" + |
25762 |
"6. WARNING in X.java (at line 16)\n" + |
25763 |
" List<E>[] es = (List<E>[]) al; \n" + |
25763 |
" List<E>[] es = (List<E>[]) al; \n" + |
25764 |
" ^^^^^^^^^^^^^^\n" + |
25764 |
" ^^^^^^^^^^^^^^\n" + |
25765 |
"Unnecessary cast from ArrayList<E>[] to List<E>[]\n" + |
25765 |
"Unnecessary cast from ArrayList<E>[] to List<E>[]\n" + |
25766 |
"----------\n"); |
25766 |
"----------\n"); |
25767 |
} |
25767 |
} |
25768 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation |
25768 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation |
Lines 25803-25818
Link Here
|
25803 |
" }\n" + |
25803 |
" }\n" + |
25804 |
"}\n", |
25804 |
"}\n", |
25805 |
}, |
25805 |
}, |
25806 |
"----------\n" + |
25806 |
"----------\n" + |
25807 |
"1. ERROR in X.java (at line 4)\n" + |
25807 |
"1. ERROR in X.java (at line 4)\n" + |
25808 |
" if (o instanceof List<E>[][]) { //incorrect too\n" + |
25808 |
" if (o instanceof List<E>[][]) { //incorrect too\n" + |
25809 |
" ^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25809 |
" ^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25810 |
"Cannot perform instanceof check against parameterized type List<E>[][]. Use instead its raw form List[][] since generic type information will be erased at runtime\n" + |
25810 |
"Cannot perform instanceof check against parameterized type List<E>[][]. Use the form List<?>[][] instead since further generic type information will be erased at runtime\n" + |
25811 |
"----------\n" + |
25811 |
"----------\n" + |
25812 |
"2. WARNING in X.java (at line 5)\n" + |
25812 |
"2. WARNING in X.java (at line 5)\n" + |
25813 |
" List<E>[][] es = (List<E>[][]) o; \n" + |
25813 |
" List<E>[][] es = (List<E>[][]) o; \n" + |
25814 |
" ^^^^^^^^^^^^^^^\n" + |
25814 |
" ^^^^^^^^^^^^^^^\n" + |
25815 |
"Type safety: Unchecked cast from Object[] to List<E>[][]\n" + |
25815 |
"Type safety: Unchecked cast from Object[] to List<E>[][]\n" + |
25816 |
"----------\n"); |
25816 |
"----------\n"); |
25817 |
} |
25817 |
} |
25818 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation |
25818 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation |
Lines 25843-25893
Link Here
|
25843 |
" }\n" + |
25843 |
" }\n" + |
25844 |
"}\n", |
25844 |
"}\n", |
25845 |
}, |
25845 |
}, |
25846 |
"----------\n" + |
25846 |
"----------\n" + |
25847 |
"1. WARNING in X.java (at line 4)\n" + |
25847 |
"1. WARNING in X.java (at line 4)\n" + |
25848 |
" private T t;\n" + |
25848 |
" private T t;\n" + |
25849 |
" ^\n" + |
25849 |
" ^\n" + |
25850 |
"The field X<T>.t is never read locally\n" + |
25850 |
"The field X<T>.t is never read locally\n" + |
25851 |
"----------\n" + |
25851 |
"----------\n" + |
25852 |
"2. WARNING in X.java (at line 9)\n" + |
25852 |
"2. WARNING in X.java (at line 9)\n" + |
25853 |
" if (this.inner instanceof X<?>.Inner) {}\n" + |
25853 |
" if (this.inner instanceof X<?>.Inner) {}\n" + |
25854 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25854 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25855 |
"The expression of type X<?>.Inner is already an instance of type X<?>.Inner\n" + |
25855 |
"The expression of type X<?>.Inner is already an instance of type X<?>.Inner\n" + |
25856 |
"----------\n" + |
25856 |
"----------\n" + |
25857 |
"3. WARNING in X.java (at line 10)\n" + |
25857 |
"3. WARNING in X.java (at line 10)\n" + |
25858 |
" if (this.inners instanceof X<?>.Inner[]) {}\n" + |
25858 |
" if (this.inners instanceof X<?>.Inner[]) {}\n" + |
25859 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25859 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25860 |
"The expression of type X<?>.Inner[] is already an instance of type X<?>.Inner[]\n" + |
25860 |
"The expression of type X<?>.Inner[] is already an instance of type X<?>.Inner[]\n" + |
25861 |
"----------\n" + |
25861 |
"----------\n" + |
25862 |
"4. WARNING in X.java (at line 14)\n" + |
25862 |
"4. WARNING in X.java (at line 14)\n" + |
25863 |
" void foo(List l) {\n" + |
25863 |
" void foo(List l) {\n" + |
25864 |
" ^^^^\n" + |
25864 |
" ^^^^\n" + |
25865 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
25865 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
25866 |
"----------\n" + |
25866 |
"----------\n" + |
25867 |
"5. WARNING in X.java (at line 15)\n" + |
25867 |
"5. WARNING in X.java (at line 15)\n" + |
25868 |
" if (l instanceof List<?>) {}\n" + |
25868 |
" if (l instanceof List<?>) {}\n" + |
25869 |
" ^^^^^^^^^^^^^^^^^\n" + |
25869 |
" ^^^^^^^^^^^^^^^^^\n" + |
25870 |
"The expression of type List is already an instance of type List<?>\n" + |
25870 |
"The expression of type List is already an instance of type List<?>\n" + |
25871 |
"----------\n" + |
25871 |
"----------\n" + |
25872 |
"6. ERROR in X.java (at line 16)\n" + |
25872 |
"6. ERROR in X.java (at line 16)\n" + |
25873 |
" if (l instanceof List<? extends String>) {}\n" + |
25873 |
" if (l instanceof List<? extends String>) {}\n" + |
25874 |
" ^^^^^^^^^^^^^^^^^\n" + |
25874 |
" ^^^^^^^^^^^^^^^^^\n" + |
25875 |
"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" + |
25875 |
"Cannot perform instanceof check against parameterized type List<? extends String>. Use the form List<?> instead since further generic type information will be erased at runtime\n" + |
25876 |
"----------\n" + |
25876 |
"----------\n" + |
25877 |
"7. WARNING in X.java (at line 18)\n" + |
25877 |
"7. WARNING in X.java (at line 18)\n" + |
25878 |
" void foo(List[] ls) {\n" + |
25878 |
" void foo(List[] ls) {\n" + |
25879 |
" ^^^^\n" + |
25879 |
" ^^^^\n" + |
25880 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
25880 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
25881 |
"----------\n" + |
25881 |
"----------\n" + |
25882 |
"8. WARNING in X.java (at line 19)\n" + |
25882 |
"8. WARNING in X.java (at line 19)\n" + |
25883 |
" if (ls instanceof List<?>[]) {}\n" + |
25883 |
" if (ls instanceof List<?>[]) {}\n" + |
25884 |
" ^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25884 |
" ^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25885 |
"The expression of type List[] is already an instance of type List<?>\n" + |
25885 |
"The expression of type List[] is already an instance of type List<?>\n" + |
25886 |
"----------\n" + |
25886 |
"----------\n" + |
25887 |
"9. ERROR in X.java (at line 20)\n" + |
25887 |
"9. ERROR in X.java (at line 20)\n" + |
25888 |
" if (ls instanceof List<? extends String>[]) {}\n" + |
25888 |
" if (ls instanceof List<? extends String>[]) {}\n" + |
25889 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25889 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
25890 |
"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" + |
25890 |
"Cannot perform instanceof check against parameterized type List<? extends String>[]. Use the form List<?>[] instead since further generic type information will be erased at runtime\n" + |
25891 |
"----------\n"); |
25891 |
"----------\n"); |
25892 |
} |
25892 |
} |
25893 |
public void test0818() { |
25893 |
public void test0818() { |
Lines 30956-30971
Link Here
|
30956 |
" }\n" + |
30956 |
" }\n" + |
30957 |
"}\n", |
30957 |
"}\n", |
30958 |
}, |
30958 |
}, |
30959 |
"----------\n" + |
30959 |
"----------\n" + |
30960 |
"1. ERROR in X.java (at line 4)\n" + |
30960 |
"1. ERROR in X.java (at line 4)\n" + |
30961 |
" if (o instanceof List<E>[]) { //incorrect: bug 104695\n" + |
30961 |
" if (o instanceof List<E>[]) { //incorrect: bug 104695\n" + |
30962 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
30962 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
30963 |
"Cannot perform instanceof check against parameterized type List<E>[]. Use instead its raw form List[] since generic type information will be erased at runtime\n" + |
30963 |
"Cannot perform instanceof check against parameterized type List<E>[]. Use the form List<?>[] instead since further generic type information will be erased at runtime\n" + |
30964 |
"----------\n" + |
30964 |
"----------\n" + |
30965 |
"2. WARNING in X.java (at line 5)\n" + |
30965 |
"2. WARNING in X.java (at line 5)\n" + |
30966 |
" List<E>[] es= (List<E>[]) o; //unchecked\n" + |
30966 |
" List<E>[] es= (List<E>[]) o; //unchecked\n" + |
30967 |
" ^^^^^^^^^^^^^\n" + |
30967 |
" ^^^^^^^^^^^^^\n" + |
30968 |
"Type safety: Unchecked cast from Object to List<E>[]\n" + |
30968 |
"Type safety: Unchecked cast from Object to List<E>[]\n" + |
30969 |
"----------\n"); |
30969 |
"----------\n"); |
30970 |
} |
30970 |
} |
30971 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130128 |
30971 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130128 |
Lines 48262-48265
Link Here
|
48262 |
"Type mismatch: cannot convert from Class<capture#6-of ? extends YYY> to Class<? extends YYY<? extends B>>\n" + |
48262 |
"Type mismatch: cannot convert from Class<capture#6-of ? extends YYY> to Class<? extends YYY<? extends B>>\n" + |
48263 |
"----------\n"); |
48263 |
"----------\n"); |
48264 |
} |
48264 |
} |
|
|
48265 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258039 |
48266 |
public void test1426() { |
48267 |
this.runNegativeTest( |
48268 |
new String[] { |
48269 |
"X.java", //----------------------------------------------------------------------- |
48270 |
"import java.util.*;\n" + |
48271 |
"public class X {\n" + |
48272 |
" boolean foo() {\n" + |
48273 |
" return null instanceof List<Object>;\n" + |
48274 |
" }\n" + |
48275 |
" <T extends List<Object>> boolean foo2() {\n" + |
48276 |
" return null instanceof T;\n" + |
48277 |
" }\n" + |
48278 |
" boolean foo3() {\n" + |
48279 |
" return null instanceof Map<Object,String>;\n" + |
48280 |
" }\n" + |
48281 |
" <T extends Map<Object,String>> boolean foo4() {\n" + |
48282 |
" return null instanceof T;\n" + |
48283 |
" }\n" + |
48284 |
"}\n",//----------------------------------------------------------------------- |
48285 |
}, |
48286 |
"----------\n" + |
48287 |
"1. ERROR in X.java (at line 4)\n" + |
48288 |
" return null instanceof List<Object>;\n" + |
48289 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
48290 |
"Cannot perform instanceof check against parameterized type List<Object>. Use the form List<?> instead since further generic type information will be erased at runtime\n" + |
48291 |
"----------\n" + |
48292 |
"2. ERROR in X.java (at line 7)\n" + |
48293 |
" return null instanceof T;\n" + |
48294 |
" ^^^^^^^^^^^^^^^^^\n" + |
48295 |
"Cannot perform instanceof check against type parameter T. Use instead its erasure List<?> instead since further generic type information will be erased at runtime\n" + |
48296 |
"----------\n" + |
48297 |
"3. ERROR in X.java (at line 10)\n" + |
48298 |
" return null instanceof Map<Object,String>;\n" + |
48299 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
48300 |
"Cannot perform instanceof check against parameterized type Map<Object,String>. Use the form Map<?,?> instead since further generic type information will be erased at runtime\n" + |
48301 |
"----------\n" + |
48302 |
"4. ERROR in X.java (at line 13)\n" + |
48303 |
" return null instanceof T;\n" + |
48304 |
" ^^^^^^^^^^^^^^^^^\n" + |
48305 |
"Cannot perform instanceof check against type parameter T. Use instead its erasure Map<?,?> instead since further generic type information will be erased at runtime\n" + |
48306 |
"----------\n"); |
48307 |
} |
48265 |
} |
48308 |
} |