View | Details | Raw Unified | Return to bug 277643 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-78 / +196 lines)
Lines 14009-14015 Link Here
14009
			"3. WARNING in X.java (at line 16)\n" + 
14009
			"3. WARNING in X.java (at line 16)\n" + 
14010
			"	return m_manager.getById(getClass(), new Integer(1));\n" + 
14010
			"	return m_manager.getById(getClass(), new Integer(1));\n" + 
14011
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
14011
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
14012
			"Type safety: The expression of type ITest needs unchecked conversion to conform to ITest<C>\n" + 
14012
			"Type safety: The expression of type Test needs unchecked conversion to conform to ITest<C>\n" + 
14013
			"----------\n");
14013
			"----------\n");
14014
	}
14014
	}
14015
14015
Lines 32985-33001 Link Here
32985
		"	      ^^^^^^^^^\n" + 
32985
		"	      ^^^^^^^^^\n" + 
32986
		"Type safety: Unchecked invocation bar(L, C<capture#1-of ? extends X>) of the generic method bar(L<T>, C<? extends T>) of type X\n" + 
32986
		"Type safety: Unchecked invocation bar(L, C<capture#1-of ? extends X>) of the generic method bar(L<T>, C<? extends T>) of type X\n" + 
32987
		"----------\n" + 
32987
		"----------\n" + 
32988
		"3. ERROR in X.java (at line 3)\n" + 
32988
		"3. WARNING in X.java (at line 3)\n" + 
32989
		"	X x = bar(l, c);\n" + 
32990
		"	      ^^^^^^^^^\n" + 
32991
		"Type mismatch: cannot convert from Object to X\n" + 
32992
		"----------\n" + 
32993
		"4. WARNING in X.java (at line 3)\n" + 
32994
		"	X x = bar(l, c);\n" + 
32989
		"	X x = bar(l, c);\n" + 
32995
		"	          ^\n" + 
32990
		"	          ^\n" + 
32996
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32991
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32997
		"----------\n" + 
32992
		"----------\n" + 
32998
		"5. ERROR in X.java (at line 6)\n" + 
32993
		"4. ERROR in X.java (at line 6)\n" + 
32999
		"	return zork;\n" + 
32994
		"	return zork;\n" + 
33000
		"	       ^^^^\n" + 
32995
		"	       ^^^^\n" + 
33001
		"zork cannot be resolved to a variable\n" + 
32996
		"zork cannot be resolved to a variable\n" + 
Lines 33142-33188 Link Here
33142
		"	      ^^^^^^^^^^\n" + 
33137
		"	      ^^^^^^^^^^\n" + 
33143
		"Type safety: Unchecked invocation bar1(L, C<X>) of the generic method bar1(L<T>, C<T>) of type X\n" + 
33138
		"Type safety: Unchecked invocation bar1(L, C<X>) of the generic method bar1(L<T>, C<T>) of type X\n" + 
33144
		"----------\n" + 
33139
		"----------\n" + 
33145
		"3. ERROR in X.java (at line 3)\n" + 
33140
		"3. WARNING in X.java (at line 3)\n" + 
33146
		"	X x = bar1(l, c);\n" + 
33147
		"	      ^^^^^^^^^^\n" + 
33148
		"Type mismatch: cannot convert from Object to X\n" + 
33149
		"----------\n" + 
33150
		"4. WARNING in X.java (at line 3)\n" + 
33151
		"	X x = bar1(l, c);\n" + 
33141
		"	X x = bar1(l, c);\n" + 
33152
		"	           ^\n" + 
33142
		"	           ^\n" + 
33153
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33143
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33154
		"----------\n" + 
33144
		"----------\n" + 
33155
		"5. WARNING in X.java (at line 4)\n" + 
33145
		"4. WARNING in X.java (at line 4)\n" + 
33156
		"	L<X> lx = bar2(l, c);\n" + 
33146
		"	L<X> lx = bar2(l, c);\n" + 
