Lines 33089-33093
Link Here
|
33089 |
assertTrue(false); |
33089 |
assertTrue(false); |
33090 |
} |
33090 |
} |
33091 |
} |
33091 |
} |
|
|
33092 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 |
33093 |
public void test1125() { |
33094 |
this.runNegativeTest( |
33095 |
new String[] { |
33096 |
"X.java", |
33097 |
"class A {\n" + |
33098 |
" class B<T> {\n" + |
33099 |
" T t;\n" + |
33100 |
" T getValue() {\n" + |
33101 |
" return t;\n" + |
33102 |
" }\n" + |
33103 |
" }\n" + |
33104 |
"}\n" + |
33105 |
"\n" + |
33106 |
"class C<T> extends A {\n" + |
33107 |
" Zork z;\n" + |
33108 |
"}\n" + |
33109 |
"\n" + |
33110 |
"public class X {\n" + |
33111 |
" static C.B<Double> c = new C().new B<Double>();\n" + |
33112 |
"\n" + |
33113 |
" public static void main(String[] args) {\n" + |
33114 |
" C.B<String> temp = new C().new B<String>();\n" + |
33115 |
" String s = temp.getValue();\n" + |
33116 |
" System.out.println(s);\n" + |
33117 |
" foo(bar());\n" + |
33118 |
" }\n" + |
33119 |
"\n" + |
33120 |
" static C.B<? extends Number> bar() {\n" + |
33121 |
" return new C().new B<Integer>();\n" + |
33122 |
" }\n" + |
33123 |
"\n" + |
33124 |
" static void foo(C.B<?> arg) {\n" + |
33125 |
" Object o = arg.getValue();\n" + |
33126 |
" Double d = c.getValue();\n" + |
33127 |
" System.out.println(o);\n" + |
33128 |
" System.out.println(d);\n" + |
33129 |
" }\n" + |
33130 |
"}\n", // ================= |
33131 |
}, |
33132 |
"----------\n" + |
33133 |
"1. ERROR in X.java (at line 11)\n" + |
33134 |
" Zork z;\n" + |
33135 |
" ^^^^\n" + |
33136 |
"Zork cannot be resolved to a type\n" + |
33137 |
"----------\n" + |
33138 |
"2. WARNING in X.java (at line 15)\n" + |
33139 |
" static C.B<Double> c = new C().new B<Double>();\n" + |
33140 |
" ^\n" + |
33141 |
"C is a raw type. References to generic type C<T> should be parameterized\n" + |
33142 |
"----------\n" + |
33143 |
"3. WARNING in X.java (at line 18)\n" + |
33144 |
" C.B<String> temp = new C().new B<String>();\n" + |
33145 |
" ^\n" + |
33146 |
"C is a raw type. References to generic type C<T> should be parameterized\n" + |
33147 |
"----------\n" + |
33148 |
"4. WARNING in X.java (at line 25)\n" + |
33149 |
" return new C().new B<Integer>();\n" + |
33150 |
" ^\n" + |
33151 |
"C is a raw type. References to generic type C<T> should be parameterized\n" + |
33152 |
"----------\n"); |
33153 |
} |
33154 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 - variation |
33155 |
public void test1126() { |
33156 |
this.runConformTest( |
33157 |
new String[] { |
33158 |
"X.java", |
33159 |
"class A {\n" + |
33160 |
" class B<T> {\n" + |
33161 |
" T t;\n" + |
33162 |
" T getValue() {\n" + |
33163 |
" return t;\n" + |
33164 |
" }\n" + |
33165 |
" }\n" + |
33166 |
"}\n" + |
33167 |
"\n" + |
33168 |
"public class X {\n" + |
33169 |
" static A.B<Double> c = new A().new B<Double>();\n" + |
33170 |
"\n" + |
33171 |
" public static void main(String[] args) {\n" + |
33172 |
" A.B<String> temp = new A().new B<String>();\n" + |
33173 |
" String s = temp.getValue();\n" + |
33174 |
" System.out.print(s);\n" + |
33175 |
" foo(bar());\n" + |
33176 |
" }\n" + |
33177 |
"\n" + |
33178 |
" static A.B<? extends Number> bar() {\n" + |
33179 |
" return new A().new B<Integer>();\n" + |
33180 |
" }\n" + |
33181 |
"\n" + |
33182 |
" static void foo(A.B<?> arg) {\n" + |
33183 |
" Object o = arg.getValue();\n" + |
33184 |
" Double d = c.getValue();\n" + |
33185 |
" System.out.print(o);\n" + |
33186 |
" System.out.print(d);\n" + |
33187 |
" }\n" + |
33188 |
"}\n", // ================= |
33189 |
}, |
33190 |
"nullnullnull"); |
33191 |
} |
33192 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 - variation |
33193 |
public void test1127() { |
33194 |
this.runNegativeTest( |
33195 |
new String[] { |
33196 |
"X.java", |
33197 |
"class A<E> {\n" + |
33198 |
" class B<T> {\n" + |
33199 |
" T t;\n" + |
33200 |
" T getValue() {\n" + |
33201 |
" return t;\n" + |
33202 |
" }\n" + |
33203 |
" }\n" + |
33204 |
"}\n" + |
33205 |
"\n" + |
33206 |
"class C<T> extends A<T> {\n" + |
33207 |
"}\n" + |
33208 |
"\n" + |
33209 |
"public class X {\n" + |
33210 |
" static C.B<Double> c = new C().new B<Double>();\n" + |
33211 |
"\n" + |
33212 |
" public static void main(String[] args) {\n" + |
33213 |
" C.B<String> temp = new C().new B<String>();\n" + |
33214 |
" String s = temp.getValue();\n" + |
33215 |
" System.out.println(s);\n" + |
33216 |
" foo(bar());\n" + |
33217 |
" }\n" + |
33218 |
"\n" + |
33219 |
" static C.B<? extends Number> bar() {\n" + |
33220 |
" return new C().new B<Integer>();\n" + |
33221 |
" }\n" + |
33222 |
"\n" + |
33223 |
" static void foo(C.B<?> arg) {\n" + |
33224 |
" Object o = arg.getValue();\n" + |
33225 |
" Double d = c.getValue();\n" + |
33226 |
" System.out.println(o);\n" + |
33227 |
" System.out.println(d);\n" + |
33228 |
" }\n" + |
33229 |
"}\n", // ================= |
33230 |
}, |
33231 |
"----------\n" + |
33232 |
"1. ERROR in X.java (at line 14)\n" + |
33233 |
" static C.B<Double> c = new C().new B<Double>();\n" + |
33234 |
" ^^^\n" + |
33235 |
"The member type A.B<Double> must be qualified with a parameterized type, since it is not static\n" + |
33236 |
"----------\n" + |
33237 |
"2. WARNING in X.java (at line 14)\n" + |
33238 |
" static C.B<Double> c = new C().new B<Double>();\n" + |
33239 |
" ^\n" + |
33240 |
"C is a raw type. References to generic type C<T> should be parameterized\n" + |
33241 |
"----------\n" + |
33242 |
"3. ERROR in X.java (at line 14)\n" + |
33243 |
" static C.B<Double> c = new C().new B<Double>();\n" + |
33244 |
" ^\n" + |
33245 |
"The member type A.B<Double> must be qualified with a parameterized type, since it is not static\n" + |
33246 |
"----------\n" + |
33247 |
"4. ERROR in X.java (at line 17)\n" + |
33248 |
" C.B<String> temp = new C().new B<String>();\n" + |
33249 |
" ^^^\n" + |
33250 |
"The member type A.B<String> must be qualified with a parameterized type, since it is not static\n" + |
33251 |
"----------\n" + |
33252 |
"5. WARNING in X.java (at line 17)\n" + |
33253 |
" C.B<String> temp = new C().new B<String>();\n" + |
33254 |
" ^\n" + |
33255 |
"C is a raw type. References to generic type C<T> should be parameterized\n" + |
33256 |
"----------\n" + |
33257 |
"6. ERROR in X.java (at line 17)\n" + |
33258 |
" C.B<String> temp = new C().new B<String>();\n" + |
33259 |
" ^\n" + |
33260 |
"The member type A.B<String> must be qualified with a parameterized type, since it is not static\n" + |
33261 |
"----------\n" + |
33262 |
"7. ERROR in X.java (at line 23)\n" + |
33263 |
" static C.B<? extends Number> bar() {\n" + |
33264 |
" ^^^\n" + |
33265 |
"The member type A.B<? extends Number> must be qualified with a parameterized type, since it is not static\n" + |
33266 |
"----------\n" + |
33267 |
"8. WARNING in X.java (at line 24)\n" + |
33268 |
" return new C().new B<Integer>();\n" + |
33269 |
" ^\n" + |
33270 |
"C is a raw type. References to generic type C<T> should be parameterized\n" + |
33271 |
"----------\n" + |
33272 |
"9. ERROR in X.java (at line 24)\n" + |
33273 |
" return new C().new B<Integer>();\n" + |
33274 |
" ^\n" + |
33275 |
"The member type A.B<Integer> must be qualified with a parameterized type, since it is not static\n" + |
33276 |
"----------\n" + |
33277 |
"10. ERROR in X.java (at line 27)\n" + |
33278 |
" static void foo(C.B<?> arg) {\n" + |
33279 |
" ^^^\n" + |
33280 |
"The member type A.B<?> must be qualified with a parameterized type, since it is not static\n" + |
33281 |
"----------\n"); |
33282 |
} |
33283 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 - variation |
33284 |
public void test1128() { |
33285 |
this.runNegativeTest( |
33286 |
new String[] { |
33287 |
"X.java", |
33288 |
"class A<T> {\n" + |
33289 |
" class Member<U> {}\n" + |
33290 |
"}\n" + |
33291 |
"\n" + |
33292 |
"public class X extends A {\n" + |
33293 |
" void foo() {\n" + |
33294 |
" new Member<String>();\n" + |
33295 |
" new X().new Member<String>();\n" + |
33296 |
" }\n" + |
33297 |
"}\n", // ================= |
33298 |
}, |
33299 |
"----------\n" + |
33300 |
"1. WARNING in X.java (at line 5)\n" + |
33301 |
" public class X extends A {\n" + |
33302 |
" ^\n" + |
33303 |
"A is a raw type. References to generic type A<T> should be parameterized\n" + |
33304 |
"----------\n" + |
33305 |
"2. ERROR in X.java (at line 7)\n" + |
33306 |
" new Member<String>();\n" + |
33307 |
" ^^^^^^\n" + |
33308 |
"The member type A.Member<String> must be qualified with a parameterized type, since it is not static\n" + |
33309 |
"----------\n" + |
33310 |
"3. ERROR in X.java (at line 8)\n" + |
33311 |
" new X().new Member<String>();\n" + |
33312 |
" ^^^^^^\n" + |
33313 |
"The member type A.Member<String> must be qualified with a parameterized type, since it is not static\n" + |
33314 |
"----------\n"); |
33315 |
} |
33092 |
|
33316 |
|
33093 |
} |
33317 |
} |