Lines 799-805
Link Here
|
799 |
"135" |
799 |
"135" |
800 |
); |
800 |
); |
801 |
} |
801 |
} |
802 |
public void test014h() { |
802 |
public void test014h1() { |
803 |
this.runConformTest( |
803 |
this.runConformTest( |
804 |
new String[] { |
804 |
new String[] { |
805 |
"X.java", |
805 |
"X.java", |
Lines 816-823
Link Here
|
816 |
" <T extends F<C>> void a3(T x) {}\n" + |
816 |
" <T extends F<C>> void a3(T x) {}\n" + |
817 |
" void a4(G x) {}\n" + |
817 |
" void a4(G x) {}\n" + |
818 |
" <T extends C, S extends F<T>> void a4(S x) {}\n" + |
818 |
" <T extends C, S extends F<T>> void a4(S x) {}\n" + |
819 |
" <T extends G> void a5(T x) {}\n" + |
|
|
820 |
" void a5(F<C> x) {}\n" + |
821 |
" void b(G<C> x) { System.out.print(true); }\n" + |
819 |
" void b(G<C> x) { System.out.print(true); }\n" + |
822 |
" void b(F x) { System.out.print(false); }\n" + |
820 |
" void b(F x) { System.out.print(false); }\n" + |
823 |
" void b2(G<C> x) { System.out.print(true); }\n" + |
821 |
" void b2(G<C> x) { System.out.print(true); }\n" + |
Lines 860-944
Link Here
|
860 |
}, |
858 |
}, |
861 |
"truetruetruetruetruetruetruetruetruetruetruetruetruetruetruetrue" |
859 |
"truetruetruetruetruetruetruetruetruetruetruetruetruetruetruetrue" |
862 |
); |
860 |
); |
|
|
861 |
} |
862 |
public void test014h2() { |
863 |
this.runNegativeTest( |
863 |
this.runNegativeTest( |
864 |
new String[] { |
864 |
new String[] { |
865 |
"Y.java", |
865 |
"X.java", |
866 |
"public class Y extends X {\n" + |
866 |
"public class X {\n" + |
|
|
867 |
" void a(G x) {}\n" + |
868 |
" void a(F<C> x) {}\n" + |
869 |
"}\n" + |
870 |
"class A {}\n" + |
871 |
"class B extends A {}\n" + |
872 |
"class C extends B {}\n" + |
873 |
"class F<T1> {} \n" + |
874 |
"class G<T2> extends F<T2> {}\n" + |
875 |
"class H<T3> extends G<T3> {}" + |
876 |
"class Y extends X {\n" + |
867 |
" public static void ambiguousCases() {\n" + |
877 |
" public static void ambiguousCases() {\n" + |
868 |
" H<C> h = null;\n" + |
878 |
" H<C> h = null;\n" + |
869 |
" H hraw = null;\n" + |
879 |
" H hraw = null;\n" + |
870 |
" new X().a(h);\n" + |
880 |
" new X().a(h);\n" + |
871 |
" new X().a(hraw);\n" + |
881 |
" new X().a(hraw);\n" + |
872 |
" new X().a2(h);\n" + |
|
|
873 |
" new X().a2(hraw);\n" + |
874 |
" new X().a3(h);\n" + |
875 |
" new X().a3(hraw);\n" + |
876 |
" new X().a4(h);\n" + |
877 |
" new X().a4(hraw);\n" + |
878 |
" new X().a5(h);\n" + |
879 |
" new X().a5(hraw);\n" + |
880 |
" }\n" + |
882 |
" }\n" + |
881 |
"}\n" |
883 |
"}\n" |
882 |
}, |
884 |
}, |
883 |
"----------\n" + |
885 |
"----------\n" + |
884 |
"1. WARNING in Y.java (at line 4)\n" + |
886 |
"1. WARNING in X.java (at line 2)\n" + |
|
|
887 |
" void a(G x) {}\n" + |
888 |
" ^\n" + |
889 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
890 |
"----------\n" + |
891 |
"2. WARNING in X.java (at line 13)\n" + |
885 |
" H hraw = null;\n" + |
892 |
" H hraw = null;\n" + |
886 |
" ^\n" + |
893 |
" ^\n" + |
887 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
894 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
888 |
"----------\n" + |
895 |
"----------\n" + |
889 |
"2. ERROR in Y.java (at line 5)\n" + |
896 |
"3. ERROR in X.java (at line 14)\n" + |
890 |
" new X().a(h);\n" + |
897 |
" new X().a(h);\n" + |
891 |
" ^\n" + |
898 |
" ^\n" + |
892 |
"The method a(G) is ambiguous for the type X\n" + |
899 |
"The method a(G) is ambiguous for the type X\n" + |
893 |
"----------\n" + |
900 |
"----------\n" + |
894 |
"3. ERROR in Y.java (at line 6)\n" + |
901 |
"4. ERROR in X.java (at line 15)\n" + |
895 |
" new X().a(hraw);\n" + |
902 |
" new X().a(hraw);\n" + |
896 |
" ^\n" + |
903 |
" ^\n" + |
897 |
"The method a(G) is ambiguous for the type X\n" + |
904 |
"The method a(G) is ambiguous for the type X\n" + |
|
|
905 |
"----------\n", |
906 |
null, |
907 |
false |
908 |
); |
909 |
} |
910 |
public void test014h3() { |
911 |
this.runNegativeTest( |
912 |
new String[] { |
913 |
"X.java", |
914 |
"public class X {\n" + |
915 |
" void a2(G x) {}\n" + |
916 |
" <T extends C> void a2(F<T> x) {}\n" + |
917 |
"}\n" + |
918 |
"class A {}\n" + |
919 |
"class B extends A {}\n" + |
920 |
"class C extends B {}\n" + |
921 |
"class F<T1> {} \n" + |
922 |
"class G<T2> extends F<T2> {}\n" + |
923 |
"class H<T3> extends G<T3> {}" + |
924 |
"class Y extends X {\n" + |
925 |
" public static void ambiguousCases() {\n" + |
926 |
" H<C> h = null;\n" + |
927 |
" new X().a2(h);\n" + |
928 |
" }\n" + |
929 |
"}\n" |
930 |
}, |
898 |
"----------\n" + |
931 |
"----------\n" + |
899 |
"4. ERROR in Y.java (at line 7)\n" + |
932 |
"1. WARNING in X.java (at line 2)\n" + |
|
|
933 |
" void a2(G x) {}\n" + |
934 |
" ^\n" + |
935 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
936 |
"----------\n" + |
937 |
"2. ERROR in X.java (at line 13)\n" + |
900 |
" new X().a2(h);\n" + |
938 |
" new X().a2(h);\n" + |
901 |
" ^^\n" + |
939 |
" ^^\n" + |
902 |
"The method a2(G) is ambiguous for the type X\n" + |
940 |
"The method a2(G) is ambiguous for the type X\n" + |
|
|
941 |
"----------\n" |
942 |
); |
943 |
} |
944 |
public void test014h4() { |
945 |
this.runNegativeTest( |
946 |
new String[] { |
947 |
"X.java", |
948 |
"public class X {\n" + |
949 |
" void a2(G x) {}\n" + |
950 |
" <T extends C> void a2(F<T> x) {}\n" + |
951 |
"}\n" + |
952 |
"class A {}\n" + |
953 |
"class B extends A {}\n" + |
954 |
"class C extends B {}\n" + |
955 |
"class F<T1> {} \n" + |
956 |
"class G<T2> extends F<T2> {}\n" + |
957 |
"class H<T3> extends G<T3> {}" + |
958 |
"class Y extends X {\n" + |
959 |
" public static void ambiguousCases() {\n" + |
960 |
" H hraw = null;\n" + |
961 |
" new X().a2(hraw);\n" + |
962 |
" }\n" + |
963 |
"}\n" |
964 |
}, |
903 |
"----------\n" + |
965 |
"----------\n" + |
904 |
"5. ERROR in Y.java (at line 8)\n" + |
966 |
"1. WARNING in X.java (at line 2)\n" + |
|
|
967 |
" void a2(G x) {}\n" + |
968 |
" ^\n" + |
969 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
970 |
"----------\n" + |
971 |
"2. WARNING in X.java (at line 12)\n" + |
972 |
" H hraw = null;\n" + |
973 |
" ^\n" + |
974 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
975 |
"----------\n" + |
976 |
"3. ERROR in X.java (at line 13)\n" + |
905 |
" new X().a2(hraw);\n" + |
977 |
" new X().a2(hraw);\n" + |
906 |
" ^^\n" + |
978 |
" ^^\n" + |
907 |
"The method a2(G) is ambiguous for the type X\n" + |
979 |
"The method a2(G) is ambiguous for the type X\n" + |
|
|
980 |
"----------\n" |
981 |
); |
982 |
} |
983 |
public void test014h5() { |
984 |
this.runNegativeTest( |
985 |
new String[] { |
986 |
"X.java", |
987 |
"public class X {\n" + |
988 |
" void a3(G x) {}\n" + |
989 |
" <T extends F<C>> void a3(T x) {}\n" + |
990 |
"}\n" + |
991 |
"class A {}\n" + |
992 |
"class B extends A {}\n" + |
993 |
"class C extends B {}\n" + |
994 |
"class F<T1> {} \n" + |
995 |
"class G<T2> extends F<T2> {}\n" + |
996 |
"class H<T3> extends G<T3> {}" + |
997 |
"class Y extends X {\n" + |
998 |
" public static void ambiguousCases() {\n" + |
999 |
" H<C> h = null;\n" + |
1000 |
" H hraw = null;\n" + |
1001 |
" new X().a3(h);\n" + |
1002 |
" new X().a3(hraw);\n" + |
1003 |
" }\n" + |
1004 |
"}\n" |
1005 |
}, |
1006 |
"----------\n" + |
1007 |
"1. WARNING in X.java (at line 2)\n" + |
1008 |
" void a3(G x) {}\n" + |
1009 |
" ^\n" + |
1010 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
908 |
"----------\n" + |
1011 |
"----------\n" + |
909 |
"6. ERROR in Y.java (at line 9)\n" + |
1012 |
"2. WARNING in X.java (at line 13)\n" + |
|
|
1013 |
" H hraw = null;\n" + |
1014 |
" ^\n" + |
1015 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
1016 |
"----------\n" + |
1017 |
"3. ERROR in X.java (at line 14)\n" + |
910 |
" new X().a3(h);\n" + |
1018 |
" new X().a3(h);\n" + |
911 |
" ^^\n" + |
1019 |
" ^^\n" + |
912 |
"The method a3(G) is ambiguous for the type X\n" + |
1020 |
"The method a3(G) is ambiguous for the type X\n" + |
913 |
"----------\n" + |
1021 |
"----------\n" + |
914 |
"7. ERROR in Y.java (at line 10)\n" + |
1022 |
"4. ERROR in X.java (at line 15)\n" + |
915 |
" new X().a3(hraw);\n" + |
1023 |
" new X().a3(hraw);\n" + |
916 |
" ^^\n" + |
1024 |
" ^^\n" + |
917 |
"The method a3(G) is ambiguous for the type X\n" + |
1025 |
"The method a3(G) is ambiguous for the type X\n" + |
|
|
1026 |
"----------\n", |
1027 |
null, |
1028 |
false |
1029 |
); |
1030 |
} |
1031 |
public void test014h6() { |
1032 |
this.runNegativeTest( |
1033 |
new String[] { |
1034 |
"X.java", |
1035 |
"public class X {\n" + |
1036 |
" void a4(G x) {}\n" + |
1037 |
" <T extends C, S extends F<T>> void a4(S x) {}\n" + |
1038 |
"}\n" + |
1039 |
"class A {}\n" + |
1040 |
"class B extends A {}\n" + |
1041 |
"class C extends B {}\n" + |
1042 |
"class F<T1> {} \n" + |
1043 |
"class G<T2> extends F<T2> {}\n" + |
1044 |
"class H<T3> extends G<T3> {}" + |
1045 |
"class Y extends X {\n" + |
1046 |
" public static void ambiguousCases() {\n" + |
1047 |
" H<C> h = null;\n" + |
1048 |
" H hraw = null;\n" + |
1049 |
" new X().a4(h);\n" + |
1050 |
" new X().a4(hraw);\n" + |
1051 |
" }\n" + |
1052 |
"}\n" |
1053 |
}, |
918 |
"----------\n" + |
1054 |
"----------\n" + |
919 |
"8. ERROR in Y.java (at line 11)\n" + |
1055 |
"1. WARNING in X.java (at line 2)\n" + |
|
|
1056 |
" void a4(G x) {}\n" + |
1057 |
" ^\n" + |
1058 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
1059 |
"----------\n" + |
1060 |
"2. WARNING in X.java (at line 13)\n" + |
1061 |
" H hraw = null;\n" + |
1062 |
" ^\n" + |
1063 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
1064 |
"----------\n" + |
1065 |
"3. ERROR in X.java (at line 14)\n" + |
920 |
" new X().a4(h);\n" + |
1066 |
" new X().a4(h);\n" + |
921 |
" ^^\n" + |
1067 |
" ^^\n" + |
922 |
"The method a4(G) is ambiguous for the type X\n" + |
1068 |
"The method a4(G) is ambiguous for the type X\n" + |
923 |
"----------\n" + |
1069 |
"----------\n" + |
924 |
"9. ERROR in Y.java (at line 12)\n" + |
1070 |
"4. ERROR in X.java (at line 15)\n" + |
925 |
" new X().a4(hraw);\n" + |
1071 |
" new X().a4(hraw);\n" + |
926 |
" ^^\n" + |
1072 |
" ^^\n" + |
927 |
"The method a4(G) is ambiguous for the type X\n" + |
1073 |
"The method a4(G) is ambiguous for the type X\n" + |
|
|
1074 |
"----------\n", |
1075 |
null, |
1076 |
false |
1077 |
); |
1078 |
} |
1079 |
public void test014h7() { |
1080 |
this.runNegativeTest( |
1081 |
new String[] { |
1082 |
"X.java", |
1083 |
"public class X {\n" + |
1084 |
" <T extends G> void a5(T x) {}\n" + |
1085 |
" void a5(F<C> x) {}\n" + |
1086 |
"}\n" + |
1087 |
"class A {}\n" + |
1088 |
"class B extends A {}\n" + |
1089 |
"class C extends B {}\n" + |
1090 |
"class F<T1> {} \n" + |
1091 |
"class G<T2> extends F<T2> {}\n" + |
1092 |
"class H<T3> extends G<T3> {}" + |
1093 |
"class Y extends X {\n" + |
1094 |
" public static void ambiguousCases() {\n" + |
1095 |
" H<C> h = null;\n" + |
1096 |
" H hraw = null;\n" + |
1097 |
" new X().a5(h);\n" + |
1098 |
" new X().a5(hraw);\n" + |
1099 |
" }\n" + |
1100 |
"}\n" |
1101 |
}, |
1102 |
"----------\n" + |
1103 |
"1. WARNING in X.java (at line 2)\n" + |
1104 |
" <T extends G> void a5(T x) {}\n" + |
1105 |
" ^\n" + |
1106 |
"G is a raw type. References to generic type G<T2> should be parameterized\n" + |
1107 |
"----------\n" + |
1108 |
"2. WARNING in X.java (at line 13)\n" + |
1109 |
" H hraw = null;\n" + |
1110 |
" ^\n" + |
1111 |
"H is a raw type. References to generic type H<T3> should be parameterized\n" + |
928 |
"----------\n" + |
1112 |
"----------\n" + |
929 |
"10. ERROR in Y.java (at line 13)\n" + |
1113 |
"3. ERROR in X.java (at line 14)\n" + |
930 |
" new X().a5(h);\n" + |
1114 |
" new X().a5(h);\n" + |
931 |
" ^^\n" + |
1115 |
" ^^\n" + |
932 |
"The method a5(H<C>) is ambiguous for the type X\n" + |
1116 |
"The method a5(H<C>) is ambiguous for the type X\n" + |
933 |
"----------\n" + |
1117 |
"----------\n" + |
934 |
"11. ERROR in Y.java (at line 14)\n" + |
1118 |
"4. ERROR in X.java (at line 15)\n" + |
935 |
" new X().a5(hraw);\n" + |
1119 |
" new X().a5(hraw);\n" + |
936 |
" ^^\n" + |
1120 |
" ^^\n" + |
937 |
"The method a5(H) is ambiguous for the type X\n" + |
1121 |
"The method a5(H) is ambiguous for the type X\n" + |
938 |
"----------\n", |
1122 |
"----------\n"); |
939 |
null, |
|
|
940 |
false |
941 |
); |
942 |
} |
1123 |
} |
943 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79798 |
1124 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79798 |
944 |
public void test015() { |
1125 |
public void test015() { |
Lines 2091-2097
Link Here
|
2091 |
); |
2272 |
); |
2092 |
} |
2273 |
} |
2093 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=189933 |
2274 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=189933 |
2094 |
public void _test060() { |
2275 |
public void test060() { |
2095 |
this.runConformTest( |
2276 |
this.runConformTest( |
2096 |
new String[] { |
2277 |
new String[] { |
2097 |
"X.java", |
2278 |
"X.java", |
Lines 2120-2126
Link Here
|
2120 |
} |
2301 |
} |
2121 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=189933 |
2302 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=189933 |
2122 |
// variant |
2303 |
// variant |
2123 |
public void _test061() { |
2304 |
public void test061() { |
2124 |
this.runNegativeTest( |
2305 |
this.runNegativeTest( |
2125 |
new String[] { |
2306 |
new String[] { |
2126 |
"X.java", |
2307 |
"X.java", |
Lines 2177-2180
Link Here
|
2177 |
"----------\n" |
2358 |
"----------\n" |
2178 |
); |
2359 |
); |
2179 |
} |
2360 |
} |
|
|
2361 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=189933 |
2362 |
// variant |
2363 |
public void test062() { |
2364 |
this.runConformTest( |
2365 |
new String[] { |
2366 |
"X.java", |
2367 |
"public class X<T> {\n" + |
2368 |
" public void bar(K<T, Object> p) {\n" + |
2369 |
" new Y<T, Object>(p);\n" + |
2370 |
" new Y<T, Object>((J<T, Object>) p);\n" + |
2371 |
" }\n" + |
2372 |
"}\n" + |
2373 |
"class Y<T, U> {\n" + |
2374 |
" Y(I<? extends T, ? extends U> p) {\n" + |
2375 |
" }\n" + |
2376 |
" Y(J<T, ? extends U> p) {\n" + |
2377 |
" }\n" + |
2378 |
"}\n" + |
2379 |
"interface I<T, U> { \n" + |
2380 |
"}\n" + |
2381 |
"interface J<T, U> extends I<T, U> {\n" + |
2382 |
"}\n" + |
2383 |
"interface K<T, U> extends I<T, U>, J<T, U> {\n" + |
2384 |
"}" |
2385 |
}, |
2386 |
"" |
2387 |
); |
2388 |
} |
2389 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=189933 |
2390 |
// variant |
2391 |
public void test063() { |
2392 |
this.runConformTest( |
2393 |
new String[] { |
2394 |
"X.java", |
2395 |
"public class X<T, U> {\n" + |
2396 |
" public void bar(K<T, U> p) {\n" + |
2397 |
" new Y<T, U>(p);\n" + |
2398 |
" new Y<T, U>((J<T, U>) p);\n" + |
2399 |
" }\n" + |
2400 |
"}\n" + |
2401 |
"class Y<T, U> {\n" + |
2402 |
" Y(I<? extends T, ? extends U> p) {\n" + |
2403 |
" }\n" + |
2404 |
" Y(J<T, ? extends U> p) {\n" + |
2405 |
" }\n" + |
2406 |
"}\n" + |
2407 |
"interface I<T, U> { \n" + |
2408 |
"}\n" + |
2409 |
"interface J<T, U> extends I<T, U> {\n" + |
2410 |
"}\n" + |
2411 |
"interface K<T, U> extends I<T, U>, J<T, U> {\n" + |
2412 |
"}" |
2413 |
}, |
2414 |
"" |
2415 |
); |
2416 |
} |
2180 |
} |
2417 |
} |