33157
		"	          ^^^^^^^^^^\n" + 
33147
		"	          ^^^^^^^^^^\n" + 
33158
		"Type safety: Unchecked invocation bar2(L, C<X>) of the generic method bar2(L<T>, C<T>) of type X\n" + 
33148
		"Type safety: Unchecked invocation bar2(L, C<X>) of the generic method bar2(L<T>, C<T>) of type X\n" + 
33159
		"----------\n" + 
33149
		"----------\n" + 
33160
		"6. WARNING in X.java (at line 4)\n" + 
33150
		"5. WARNING in X.java (at line 4)\n" + 
33161
		"	L<X> lx = bar2(l, c);\n" + 
33151
		"	L<X> lx = bar2(l, c);\n" + 
33162
		"	          ^^^^^^^^^^\n" + 
33152
		"	          ^^^^^^^^^^\n" + 
33163
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33153
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33164
		"----------\n" + 
33154
		"----------\n" + 
33165
		"7. WARNING in X.java (at line 4)\n" + 
33155
		"6. WARNING in X.java (at line 4)\n" + 
33166
		"	L<X> lx = bar2(l, c);\n" + 
33156
		"	L<X> lx = bar2(l, c);\n" + 
33167
		"	               ^\n" + 
33157
		"	               ^\n" + 
33168
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33158
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33169
		"----------\n" + 
33159
		"----------\n" + 
33170
		"8. WARNING in X.java (at line 5)\n" + 
33160
		"7. WARNING in X.java (at line 5)\n" + 
33171
		"	C<X> cx = bar3(l, c);\n" + 
33161
		"	C<X> cx = bar3(l, c);\n" + 
33172
		"	          ^^^^^^^^^^\n" + 
33162
		"	          ^^^^^^^^^^\n" + 
33173
		"Type safety: Unchecked invocation bar3(L, C<X>) of the generic method bar3(L<T>, C<T>) of type X\n" + 
33163
		"Type safety: Unchecked invocation bar3(L, C<X>) of the generic method bar3(L<T>, C<T>) of type X\n" + 
33174
		"----------\n" + 
33164
		"----------\n" + 
33175
		"9. WARNING in X.java (at line 5)\n" + 
33165
		"8. WARNING in X.java (at line 5)\n" + 
33176
		"	C<X> cx = bar3(l, c);\n" + 
33166
		"	C<X> cx = bar3(l, c);\n" + 
33177
		"	          ^^^^^^^^^^\n" + 
33167
		"	          ^^^^^^^^^^\n" + 
33178
		"Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" + 
33168
		"Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" + 
33179
		"----------\n" + 
33169
		"----------\n" + 
33180
		"10. WARNING in X.java (at line 5)\n" + 
33170
		"9. WARNING in X.java (at line 5)\n" + 
33181
		"	C<X> cx = bar3(l, c);\n" + 
33171
		"	C<X> cx = bar3(l, c);\n" + 
33182
		"	               ^\n" + 
33172
		"	               ^\n" + 
33183
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33173
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
33184
		"----------\n" + 
33174
		"----------\n" + 
33185
		"11. ERROR in X.java (at line 14)\n" + 
33175
		"10. ERROR in X.java (at line 14)\n" + 
33186
		"	return zork;\n" + 
33176
		"	return zork;\n" + 
33187
		"	       ^^^^\n" + 
33177
		"	       ^^^^\n" + 
33188
		"zork cannot be resolved to a variable\n" + 
33178
		"zork cannot be resolved to a variable\n" + 
Lines 33205-33211 Link Here
33205
			"		new X().foo(ls, lx);\n" +
33195
			"		new X().foo(ls, lx);\n" +
33206
			"	}\n" +
33196
			"	}\n" +
33207
			"	void done() {\n" +
33197
			"	void done() {\n" +
33208
			"		System.out.println(\"[done]\");\n" +
33198
			"		System.out.println(zork);\n" +
33209
			"	}\n" +
