View | Details | Raw Unified | Return to bug 292428
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java (-1 / +1 lines)
Lines 330-336 Link Here
330
							ParameterizedTypeBinding paramMatch = (ParameterizedTypeBinding) match;
330
							ParameterizedTypeBinding paramMatch = (ParameterizedTypeBinding) match;
331
							// easy case if less parameters on match
331
							// easy case if less parameters on match
332
							TypeBinding[] castArguments = paramCastType.arguments;
332
							TypeBinding[] castArguments = paramCastType.arguments;
333
							int length = castArguments.length;
333
							int length = castArguments == null ? 0 : castArguments.length;
334
							if (paramMatch.arguments == null || length > paramMatch.arguments.length) {
334
							if (paramMatch.arguments == null || length > paramMatch.arguments.length) {
335
								this.bits |= ASTNode.UnsafeCast;
335
								this.bits |= ASTNode.UnsafeCast;
336
							} else if ((paramCastType.tagBits & (TagBits.HasDirectWildcard|TagBits.HasTypeVariable)) != 0) {
336
							} else if ((paramCastType.tagBits & (TagBits.HasDirectWildcard|TagBits.HasTypeVariable)) != 0) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-124 / +147 lines)
Lines 31-37 Link Here
31
	// All specified tests which does not belong to the class are skipped...
31
	// All specified tests which does not belong to the class are skipped...
32
	static {
32
	static {
33
//		TESTS_NAMES = new String[] { "test0788" };
33
//		TESTS_NAMES = new String[] { "test0788" };
34
//		TESTS_NUMBERS = new int[] { 1367, 1368, 1369 };
34
//		TESTS_NUMBERS = new int[] { 1456 };
35
//		TESTS_RANGE = new int[] { 1097, -1 };
35
//		TESTS_RANGE = new int[] { 1097, -1 };
36
	}
36
	}