33199
			"	}\n" +
33210
			"	void foo(List l1, List<X> l2) {\n" +
33200
			"	void foo(List l1, List<X> l2) {\n" +
33211
			"		X x = bar1(l1, l2);\n" +
33201
			"		X x = bar1(l1, l2);\n" +
Lines 33222-33242 Link Here
33222
			"}\n", // =================
33212
			"}\n", // =================
33223
		},
33213
		},
33224
		"----------\n" + 
33214
		"----------\n" + 
33225
		"1. WARNING in X.java (at line 14)\n" + 
33215
		"1. ERROR in X.java (at line 12)\n" + 
33216
		"	System.out.println(zork);\n" + 
33217
		"	                   ^^^^\n" + 
33218
		"zork cannot be resolved to a variable\n" + 
33219
		"----------\n" + 
33220
		"2. WARNING in X.java (at line 14)\n" + 
33226
		"	void foo(List l1, List<X> l2) {\n" + 
33221
		"	void foo(List l1, List<X> l2) {\n" + 
33227
		"	         ^^^^\n" + 
33222
		"	         ^^^^\n" + 
33228
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
33223
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
33229
		"----------\n" + 
33224
		"----------\n" + 
33230
		"2. WARNING in X.java (at line 15)\n" + 
33225
		"3. WARNING in X.java (at line 15)\n" + 
33231
		"	X x = bar1(l1, l2);\n" + 
33226
		"	X x = bar1(l1, l2);\n" + 
33232
		"	      ^^^^^^^^^^^^\n" + 
33227
		"	      ^^^^^^^^^^^^\n" + 
33233
		"Type safety: Unchecked invocation bar1(List, List<X>) of the generic method bar1(List<T>, List<T>) of type X\n" + 
33228
		"Type safety: Unchecked invocation bar1(List, List<X>) of the generic method bar1(List<T>, List<T>) of type X\n" + 
33234
		"----------\n" + 
33229
		"----------\n" + 
33235
		"3. ERROR in X.java (at line 15)\n" + 
33236
		"	X x = bar1(l1, l2);\n" + 
33237
		"	      ^^^^^^^^^^^^\n" + 
33238
		"Type mismatch: cannot convert from Object to X\n" + 
33239
		"----------\n" + 
33240
		"4. WARNING in X.java (at line 15)\n" + 
33230
		"4. WARNING in X.java (at line 15)\n" + 
33241
		"	X x = bar1(l1, l2);\n" + 
33231
		"	X x = bar1(l1, l2);\n" + 
33242
		"	           ^^\n" + 
33232
		"	           ^^\n" + 
Lines 45130-45136 Link Here
45130
			"4. ERROR in X.java (at line 5)\n" + 
45120
			"4. ERROR in X.java (at line 5)\n" + 
45131
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
45121
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
45132
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
45122
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
45133
			"Type mismatch: cannot convert from Bob to String\n" + 
45123
			"Type mismatch: cannot convert from Bob2 to String\n" + 
45134
			"----------\n" + 
45124
			"----------\n" + 
45135
			"5. WARNING in X.java (at line 5)\n" + 
45125
			"5. WARNING in X.java (at line 5)\n" + 
45136
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
45126
			"	String s = x.doStuff2(Bob2.class, new Thingy());\n" + 
Lines 45210-45219 Link Here
45210
			"	                ^^^^^^\n" + 
45200
			"	                ^^^^^^\n" + 
45211
			"Type safety: Unchecked invocation foo(X) of the generic method foo(X<T>) of type X<E>\n" + 
45201
			"Type safety: Unchecked invocation foo(X) of the generic method foo(X<T>) of type X<E>\n" + 
45212
			"----------\n" + 
45202
			"----------\n" + 
45213
			"3. ERROR in X.java (at line 6)\n" + 
45203
			"3. WARNING in X.java (at line 6)\n" + 
45214
			"	X<String> xs2 = foo(x);\n" + 