37
	public static Test suite() {
37
	public static Test suite() {
Lines 35007-35030 Link Here
35007
	this.runNegativeTest(
35007
	this.runNegativeTest(
35008
		new String[] {
35008
		new String[] {
35009
			"X.java",
35009
			"X.java",
35010
			"import java.lang.annotation.Retention;\r\n" +
35010
			"import java.lang.annotation.Retention;\n" +
35011
			"import java.lang.annotation.RetentionPolicy;\r\n" +
35011
			"import java.lang.annotation.RetentionPolicy;\n" +
35012
			"import java.lang.reflect.Method;\r\n" +
35012
			"import java.lang.reflect.Method;\n" +
35013
			"\r\n" +
35013
			"\n" +
35014
			"@Bar\r\n" +
35014
			"@Bar\n" +
35015
			"public class X {\r\n" +
35015
			"public class X {\n" +
35016
			"\r\n" +
35016
			"\n" +
35017
			"        @Bar\r\n" +
35017
			"        @Bar\n" +
35018
			"        public void bar() throws Exception {\r\n" +
35018
			"        public void bar() throws Exception {\n" +
35019
			"                Class clazz= X.class;\r\n" +
35019
			"                Class clazz= X.class;\n" +
35020
			"                Bar bar= clazz.getAnnotation(Bar.class);\n" +
35020
			"                Bar bar= clazz.getAnnotation(Bar.class);\n" +
35021
			"                Method method= clazz.getMethod(\"bar\");\r\n" +
35021
			"                Method method= clazz.getMethod(\"bar\");\n" +
35022
			"                Bar bar2= method.getAnnotation(Bar.class);\r\n" +
35022
			"                Bar bar2= method.getAnnotation(Bar.class);\n" +
35023
			"        }\r\n" +
35023
			"        }\n" +
35024
			"}\r\n" +
35024
			"}\n" +
35025
			"\r\n" +
35025
			"\n" +
35026
			"@Retention(RetentionPolicy.RUNTIME)\r\n" +
35026
			"@Retention(RetentionPolicy.RUNTIME)\n" +
35027
			"@interface Bar {\r\n" +
35027
			"@interface Bar {\n" +
35028
			"}",
35028
			"}",
35029
		},
35029
		},
35030
		expectedOutput,
35030
		expectedOutput,
Lines 35037-35060 Link Here
35037
	this.runConformTest(
35037
	this.runConformTest(
35038
		new String[] {
35038
		new String[] {
35039
			"X.java",
35039
			"X.java",
35040
			"import java.lang.annotation.Retention;\r\n" +
35040
			"import java.lang.annotation.Retention;\n" +
35041
			"import java.lang.annotation.RetentionPolicy;\r\n" +
35041
			"import java.lang.annotation.RetentionPolicy;\n" +
35042
			"import java.lang.reflect.Method;\r\n" +
35042
			"import java.lang.reflect.Method;\n" +
35043
			"\r\n" +
35043
			"\n" +
35044
			"@Bar\r\n" +
35044
			"@Bar\n" +
35045
			"public class X {\r\n" +
35045
			"public class X {\n" +
35046
			"\r\n" +
35046
			"\n" +
35047
			"        @Bar\r\n" +
35047
			"        @Bar\n" +
35048
			"        public void bar() throws Exception {\r\n" +
35048
			"        public void bar() throws Exception {\n" +
35049
			"                Class<X> clazz= X.class;\r\n" +
35049
			"                Class<X> clazz= X.class;\n" +
35050
			"                Bar bar= clazz.getAnnotation(Bar.class);\n" +
35050
			"                Bar bar= clazz.getAnnotation(Bar.class);\n" +
35051
			"                Method method= clazz.getMethod(\"bar\");\r\n" +
35051
			"                Method method= clazz.getMethod(\"bar\");\n" +
35052
			"                Bar bar2= method.getAnnotation(Bar.class);\r\n" +
35052
			"                Bar bar2= method.getAnnotation(Bar.class);\n" +
35053
			"        }\r\n" +
35053
			"        }\n" +
35054
			"}\r\n" +
35054
			"}\n" +
35055
			"\r\n" +
35055
			"\n" +
35056
			"@Retention(RetentionPolicy.RUNTIME)\r\n" +
35056
			"@Retention(RetentionPolicy.RUNTIME)\n" +
35057
			"@interface Bar {\r\n" +
35057
			"@interface Bar {\n" +
35058
			"}",
35058
			"}",
35059
		},
35059
		},
35060
		"");
35060
		"");
Lines 36915-36989 Link Here
36915
	this.runConformTest(
36915
	this.runConformTest(
36916
		new String[] {
36916
		new String[] {
36917
			"Class_01.java",
36917
			"Class_01.java",
36918
			"public interface Class_01<H extends Class_02<? extends Class_01>> extends\r\n" +
36918
			"public interface Class_01<H extends Class_02<? extends Class_01>> extends\n" +
36919
			"		Class_09<H> {\r\n" +
36919
			"		Class_09<H> {\n" +
36920
			"}",
36920
			"}",
36921
			"Class_02.java",
36921
			"Class_02.java",
36922
			"public interface Class_02<E extends Class_01<? extends Class_02>> extends\r\n" +
36922
			"public interface Class_02<E extends Class_01<? extends Class_02>> extends\n" +
36923
			"		Class_10<E> {\r\n" +
36923
			"		Class_10<E> {\n" +
36924
			"}",
36924
			"}",
36925
			"Class_03.java",
36925
			"Class_03.java",
36926
			"public abstract class Class_03<E extends Class_01<? super H>, H extends Class_02<? super E>, P extends Class_06<? extends Class_07>>\r\n" +
36926
			"public abstract class Class_03<E extends Class_01<? super H>, H extends Class_02<? super E>, P extends Class_06<? extends Class_07>>\n" +
36927
			"		extends Class_08<E, H, P> implements Class_05 {\r\n" +
36927
			"		extends Class_08<E, H, P> implements Class_05 {\n" +
36928
			"}",
36928
			"}",
36929
			"Class_04.java",
36929
			"Class_04.java",
36930
			"public interface Class_04 extends Class_06<Class_18>, Class_19{\r\n" +
36930
			"public interface Class_04 extends Class_06<Class_18>, Class_19{\n" +
36931
			"}",
36931
			"}",
36932
			"Class_05.java",
36932
			"Class_05.java",
36933
			"public interface Class_05{\r\n" +
36933
			"public interface Class_05{\n" +
36934
			"}",
36934
			"}",
36935
			"Class_06.java",
36935
			"Class_06.java",
36936
			"public interface Class_06<H extends Class_07<? extends Class_06>> extends\r\n" +
36936
			"public interface Class_06<H extends Class_07<? extends Class_06>> extends\n" +
36937
			"		Class_13<H, Class_12>, Class_17 {\r\n" +
36937
			"		Class_13<H, Class_12>, Class_17 {\n" +
36938
			"}",
36938
			"}",
36939
			"Class_07.java",
36939
			"Class_07.java",
36940
			"public interface Class_07<P extends Class_06<? extends Class_07>> extends\r\n" +
36940
			"public interface Class_07<P extends Class_06<? extends Class_07>> extends\n" +
36941
			"		Class_14<P, Class_12> {\r\n" +
36941
			"		Class_14<P, Class_12> {\n" +
36942
			"}",
36942
			"}",
36943
			"Class_08.java",
36943
			"Class_08.java",
36944
			"public abstract class Class_08<E extends Class_09<? super H>, H extends Class_10<? super E>, P extends Class_06<? extends Class_07>>\r\n" +
36944
			"public abstract class Class_08<E extends Class_09<? super H>, H extends Class_10<? super E>, P extends Class_06<? extends Class_07>>\n" +
36945
			"		extends Class_11<E, H, Class_12> implements Class_05 {\r\n" +
36945
			"		extends Class_11<E, H, Class_12> implements Class_05 {\n" +
36946
			"}",
36946
			"}",
36947
			"Class_09.java",
36947
			"Class_09.java",
36948
			"public interface Class_09<H extends Class_10<? extends Class_09>> extends\r\n" +
36948
			"public interface Class_09<H extends Class_10<? extends Class_09>> extends\n" +
36949
			"		Class_13<H, Class_12>, Class_17 {\r\n" +
36949
			"		Class_13<H, Class_12>, Class_17 {\n" +
36950
			"}",
36950
			"}",
36951
			"Class_10.java",
36951
			"Class_10.java",
36952
			"public interface Class_10<E extends Class_09<? extends Class_10>> extends\r\n" +
36952
			"public interface Class_10<E extends Class_09<? extends Class_10>> extends\n" +
36953
			"		Class_14<E, Class_12> {\r\n" +
36953
			"		Class_14<E, Class_12> {\n" +
36954
			"}",
36954
			"}",
36955
			"Class_11.java",
36955
			"Class_11.java",
36956
			"public abstract class Class_11<E extends Class_13<? super H, O>, H extends Class_14<? super E, O>, O>\r\n" +
36956
			"public abstract class Class_11<E extends Class_13<? super H, O>, H extends Class_14<? super E, O>, O>\n" +
36957
			"		extends Class_15<E, H, O> implements Class_05 {\r\n" +
36957
			"		extends Class_15<E, H, O> implements Class_05 {\n" +
36958
			"}",
36958
			"}",
36959
			"Class_12.java",
36959
			"Class_12.java",
36960
			"public final class Class_12 {\r\n" +
36960
			"public final class Class_12 {\n" +
36961
			"}",
36961
			"}",
36962
			"Class_13.java",
36962
			"Class_13.java",
36963
			"public interface Class_13<H extends Class_14<?, O>, O>{\r\n" +
36963
			"public interface Class_13<H extends Class_14<?, O>, O>{\n" +
36964
			"}",
36964
			"}",
36965
			"Class_14.java",
36965
			"Class_14.java",
36966
			"public interface Class_14<E extends Class_13<?, O>, O>{\r\n" +
36966
			"public interface Class_14<E extends Class_13<?, O>, O>{\n" +
36967
			"}",
36967
			"}",
36968
			"Class_15.java",
36968
			"Class_15.java",
36969
			"public abstract class Class_15<E extends Class_13<? super H, O>, H extends Class_14<? super E, O>, O>\r\n" +
36969
			"public abstract class Class_15<E extends Class_13<? super H, O>, H extends Class_14<? super E, O>, O>\n" +
36970
			"		extends Class_16 {\r\n" +
36970
			"		extends Class_16 {\n" +
36971
			"}",
36971
			"}",
36972
			"Class_16.java",
36972
			"Class_16.java",
36973
			"public abstract class Class_16{\r\n" +
36973
			"public abstract class Class_16{\n" +
36974
			"}",
36974
			"}",
36975
			"Class_17.java",
36975
			"Class_17.java",
36976
			"public interface Class_17{\r\n" +
36976
			"public interface Class_17{\n" +
36977
			"}",
36977
			"}",
36978
			"Class_18.java",
36978
			"Class_18.java",
36979
			"public interface Class_18 extends Class_07<Class_04>{\r\n" +
36979
			"public interface Class_18 extends Class_07<Class_04>{\n" +
36980
			"}",
36980
			"}",
36981
			"Class_19.java",
36981
			"Class_19.java",
36982
			"public interface Class_19{\r\n" +
36982
			"public interface Class_19{\n" +
36983
			"}",
36983
			"}",
36984
			"MyClass.java",
36984
			"MyClass.java",
36985
			"abstract class MyClass<E extends Class_01<? super H>, H extends Class_02<? super E>>\r\n" +
36985
			"abstract class MyClass<E extends Class_01<? super H>, H extends Class_02<? super E>>\n" +
36986
			"		extends Class_03<E, H, Class_04> implements Class_05 {\r\n" +
36986
			"		extends Class_03<E, H, Class_04> implements Class_05 {\n" +
36987
			"}"
36987
			"}"
36988
		},
36988
		},
36989
		"",
36989
		"",
Lines 36997-37004 Link Here
36997
	this.runConformTest(
36997
	this.runConformTest(
36998
			new String[] {
36998
			new String[] {
36999
					"Class_01.java",
36999
					"Class_01.java",
37000
					"public interface Class_01<H extends Class_02<? extends Class_01>> extends\r\n" +
37000
					"public interface Class_01<H extends Class_02<? extends Class_01>> extends\n" +
37001
					"		Class_09<H> {\r\n" +
37001
					"		Class_09<H> {\n" +
37002
					"}",
37002
					"}",
37003
			},
37003
			},
37004
			"",
37004
			"",
Lines 38020-38026 Link Here
38020
		new String[] {
38020
		new String[] {
38021
			"X.java",
38021
			"X.java",
38022
			"public class X<T> {\n" +
38022
			"public class X<T> {\n" +
38023
			"	void foo() {\r\n" +
38023
			"	void foo() {\n" +
38024
			"		System.out.println(T[].class);\n" +
38024
			"		System.out.println(T[].class);\n" +
38025
			"	}\n" +
38025
			"	}\n" +
38026
			"}", // =================
38026
			"}", // =================
Lines 38038-38044 Link Here
38038
		new String[] {
38038
		new String[] {
38039
			"X.java",
38039
			"X.java",
38040
			"public class X {\n" +
38040
			"public class X {\n" +
38041
			"	<T> void foo() {\r\n" +
38041
			"	<T> void foo() {\n" +
38042
			"		System.out.println(T[].class);\n" +
38042
			"		System.out.println(T[].class);\n" +
38043
			"	}\n" +
38043
			"	}\n" +
38044
			"}", // =================
38044
			"}", // =================
Lines 38766-38773 Link Here
38766
			"}", // =================
38766
			"}", // =================
38767
		},
38767
		},
38768
		"----------\n" +
38768
		"----------\n" +
38769
		"1. ERROR in p\\X.java (at line 9)\r\n" +
38769
		"1. ERROR in p\\X.java (at line 9)\n" +
38770
		"	public class X extends Super<A<X>> {\r\n" +
38770
		"	public class X extends Super<A<X>> {\n" +
38771
		"	                       ^^^^^\n" +
38771
		"	                       ^^^^^\n" +
38772
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" +
38772
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" +
38773
		"----------\n"
38773
		"----------\n"
Lines 38792-38804 Link Here
38792
			"}", // =================
38792
			"}", // =================
38793
		},
38793
		},
38794
		"----------\n" +
38794
		"----------\n" +
38795
		"1. ERROR in p\\X.java (at line 2)\r\n" +
38795
		"1. ERROR in p\\X.java (at line 2)\n" +
38796
		"	import static p.X.Super;\r\n" +
38796
		"	import static p.X.Super;\n" +
38797
		"	              ^^^^^^^^^\n" +
38797
		"	              ^^^^^^^^^\n" +
38798
		"The import p.X.Super cannot be resolved\n" +
38798
		"The import p.X.Super cannot be resolved\n" +
38799
		"----------\n" +
38799
		"----------\n" +
38800
		"2. ERROR in p\\X.java (at line 9)\r\n" +
38800
		"2. ERROR in p\\X.java (at line 9)\n" +
38801
		"	public class X extends Super<A<X>> {\r\n" +
38801
		"	public class X extends Super<A<X>> {\n" +
38802
		"	                       ^^^^^\n" +
38802
		"	                       ^^^^^\n" +
38803
		"Super cannot be resolved to a type\n" +
38803
		"Super cannot be resolved to a type\n" +
38804
		"----------\n");
38804
		"----------\n");
Lines 38821-38828 Link Here
38821
			"}", // =================
38821
			"}", // =================
38822
		},
38822
		},
38823
		"----------\n" +
38823
		"----------\n" +
38824
		"1. ERROR in p\\X.java (at line 8)\r\n" +
38824
		"1. ERROR in p\\X.java (at line 8)\n" +
38825
		"	public class X extends p.X.Super<A<X>> {\r\n" +
38825
		"	public class X extends p.X.Super<A<X>> {\n" +
38826
		"	                       ^^^^^^^^^\n" +
38826
		"	                       ^^^^^^^^^\n" +
38827
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" +
38827
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" +
38828
		"----------\n");
38828
		"----------\n");
Lines 39527-39539 Link Here
39527
			"}\n", // =================
39527
			"}\n", // =================
39528
		},
39528
		},