45204
			"	X<String> xs2 = foo(x);\n" + 
45215
			"	                ^^^^^^\n" + 
45205
			"	                ^^^^^^\n" + 
45216
			"Type mismatch: cannot convert from Object to X<String>\n" + 
45206
			"Type safety: The expression of type X needs unchecked conversion to conform to X<String>\n" + 
45217
			"----------\n" + 
45207
			"----------\n" + 
45218
			"4. WARNING in X.java (at line 6)\n" + 
45208
			"4. WARNING in X.java (at line 6)\n" + 
45219
			"	X<String> xs2 = foo(x);\n" + 
45209
			"	X<String> xs2 = foo(x);\n" + 
Lines 48117-48134 Link Here
48117
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
48107
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
48118
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48108
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48119
			"Type safety: Unchecked invocation method1(Class[]) of the generic method method1(Class<List>[]) of type GenericTest\n" + 
48109
			"Type safety: Unchecked invocation method1(Class[]) of the generic method method1(Class<List>[]) of type GenericTest\n" + 
48120
			"----------\n" + 
48110
			"----------\n" +
48121
			"3. ERROR in GenericTest.java (at line 5)\n" + 
48111
			"3. WARNING in GenericTest.java (at line 5)\n" + 
48122
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
48123
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48124
			"Type mismatch: cannot convert from Object to Set\n" + 
48125
			"----------\n" + 
48126
			"4. WARNING in GenericTest.java (at line 5)\n" + 
48127
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
48112
			"	Set testList = GenericTest.method1(new Class[] { ArrayList.class });\n" + 
48128
			"	                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48113
			"	                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48129
			"Type safety: The expression of type Class[] needs unchecked conversion to conform to Class<List>[]\n" + 
48114
			"Type safety: The expression of type Class[] needs unchecked conversion to conform to Class<List>[]\n" + 
48130
			"----------\n" + 
48115
			"----------\n" + 
48131
			"5. WARNING in GenericTest.java (at line 8)\n" + 
48116
			"4. WARNING in GenericTest.java (at line 8)\n" + 
48132
			"	public static <I> I method1(Class<List>[] params) {\n" + 
48117
			"	public static <I> I method1(Class<List>[] params) {\n" + 
48133
			"	                                  ^^^^\n" + 
48118
			"	                                  ^^^^\n" + 
48134
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
48119
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
Lines 48151-48167 Link Here
48151
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
48136
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
48152
			"Type safety: Unchecked invocation m1(Class) of the generic method m1(Class<Foo>) of type Foo\n" + 
48137
			"Type safety: Unchecked invocation m1(Class) of the generic method m1(Class<Foo>) of type Foo\n" + 
48153
			"----------\n" + 
48138
			"----------\n" + 
48154
			"2. ERROR in Foo.java (at line 4)\n" + 
48139
			"2. WARNING in Foo.java (at line 4)\n" + 
48155
			"	Foo l1 = m1((Class)Foo.class);\n" + 
48156
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
48157
			"Type mismatch: cannot convert from Object to Foo\n" + 
48158
			"----------\n" + 
48159
			"3. WARNING in Foo.java (at line 4)\n" + 
48160
			"	Foo l1 = m1((Class)Foo.class);\n" + 
48140
			"	Foo l1 = m1((Class)Foo.class);\n" + 
48161
			"	            ^^^^^^^^^^^^^^^^\n" + 
48141
			"	            ^^^^^^^^^^^^^^^^\n" + 
48162
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
48142
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
48163
			"----------\n" + 
48143
			"----------\n" + 
48164
			"4. WARNING in Foo.java (at line 4)\n" + 
48144
			"3. WARNING in Foo.java (at line 4)\n" + 
48165
			"	Foo l1 = m1((Class)Foo.class);\n" + 
48145
			"	Foo l1 = m1((Class)Foo.class);\n" + 
48166
			"	             ^^^^^\n" + 
48146
			"	             ^^^^^\n" + 
48167
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
48147
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
Lines 48837-48843 Link Here
48837
			"2. ERROR in X.java (at line 4)\n" + 
48817
			"2. ERROR in X.java (at line 4)\n" + 
48838
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48818
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48839
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48819
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
48840
			"Type mismatch: cannot convert from Object to Integer\n" + 
48820
			"Type mismatch: cannot convert from Foo to Integer\n" + 
48841
			"----------\n" + 
48821
			"----------\n" + 
48842
			"3. WARNING in X.java (at line 4)\n" + 
48822
			"3. WARNING in X.java (at line 4)\n" + 
48843
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
48823
			"	Integer i = m(new Foo<Foo<Integer>>(), new Foo());\n" + 
Lines 49008-49029 Link Here
49008
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
48988
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
49009
			"Type safety: Unchecked invocation m2(Class) of the generic method m2(Class<I>) of type Foo\n" + 
48989
			"Type safety: Unchecked invocation m2(Class) of the generic method m2(Class<I>) of type Foo\n" + 
49010
			"----------\n" + 
48990
			"----------\n" + 
49011
			"2. ERROR in Foo.java (at line 4)\n" + 
48991
			"2. WARNING in Foo.java (at line 4)\n" + 
49012
			"	Foo l2 = m2((Class)Foo.class);\n" + 
49013
			"	         ^^^^^^^^^^^^^^^^^^^^\n" + 
49014
			"Type mismatch: cannot convert from Object to Foo\n" + 
49015
			"----------\n" + 
49016
			"3. WARNING in Foo.java (at line 4)\n" + 
49017
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48992
			"	Foo l2 = m2((Class)Foo.class);\n" + 
49018
			"	            ^^^^^^^^^^^^^^^^\n" + 
48993
			"	            ^^^^^^^^^^^^^^^^\n" + 
49019
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
48994
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<Foo>\n" + 
49020
			"----------\n" + 
48995
			"----------\n" + 
49021
			"4. WARNING in Foo.java (at line 4)\n" + 
48996
			"3. WARNING in Foo.java (at line 4)\n" + 
49022
			"	Foo l2 = m2((Class)Foo.class);\n" + 
48997
			"	Foo l2 = m2((Class)Foo.class);\n" + 
49023
			"	            ^^^^^^^^^^^^^^^^\n" + 
48998
			"	            ^^^^^^^^^^^^^^^^\n" + 
49024
			"Unnecessary cast from Class<Foo> to Class\n" + 
48999
			"Unnecessary cast from Class<Foo> to Class\n" + 
49025
			"----------\n" + 
49000
			"----------\n" + 
49026
			"5. WARNING in Foo.java (at line 4)\n" + 
49001
			"4. WARNING in Foo.java (at line 4)\n" + 
49027
			"	Foo l2 = m2((Class)Foo.class);\n" + 
49002
			"	Foo l2 = m2((Class)Foo.class);\n" + 
49028
			"	             ^^^^^\n" + 
49003
			"	             ^^^^^\n" + 
49029
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
49004
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
Lines 49081-49093 Link Here
49081
			"	foo(l, iae);\n" + 
49056
			"	foo(l, iae);\n" + 
49082
			"	^^^^^^^^^^^\n" + 
49057
			"	^^^^^^^^^^^\n" + 
49083
			"Type safety: Unchecked invocation foo(List, IllegalArgumentException) of the generic method foo(List<U>, T) of type X\n" + 
49058
			"Type safety: Unchecked invocation foo(List, IllegalArgumentException) of the generic method foo(List<U>, T) of type X\n" + 
49084
			"----------\n" + 
49059
			"----------\n" +
49085
			"3. ERROR in X.java (at line 8)\n" + 
49060
			"3. WARNING in X.java (at line 8)\n" + 
49086
			"	foo(l, iae);\n" + 
49087
			"	^^^^^^^^^^^\n" + 