39529
		"----------\n" +
39529
		"----------\n" +
39530
		"1. ERROR in X.java (at line 3)\r\n" +
39530
		"1. ERROR in X.java (at line 3)\n" +
39531
		"	public class X<V extends Z<V>> extends Z<V>{\r\n" +
39531
		"	public class X<V extends Z<V>> extends Z<V>{\n" +
39532
		"	                           ^\n" +
39532
		"	                           ^\n" +
39533
		"Bound mismatch: The type V is not a valid substitute for the bounded parameter <U extends Y<U>> of the type Z<U>\n" +
39533
		"Bound mismatch: The type V is not a valid substitute for the bounded parameter <U extends Y<U>> of the type Z<U>\n" +
39534
		"----------\n" +
39534
		"----------\n" +
39535
		"2. ERROR in X.java (at line 3)\r\n" +
39535
		"2. ERROR in X.java (at line 3)\n" +
39536
		"	public class X<V extends Z<V>> extends Z<V>{\r\n" +
39536
		"	public class X<V extends Z<V>> extends Z<V>{\n" +
39537
		"	                                         ^\n" +
39537
		"	                                         ^\n" +
39538
		"Bound mismatch: The type V is not a valid substitute for the bounded parameter <U extends Y<U>> of the type Z<U>\n" +