49088
			"Unhandled exception type Throwable\n" + 
49089
			"----------\n" + 
49090
			"4. WARNING in X.java (at line 8)\n" + 
49091
			"	foo(l, iae);\n" + 
49061
			"	foo(l, iae);\n" + 
49092
			"	    ^\n" + 
49062
			"	    ^\n" + 
49093
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
49063
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
Lines 49121-49133 Link Here
49121
			"	new X(l, iae);\n" + 
49091
			"	new X(l, iae);\n" + 
49122
			"	^^^^^^^^^^^^^\n" + 
49092
			"	^^^^^^^^^^^^^\n" + 
49123
			"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + 
49093
			"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + 
49124
			"----------\n" + 
49094
			"----------\n" +
49125
			"3. ERROR in X.java (at line 8)\n" + 
49095
			"3. WARNING in X.java (at line 8)\n" + 
49126
			"	new X(l, iae);\n" + 
49127
			"	^^^^^^^^^^^^^\n" + 
49128
			"Unhandled exception type Throwable\n" + 
49129
			"----------\n" + 
49130
			"4. WARNING in X.java (at line 8)\n" + 
49131
			"	new X(l, iae);\n" + 
49096
			"	new X(l, iae);\n" + 
49132
			"	      ^\n" + 
49097
			"	      ^\n" + 
49133
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
49098
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
Lines 49161-49173 Link Here
49161
			"	new X(l, iae){};\n" + 
49126
			"	new X(l, iae){};\n" + 
49162
			"	^^^^^^^^^^^^^^^\n" + 
49127
			"	^^^^^^^^^^^^^^^\n" + 
49163
			"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + 
49128
			"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" + 
49164
			"----------\n" + 
49129
			"----------\n" +
49165
			"3. ERROR in X.java (at line 8)\n" + 
49130
			"3. WARNING in X.java (at line 8)\n" + 
49166
			"	new X(l, iae){};\n" + 
49167
			"	^^^^^^^^^^^^^^^\n" + 
49168
			"Unhandled exception type Throwable\n" + 
49169
			"----------\n" + 
49170
			"4. WARNING in X.java (at line 8)\n" + 
49171
			"	new X(l, iae){};\n" + 
49131
			"	new X(l, iae){};\n" + 
49172
			"	      ^\n" + 
49132
			"	      ^\n" + 
49173
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
49133
			"Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" + 
Lines 49944-49950 Link Here
49944
			null,
49904
			null,
49945
			null); // no specific success output string
49905
			null); // no specific success output string