39538
		"Bound mismatch: The type V is not a valid substitute for the bounded parameter <U extends Y<U>> of the type Z<U>\n" +
39539
		"----------\n");
39539
		"----------\n");
Lines 40841-40863 Link Here
40841
			"}\n", // =================
40841
			"}\n", // =================
40842
		},
40842
		},
40843
		"----------\n" +
40843
		"----------\n" +
40844
		"1. ERROR in X.java (at line 12)\r\n" +
40844
		"1. ERROR in X.java (at line 12)\n" +
40845
		"	return make(type, value);//1\r\n" +
40845
		"	return make(type, value);//1\n" +
40846
		"	       ^^^^^^^^^^^^^^^^^\n" +
40846
		"	       ^^^^^^^^^^^^^^^^^\n" +
40847
		"Type mismatch: cannot convert from X.Map<Class<capture#1-of ?>,X> to X.Map<Class<?>,X>\n" +
40847
		"Type mismatch: cannot convert from X.Map<Class<capture#1-of ?>,X> to X.Map<Class<?>,X>\n" +
40848
		"----------\n" +
40848
		"----------\n" +
40849
		"2. ERROR in X.java (at line 17)\r\n" +
40849
		"2. ERROR in X.java (at line 17)\n" +
40850
		"	return (Map<Class<?>, X>) make(type, value);//2\r\n" +
40850
		"	return (Map<Class<?>, X>) make(type, value);//2\n" +
40851
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
40851
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
40852
		"Cannot cast from X.Map<Class<capture#2-of ?>,X> to X.Map<Class<?>,X>\n" +
40852
		"Cannot cast from X.Map<Class<capture#2-of ?>,X> to X.Map<Class<?>,X>\n" +
40853
		"----------\n" +
40853
		"----------\n" +
40854
		"3. ERROR in X.java (at line 21)\r\n" +
40854
		"3. ERROR in X.java (at line 21)\n" +
40855
		"	return make(X.class, value);//3\r\n" +
40855
		"	return make(X.class, value);//3\n" +
40856
		"	       ^^^^^^^^^^^^^^^^^^^^\n" +
40856
		"	       ^^^^^^^^^^^^^^^^^^^^\n" +
40857
		"Type mismatch: cannot convert from X.Map<Class<X>,X> to X.Map<Class<?>,X>\n" +
40857
		"Type mismatch: cannot convert from X.Map<Class<X>,X> to X.Map<Class<?>,X>\n" +
40858
		"----------\n" +
40858
		"----------\n" +
40859
		"4. ERROR in X.java (at line 25)\r\n" +
40859
		"4. ERROR in X.java (at line 25)\n" +
40860
		"	return (Map<Class<?>, X>) make(X.class, value);//4\r\n" +
40860
		"	return (Map<Class<?>, X>) make(X.class, value);//4\n" +
40861
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
40861
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
40862
		"Cannot cast from X.Map<Class<X>,X> to X.Map<Class<?>,X>\n" +
40862
		"Cannot cast from X.Map<Class<X>,X> to X.Map<Class<?>,X>\n" +
40863
		"----------\n");
40863
		"----------\n");
Lines 41289-41296 Link Here
41289
			"}\n", // =================
41289
			"}\n", // =================
41290
		},
41290
		},
41291
		"----------\n" +
41291
		"----------\n" +
41292
		"1. ERROR in X.java (at line 6)\r\n" +