49946
}
49906
}
49947
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=295698
49907
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=295698
49948
public void test1459() {
49908
public void test1459() {
49949
	this.runConformTest(
49909
	this.runConformTest(
49950
		new String[] {
49910
		new String[] {
Lines 49964-49967 Link Here
49964
		},
49924
		},
49965
		""); // no specific success output string
49925
		""); // no specific success output string
49966
}
49926
}
49927
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643
49928
public void test277643() {
49929
	this.runNegativeTest(
49930
		new String[] {
49931
	    "Test.java",
49932
	    "public class Test {\n" +
49933
	    "public final void addShortDescription(Object object, StringBuffer buf) {\n" +
49934
	    "	try {\n" +
49935
	    "		W_Description wdescription = get(W_Description.class, object);\n" +
49936
	    "	} catch (Exception e) {\n" +
49937
	    "	}\n" +
49938
	    "}\n" +
49939
	    "public abstract class W_Description<WRAPPED> extends WrapperLogic<WRAPPED> {}\n" +
49940
	    "public <T, W extends WrapperLogic<? super T>> W get(Class<W> wrapperClass, T entity) {\n" +
49941
	    "	return getLogicFactory().get(wrapperClass, entity);\n" +
49942
	    "}\n" +
49943
	    "private LogicFactory logicFactory;\n" +
49944
	    "public final LogicFactory getLogicFactory() {\n" +
49945
	    "	return logicFactory;\n" +
49946
	    "}\n" +
49947
	    "public interface LogicFactory {\n" +
49948
	    "	<LOGIC extends Logic> LOGIC get(Class<LOGIC> logicClass);\n" +
49949
	    "	<WRAPPED, WRAPPER_LOGIC extends WrapperLogic<? super WRAPPED>> WRAPPER_LOGIC get(Class<WRAPPER_LOGIC> wrapperLogicClass, WRAPPED entityToWrap);\n" +
49950
	    "}\n" +
49951
	    "public abstract class WrapperLogic<WRAPPED> extends AbstractLogic implements Wrapper<WRAPPED> {}\n" +
49952
	    "public abstract class AbstractLogic {}\n" +
49953
	    "public interface Wrapper<WRAPPED> {\n" +
49954
	    "	WRAPPED getWrapped();\n" +
49955
	    "}\n" +
49956
	    "public abstract class Logic extends AbstractLogic {}\n" +
49957
	    "}"
49958
		},
49959
		"----------\n" + 
49960
		"1. WARNING in Test.java (at line 4)\n" + 
49961
		"	W_Description wdescription = get(W_Description.class, object);\n" + 
49962
		"	^^^^^^^^^^^^^\n" + 
49963
		"Test.W_Description is a raw type. References to generic type Test.W_Description<WRAPPED> should be parameterized\n" + 
49964
		"----------\n" + 
49965
		"2. WARNING in Test.java (at line 4)\n" + 
49966
		"	W_Description wdescription = get(W_Description.class, object);\n" + 
49967
		"	                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
49968
		"Type safety: Unchecked invocation get(Class<Test.W_Description>, Object) of the generic method get(Class<W>, T) of type Test\n" + 
49969
		"----------\n");
49970
}
49971
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=280054
49972
public void test280054() {
49973
	this.runNegativeTest(
49974
		new String[] {
49975
	    "X.java",
49976
	    "public class X {\n" +
49977
	    "static class A<V> {\n" +
49978
	    "L l;\n" +
49979
	    "public Class<V> vtype() {\n" +
49980
	    "   return null;\n" +
49981
	    "}\n" +
49982
	    "public A<V> method1() {\n" +
49983
	    "   return l.get(vtype(), B.class);\n" +
49984
	    "}\n" +
49985
	    "}\n" +
49986
	    "static class L {\n" +
49987
	    "public <V,S extends A<V>> S get(Class<V> vtype, Class<S> stype) {\n" +
49988
	    "   return null;\n" +
49989
	    "}\n" +
49990
	    "}\n" +
49991
	    "static class B<V> extends A<V> {\n" +
49992
	    "public B<V> method2() {\n" +
49993
	    "   return l.get(vtype(), B.class);\n" +
49994
	    "}\n" +
49995
	    "}\n" +
49996
	    "}\n"
49997
		},
49998
		"----------\n" + 
49999
		"1. WARNING in X.java (at line 8)\n" + 
50000
		"	return l.get(vtype(), B.class);\n" + 
50001
		"	       ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50002
		"Type safety: Unchecked invocation get(Class<V>, Class<X.B>) of the generic method get(Class<V>, Class<S>) of type X.L\n" + 
50003
		"----------\n" + 
50004
		"2. WARNING in X.java (at line 8)\n" + 
50005
		"	return l.get(vtype(), B.class);\n" + 
50006
		"	       ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50007
		"Type safety: The expression of type X.B needs unchecked conversion to conform to X.A<V>\n" + 
50008
		"----------\n" + 
50009
		"3. WARNING in X.java (at line 18)\n" + 
50010
		"	return l.get(vtype(), B.class);\n" + 
50011
		"	       ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50012
		"Type safety: Unchecked invocation get(Class<V>, Class<X.B>) of the generic method get(Class<V>, Class<S>) of type X.L\n" + 
50013
		"----------\n" + 
50014
		"4. WARNING in X.java (at line 18)\n" + 
50015
		"	return l.get(vtype(), B.class);\n" + 
50016
		"	       ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50017
		"Type safety: The expression of type X.B needs unchecked conversion to conform to X.B<V>\n" + 
50018
		"----------\n");
50019
}
50020
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=283306
50021
public void test283306() {
50022
	this.runNegativeTest(
50023
		new String[] {
50024
	    "Test.java",
50025
	    "public class Test {\n" +
50026
	    "    public WWorkflow<? extends Workflow> getMainWorkflow(){\n" +
50027
	    "        return get(WWorkflow.class, null);\n" +
50028
	    "    }\n" +
50029
	    "    public <T, W extends WrapperLogic<? super T>> W get(Class<W> wrapperClass, T entity) {\n" +
50030
	    "        return null;\n" +
50031
	    "    }\n" +
50032
	    "}\n" +
50033
	    "class Workflow {}\n" +
50034
	    "class WWorkflow<T extends Workflow> extends WrapperLogic<T> {}\n" +
50035
	    "abstract class WrapperLogic<WRAPPED> {}\n"
50036
		},
50037
		"----------\n" + 
50038
		"1. WARNING in Test.java (at line 3)\n" + 
50039
		"	return get(WWorkflow.class, null);\n" + 
50040
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50041
		"Type safety: Unchecked invocation get(Class<WWorkflow>, null) of the generic method get(Class<W>, T) of type Test\n" + 
50042
		"----------\n" + 
50043
		"2. WARNING in Test.java (at line 3)\n" + 
50044
		"	return get(WWorkflow.class, null);\n" + 
50045
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50046
		"Type safety: The expression of type WWorkflow needs unchecked conversion to conform to WWorkflow<? extends Workflow>\n" + 
50047
		"----------\n");
50048
}
50049
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=294724
50050
// Test extracted from bug submission code by kabir.khan@jboss.com (Kabir Khan)
50051
public void test294724() {
50052
	this.runNegativeTest(
50053
		new String[] {
50054
	    "SimpleExample.java",
50055
	    "import java.util.Collection;\n" +
50056
	    "import java.util.HashSet;\n" +
50057
	    "import java.util.Set;\n" +
50058
	    "public class SimpleExample {\n" +
50059
	    "  Set<Data> data;\n" +
50060
	    "  public void setData(Set<Data> data) {\n" +
50061
	    "     this.data = data;\n" +
50062
	    "  }\n" +
50063
	    "  public void copy(SimpleExample clone) {\n" +
50064
	    "     clone.setData(cloneCollection(data, HashSet.class, Data.class));\n" +
50065
	    "  }\n" +
50066
	    "	public static <U extends Interface, T extends Collection<U>> T cloneCollection(T collection, Class<? extends T> expectedClass, Class<U> componentType) {\n" +
50067
	    "   	return null;\n" +
50068
	    "   }\n" +
50069
	    "  private interface Interface {}\n" +
50070
	    "  private class Data implements Interface {}\n" +
50071
	    "}"
50072
	    },
50073
		"----------\n" + 
50074
		"1. WARNING in SimpleExample.java (at line 10)\n" + 
50075
		"	clone.setData(cloneCollection(data, HashSet.class, Data.class));\n" + 
50076
		"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50077
		"Type safety: Unchecked invocation cloneCollection(Set<SimpleExample.Data>, Class<HashSet>, Class<SimpleExample.Data>) of the generic method cloneCollection(T, Class<? extends T>, Class<U>) of type SimpleExample\n" + 
50078
		"----------\n" + 
50079
		"2. WARNING in SimpleExample.java (at line 10)\n" + 
50080
		"	clone.setData(cloneCollection(data, HashSet.class, Data.class));\n" + 
50081
		"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50082
		"Type safety: The expression of type Set needs unchecked conversion to conform to Set<SimpleExample.Data>\n" + 
50083
		"----------\n");
50084
}
49967
}
50085
}

Return to bug 277643