41292
		"1. ERROR in X.java (at line 6)\n" +
41293
		"	throwE(objs);\r\n" +
41293
		"	throwE(objs);\n" +
41294
		"	^^^^^^\n" +
41294
		"	^^^^^^\n" +
41295
		"Bound mismatch: The generic method throwE(E) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" +
41295
		"Bound mismatch: The generic method throwE(E) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" +
41296
		"----------\n");
41296
		"----------\n");
Lines 41328-41335 Link Here
41328
			"}", // =================
41328
			"}", // =================
41329
		},
41329
		},
41330
		"----------\n" +
41330
		"----------\n" +
41331
		"1. ERROR in X.java (at line 6)\r\n" +
41331
		"1. ERROR in X.java (at line 6)\n" +
41332
		"	throwE(objs);\r\n" +
41332
		"	throwE(objs);\n" +
41333
		"	^^^^^^\n" +
41333
		"	^^^^^^\n" +
41334
		"Bound mismatch: The generic method throwE(E, Object...) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" +
41334
		"Bound mismatch: The generic method throwE(E, Object...) of type X is not applicable for the arguments (Object[]). The inferred type Object[] is not a valid substitute for the bounded parameter <E extends Exception>\n" +
41335
		"----------\n");
41335
		"----------\n");
Lines 41955-41962 Link Here
41955
			"}\n"
41955
			"}\n"
41956
		},
41956
		},
41957
		"----------\n" +
41957
		"----------\n" +
41958
		"1. ERROR in X.java (at line 7)\r\n" +
41958
		"1. ERROR in X.java (at line 7)\n" +
41959
		"	Zork z;\r\n" +
41959
		"	Zork z;\n" +
41960
		"	^^^^\n" +
41960
		"	^^^^\n" +
41961
		"Zork cannot be resolved to a type\n" +
41961
		"Zork cannot be resolved to a type\n" +
41962
		"----------\n");
41962
		"----------\n");
Lines 42782-42794 Link Here
42782
				"}\n", // =================
42782
				"}\n", // =================
42783
		},
42783
		},
42784
		"----------\n" +
42784
		"----------\n" +
42785
		"1. ERROR in X.java (at line 2)\r\n" +
42785
		"1. ERROR in X.java (at line 2)\n" +
42786
		"	Zork z;\r\n" +
42786
		"	Zork z;\n" +
42787
		"	^^^^\n" +
42787
		"	^^^^\n" +
42788
		"Zork cannot be resolved to a type\n" +
42788
		"Zork cannot be resolved to a type\n" +
42789
		"----------\n" +
42789
		"----------\n" +
42790
		"2. WARNING in X.java (at line 10)\r\n" +
42790
		"2. WARNING in X.java (at line 10)\n" +
42791
		"	C<String> c = getB().getC();\r\n" +
42791
		"	C<String> c = getB().getC();\n" +
42792
		"	              ^^^^^^^^^^^^^\n" +
42792
		"	              ^^^^^^^^^^^^^\n" +
42793
		"Type safety: The expression of type C needs unchecked conversion to conform to C<String>\n" +
42793
		"Type safety: The expression of type C needs unchecked conversion to conform to C<String>\n" +
42794
		"----------\n");
42794
		"----------\n");
Lines 42820-42827 Link Here
42820
				"}\n", // =================
42820
				"}\n", // =================
42821
		},
42821
		},
42822
		"----------\n" +
42822
		"----------\n" +
42823
		"1. ERROR in X.java (at line 2)\r\n" +
42823
		"1. ERROR in X.java (at line 2)\n" +
42824
		"	Zork z;\r\n" +
42824
		"	Zork z;\n" +
42825
		"	^^^^\n" +
42825
		"	^^^^\n" +
42826
		"Zork cannot be resolved to a type\n" +
42826
		"Zork cannot be resolved to a type\n" +
42827
		"----------\n");
42827
		"----------\n");
Lines 43020-43032 Link Here
43020
				"}\n", // =================
43020
				"}\n", // =================
43021
		},
43021
		},
43022
		"----------\n" +
43022
		"----------\n" +
43023
		"1. ERROR in X.java (at line 5)\r\n" +
43023
		"1. ERROR in X.java (at line 5)\n" +
43024
		"	static XList<Sub<?>> LIST = asList(ARRAY); \r\n" +
43024
		"	static XList<Sub<?>> LIST = asList(ARRAY); \n" +
43025
		"	                            ^^^^^^^^^^^^^\n" +
43025
		"	                            ^^^^^^^^^^^^^\n" +
43026
		"Type mismatch: cannot convert from XList<X.Foo.Sub<? super Number>> to XList<X.Foo.Sub<?>>\n" +
43026
		"Type mismatch: cannot convert from XList<X.Foo.Sub<? super Number>> to XList<X.Foo.Sub<?>>\n" +
43027
		"----------\n" +
43027
		"----------\n" +
43028
		"2. WARNING in X.java (at line 7)\r\n" +
43028
		"2. WARNING in X.java (at line 7)\n" +
43029
		"	static Sub<? super Number>[] ARRAY = new Sub[] { };\r\n" +
43029
		"	static Sub<? super Number>[] ARRAY = new Sub[] { };\n" +
43030
		"	                                     ^^^^^^^^^^^^^\n" +
43030
		"	                                     ^^^^^^^^^^^^^\n" +
43031
		"Type safety: The expression of type X.Foo.Sub[] needs unchecked conversion to conform to X.Foo.Sub<? super Number>[]\n" +
43031
		"Type safety: The expression of type X.Foo.Sub[] needs unchecked conversion to conform to X.Foo.Sub<? super Number>[]\n" +
43032
		"----------\n");
43032
		"----------\n");
Lines 43050-43057 Link Here
43050
				"}\n", // =================
43050
				"}\n", // =================
43051
		},
43051
		},
43052
		"----------\n" +
43052
		"----------\n" +
43053
		"1. ERROR in X.java (at line 5)\r\n" +
43053
		"1. ERROR in X.java (at line 5)\n" +
43054
		"	static XList<Sub<? super Number>> LIST = asList(ARRAY); \r\n" +
43054
		"	static XList<Sub<? super Number>> LIST = asList(ARRAY); \n" +
43055
		"	                                         ^^^^^^^^^^^^^\n" +
43055
		"	                                         ^^^^^^^^^^^^^\n" +
43056
		"Type mismatch: cannot convert from XList<X.Foo.Sub<?>> to XList<X.Foo.Sub<? super Number>>\n" +
43056
		"Type mismatch: cannot convert from XList<X.Foo.Sub<?>> to XList<X.Foo.Sub<? super Number>>\n" +
43057
		"----------\n");
43057
		"----------\n");
Lines 43661-43668 Link Here
43661
					"}", // =================
43661
					"}", // =================
43662
			},
43662
			},
43663
			"----------\n" +
43663
			"----------\n" +
43664
			"1. ERROR in X.java (at line 8)\r\n" +
43664
			"1. ERROR in X.java (at line 8)\n" +
43665
			"	combine(too, oo);\r\n" +
43665
			"	combine(too, oo);\n" +
43666
			"	^^^^^^^\n" +
43666
			"	^^^^^^^\n" +
43667
			"The method combine(X.TT, X.TO<? super E>) in the type X is not applicable for the arguments (X.TO<capture#1-of ? super String>, X.OO<String,Object>)\n" +
43667
			"The method combine(X.TT, X.TO<? super E>) in the type X is not applicable for the arguments (X.TO<capture#1-of ? super String>, X.OO<String,Object>)\n" +
43668
			"----------\n");
43668
			"----------\n");
Lines 43684-43691 Link Here
43684
					"}", // =================
43684
					"}", // =================
43685
			},
43685
			},
43686
			"----------\n" +
43686
			"----------\n" +
43687
			"1. ERROR in X.java (at line 8)\r\n" +
43687
			"1. ERROR in X.java (at line 8)\n" +
43688
			"	combine(too, oo);\r\n" +
43688
			"	combine(too, oo);\n" +
43689
			"	^^^^^^^\n" +
43689
			"	^^^^^^^\n" +
43690
			"The method combine(X.TT[], X.TO<? super E>[]) in the type X is not applicable for the arguments (X.TO<? super String>[], X.OO<String,Object>[])\n" +
43690
			"The method combine(X.TT[], X.TO<? super E>[]) in the type X is not applicable for the arguments (X.TO<? super String>[], X.OO<String,Object>[])\n" +
43691
			"----------\n");
43691
			"----------\n");
Lines 44128-44150 Link Here
44128
					"class Song {}\n", // =================
44128
					"class Song {}\n", // =================
44129
			},
44129
			},
44130
			"----------\n" +
44130
			"----------\n" +
44131
			"1. WARNING in X.java (at line 7)\r\n" +
44131
			"1. WARNING in X.java (at line 7)\n" +
44132
			"	java.util.List<Counter<?>> list1 = java.util.Arrays.asList(songCounter, genreCounter);\r\n" +
44132
			"	java.util.List<Counter<?>> list1 = java.util.Arrays.asList(songCounter, genreCounter);\n" +
44133
			"	                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44133
			"	                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44134
			"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" +
44134
			"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" +
44135
			"----------\n" +
44135
			"----------\n" +
44136
			"2. WARNING in X.java (at line 8)\r\n" +
44136
			"2. WARNING in X.java (at line 8)\n" +
44137
			"	java.util.List<Counter<? extends Object>> list2 = java.util.Arrays.asList(songCounter, genreCounter);\r\n" +
44137
			"	java.util.List<Counter<? extends Object>> list2 = java.util.Arrays.asList(songCounter, genreCounter);\n" +
44138
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44138
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44139
			"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" +
44139
			"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" +
44140
			"----------\n" +
44140
			"----------\n" +
44141
			"3. WARNING in X.java (at line 11)\r\n" +
44141
			"3. WARNING in X.java (at line 11)\n" +
44142
			"	java.util.List<Counter<? extends String>> list5 = java.util.Arrays.asList(songCounter, genreCounter);\r\n" +
44142
			"	java.util.List<Counter<? extends String>> list5 = java.util.Arrays.asList(songCounter, genreCounter);\n" +
44143
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44143
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44144
			"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" +
44144
			"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" +
44145
			"----------\n" +
44145
			"----------\n" +
44146
			"4. ERROR in X.java (at line 11)\r\n" +
44146
			"4. ERROR in X.java (at line 11)\n" +
44147
			"	java.util.List<Counter<? extends String>> list5 = java.util.Arrays.asList(songCounter, genreCounter);\r\n" +
44147
			"	java.util.List<Counter<? extends String>> list5 = java.util.Arrays.asList(songCounter, genreCounter);\n" +
44148
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44148
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
44149
			"Type mismatch: cannot convert from List<Deejay.Counter<? extends Object>> to List<Deejay.Counter<? extends String>>\n" +
44149
			"Type mismatch: cannot convert from List<Deejay.Counter<? extends Object>> to List<Deejay.Counter<? extends String>>\n" +
44150
			"----------\n");
44150
			"----------\n");
Lines 45588-45595 Link Here
45588
				"}\n", // =================
45588
				"}\n", // =================
45589
			},
45589
			},
45590
			"----------\n" +
45590
			"----------\n" +
45591
			"1. ERROR in X.java (at line 3)\r\n" +
45591
			"1. ERROR in X.java (at line 3)\n" +
45592
			"	Other<String>.Member m = (Other<String>.Member) om2;\r\n" +
45592
			"	Other<String>.Member m = (Other<String>.Member) om2;\n" +
45593
			"	                         ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
45593
			"	                         ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
45594
			"Cannot cast from Other2<?>.Member2<capture#1-of ?> to Other<String>.Member\n" +
45594
			"Cannot cast from Other2<?>.Member2<capture#1-of ?> to Other<String>.Member\n" +
45595
			"----------\n");
45595
			"----------\n");
Lines 45613-45620 Link Here
45613
				"}\n", // =================
45613
				"}\n", // =================
45614
			},
45614
			},
45615
			"----------\n" +
45615
			"----------\n" +
45616
			"1. ERROR in X.java (at line 3)\r\n" +
45616
			"1. ERROR in X.java (at line 3)\n" +
45617
			"	Other<String>.Member m = (Other<String>.Member) om2;\r\n" +
45617
			"	Other<String>.Member m = (Other<String>.Member) om2;\n" +
45618
			"	                         ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
45618
			"	                         ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
45619
			"Cannot cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" +
45619
			"Cannot cast from Other2.Member2<capture#1-of ?> to Other<String>.Member\n" +
45620
			"----------\n");
45620
			"----------\n");
Lines 49861-49864 Link Here
49861
		"----------\n"
49861
		"----------\n"
49862
	);
49862
	);
49863
}
49863
}
49864
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=292428
49865
public void test1456() {
49866
	this.runConformTest(
49867
		new String[] {
49868
			"X.java",
49869
			"import java.util.ArrayList;\n" + 
49870
			"\n" + 
49871
			"public class X<K,V> {\n" + 
49872
			"	interface E<V> {}\n" + 
49873
			"	class S implements E<V> {\n" + 
49874
			"		V value;\n" + 
49875
			"	}\n" + 
49876
			"	class M implements E<V>  {\n" + 
49877
			"		ArrayList<V> list = new ArrayList<V>();\n" + 
49878
			"		M(E<V> se) {\n" + 
49879
			"			list.add(((S)se).value);\n" + 
49880
			"		}\n" + 
49881
			"	}\n" + 
49882
			"}"
49883
		},
49884
		""
49885
	);
49886
}
49864
}
49887
}

Return to bug 292428