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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/performance/AllPerformanceTests.java (+1 lines)
Lines 38-43 Link Here
38
			FullSourceWorkspaceTypeHierarchyTests.class,
38
			FullSourceWorkspaceTypeHierarchyTests.class,
39
			FullSourceWorkspaceModelTests.class,
39
			FullSourceWorkspaceModelTests.class,
40
			FullSourceWorkspaceCompletionTests.class,
40
			FullSourceWorkspaceCompletionTests.class,
41
			FullSourceWorkspaceFormatterTests.class,
41
		};
42
		};
42
	}
43
	}
43
44
(-)src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java (-3 / +2 lines)
Lines 647-656 Link Here
647
		int length = ALL_PROJECTS.length;
647
		int length = ALL_PROJECTS.length;
648
		for (int i = 0; i < length; i++) {
648
		for (int i = 0; i < length; i++) {
649
			String projectName = ALL_PROJECTS[i].getElementName();
649
			String projectName = ALL_PROJECTS[i].getElementName();
650
			if (BIG_PROJECT_NAME.equals(projectName)) continue; // will be set later
650
			if (JavaCore.PLUGIN_ID.equals(projectName)) {
651
			if (JavaCore.PLUGIN_ID.equals(projectName)) {
651
				JDT_CORE_PROJECT = ALL_PROJECTS[i];
652
				JDT_CORE_PROJECT = ALL_PROJECTS[i];
652
			} else if (BIG_PROJECT_NAME.equals(projectName)) {
653
				BIG_PROJECT = (JavaProject) ALL_PROJECTS[i];
654
//			} else if (JUNIT_PROJECT_NAME.equals(projectName)) {
653
//			} else if (JUNIT_PROJECT_NAME.equals(projectName)) {
655
//				JUNIT_PROJECT = ALL_PROJECTS[i];
654
//				JUNIT_PROJECT = ALL_PROJECTS[i];
656
			}
655
			}
Lines 746-753 Link Here
746
		if (fingerprint) super.tagAsSummary(shortName, dimensions);
745
		if (fingerprint) super.tagAsSummary(shortName, dimensions);
747
	}
746
	}
748
	public void startMeasuring() {
747
	public void startMeasuring() {
749
		super.startMeasuring();
750
		this.startMeasuring = System.currentTimeMillis();
748
		this.startMeasuring = System.currentTimeMillis();
749
		super.startMeasuring();
751
	}
750
	}
752
	public void stopMeasuring() {
751
	public void stopMeasuring() {
753
		super.stopMeasuring();
752
		super.stopMeasuring();
(-)src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java (-20 / +3 lines)
Lines 82-92 Link Here
82
82
83
protected void setUp() throws Exception {
83
protected void setUp() throws Exception {
84
	super.setUp();
84
	super.setUp();
85
	if (BIG_PROJECT == null) {
85
	setUpBigProject();
86
		setUpBigProject();
87
	} else if (BIG_PROJECT_TYPE_PATH == null) {
88
		setUpBigProjectInfo();
89
	}
90
}
86
}
91
private void setUpBigProject() throws CoreException, IOException {
87
private void setUpBigProject() throws CoreException, IOException {
92
	try {
88
	try {
Lines 137-148 Link Here
137
		}
133
		}
138
		System.out.println("("+(System.currentTimeMillis()-start)+"ms)");
134
		System.out.println("("+(System.currentTimeMillis()-start)+"ms)");
139
135
140
		// Print for log in case of project creation troubles...
141
		System.out.println("("+(System.currentTimeMillis()-start)+"ms)");
142
		start = System.currentTimeMillis();
143
		System.out.print("	- Create compilation unit with secondary type...");
144
145
		// Add CU with secondary type
136
		// Add CU with secondary type
137
		System.out.print("	- Create compilation unit with secondary type...");
138
		start = System.currentTimeMillis();
146
		BIG_PROJECT_TYPE_PATH = new Path("/BigProject/src" + (FOLDERS_COUNT-1) + "/org/eclipse/jdt/core/tests" + (FOLDERS_COUNT-1) + "/performance" + (PACKAGES_COUNT-1) + "/TestBigProject.java");
139
		BIG_PROJECT_TYPE_PATH = new Path("/BigProject/src" + (FOLDERS_COUNT-1) + "/org/eclipse/jdt/core/tests" + (FOLDERS_COUNT-1) + "/performance" + (PACKAGES_COUNT-1) + "/TestBigProject.java");
147
		IFile file = workspaceRoot.getFile(BIG_PROJECT_TYPE_PATH);
140
		IFile file = workspaceRoot.getFile(BIG_PROJECT_TYPE_PATH);
148
		if (!file.exists()) {
141
		if (!file.exists()) {
Lines 178-193 Link Here
178
	}
171
	}
179
	
172
	
180
}
173
}
181
private void setUpBigProjectInfo() {
182
	// Set up type path
183
	BIG_PROJECT_TYPE_PATH = new Path("/BigProject/src" + (FOLDERS_COUNT-1) + "/org/eclipse/jdt/core/tests" + (FOLDERS_COUNT-1) + "/performance" + (PACKAGES_COUNT-1) + "/TestBigProject.java");
184
185
	// Set up working copy
186
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
187
	IWorkspaceRoot workspaceRoot = workspace.getRoot();
188
	IFile file = workspaceRoot.getFile(BIG_PROJECT_TYPE_PATH);
189
	WORKING_COPY = (ICompilationUnit)JavaCore.create(file);
190
}
191
/* (non-Javadoc)
174
/* (non-Javadoc)
192
 * @see junit.framework.TestCase#tearDown()
175
 * @see junit.framework.TestCase#tearDown()
193
 */
176
 */
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 15-19 Link Here
15
 org.eclipse.jdt.core.tests.compiler;bundle-version="[3.3.0,4.0.0)",
15
 org.eclipse.jdt.core.tests.compiler;bundle-version="[3.3.0,4.0.0)",
16
 org.eclipse.jdt.core.tests.model;bundle-version="[3.3.0,4.0.0)",
16
 org.eclipse.jdt.core.tests.model;bundle-version="[3.3.0,4.0.0)",
17
 org.junit;bundle-version="[3.8.1,4.0.0)",
17
 org.junit;bundle-version="[3.8.1,4.0.0)",
18
 org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)"
18
 org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)",
19
 org.eclipse.text;bundle-version="[3.1.0,4.0.0)"
19
Bundle-RequiredExecutionEnvironment: J2SE-1.4
20
Bundle-RequiredExecutionEnvironment: J2SE-1.4
(-)src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceFormatterTests.java (+170 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.performance;
12
13
import java.io.File;
14
import java.io.PrintStream;
15
16
import junit.framework.Test;
17
18
import org.eclipse.core.runtime.IPath;
19
import org.eclipse.jdt.core.JavaModelException;
20
import org.eclipse.jdt.core.formatter.CodeFormatter;
21
import org.eclipse.jdt.core.search.IJavaSearchConstants;
22
import org.eclipse.jdt.core.tests.util.Util;
23
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
24
25
/**
26
 */
27
public class FullSourceWorkspaceFormatterTests extends FullSourceWorkspaceTests implements IJavaSearchConstants {
28
29
	// Tests counters
30
	static int TESTS_COUNT = 0;
31
	private final static int WARMUP_COUNT = 5;
32
	static int TESTS_LENGTH;
33
34
	// Log file streams
35
	private static PrintStream[] LOG_STREAMS = new PrintStream[DIM_NAMES.length];
36
37
	// Type path
38
	static IPath FORMAT_TYPE_PATH;
39
	static String FORMAT_TYPE_SOURCE;
40
41
/**
42
 * @param name
43
 */
44
public FullSourceWorkspaceFormatterTests(String name) {
45
	super(name);
46
}
47
48
static {
49
//	TESTS_NAMES = new String[] {
50
//		"testPerfNameLookupFindKnownSecondaryType",
51
//		"testPerfNameLookupFindUnknownType",
52
//		"testPerfReconcile", 
53
//		"testPerfSearchAllTypeNamesAndReconcile",
54
//	};
55
	
56
//	TESTS_PREFIX = "testPerfReconcile";
57
}
58
public static Test suite() {
59
	Test suite = buildSuite(testClass());
60
	TESTS_LENGTH = TESTS_COUNT = suite.countTestCases();
61
	createPrintStream(testClass(), LOG_STREAMS, TESTS_COUNT, null);
62
	return suite;
63
}
64
65
private static Class testClass() {
66
	return FullSourceWorkspaceFormatterTests.class;
67
}
68
69
protected void setUp() throws Exception {
70
	super.setUp();
71
72
	// Read big file
73
	System.out.print("	- Read big file source...");
74
	long start = System.currentTimeMillis();
75
	FORMAT_TYPE_SOURCE = Util.fileContent(getPluginDirectoryPath()+File.separator+"GenericTypeTest.java");
76
	System.out.println("("+(System.currentTimeMillis()-start)+"ms)");
77
}
78
79
/* (non-Javadoc)
80
 * @see junit.framework.TestCase#tearDown()
81
 */
82
protected void tearDown() throws Exception {
83
84
	// End of execution => one test less
85
	TESTS_COUNT--;
86
87
	// Log perf result
88
	if (LOG_DIR != null) {
89
		logPerfResult(LOG_STREAMS, TESTS_COUNT);
90
	}
91
92
	// Print statistics
93
	if (TESTS_COUNT == 0) {
94
//		System.out.println("-------------------------------------");
95
//		System.out.println("Format performance test statistics:");
96
//		NumberFormat intFormat = NumberFormat.getIntegerInstance();
97
//		System.out.println("-------------------------------------\n");
98
	}
99
	super.tearDown();
100
}
101
102
/**
103
 * Format file (Parser.java) using code formatter default options.
104
 */
105
public void testFormatDefault() throws JavaModelException {
106
	tagAsSummary("Format file with default options", false); // do NOT put in fingerprint
107
108
	// Warm up
109
	String source = PARSER_WORKING_COPY.getSource();
110
	int warmup = WARMUP_COUNT;
111
	for (int i=0; i<warmup; i++) {
112
		long start = System.currentTimeMillis();
113
		new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null);
114
		if (i==0) {
115
			System.out.println("	Time to format file ("+source.length()+" chars) = "+(System.currentTimeMillis()-start)+"ms");
116
		}
117
	}
118
119
	// Measures
120
	resetCounters();
121
	int measures = MEASURES_COUNT;
122
	for (int i=0; i<measures; i++) {
123
		runGc();
124
		startMeasuring();
125
		for (int j=1; j<10; j++)
126
			new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null);
127
		stopMeasuring();
128
	}
129
	
130
	// Commit
131
	commitMeasurements();
132
	assertPerformance();		
133
}
134
135
/**
136
 * Format big file (GenericTypeTest.java) using code formatter default options.
137
 */
138
public void testFormatDefaultBigFile() throws JavaModelException {
139
	tagAsGlobalSummary("Format big file with default options", true); // put in global fingerprint
140
141
	// Warm up
142
	String source = FORMAT_TYPE_SOURCE;
143
	int warmup = WARMUP_COUNT;
144
	for (int i=0; i<warmup; i++) {
145
		long start = System.currentTimeMillis();
146
		new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null);
147
		if (i==0) {
148
			System.out.println("	Time to format big file ("+source.length()+" chars) = "+(System.currentTimeMillis()-start)+"ms");
149
		}
150
	}
151
152
	// Measures
153
	resetCounters();
154
	int measures = MEASURES_COUNT;
155
	for (int i=0; i<measures; i++) {
156
		runGc();
157
		startMeasuring();
158
		new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null);
159
		stopMeasuring();
160
	}
161
	
162
	// Commit
163
	commitMeasurements();
164
	assertPerformance();		
165
}
166
167
protected void resetCounters() {
168
	// do nothing
169
}
170
}
(-)GenericTypeTest.java (+38073 lines)
Added Link Here
1
2
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.Map;
6
7
import junit.framework.Test;
8
9
import org.eclipse.jdt.core.ToolFactory;
10
import org.eclipse.jdt.core.tests.util.Util;
11
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
12
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
13
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
14
15
public class GenericTypeTest {
16
17
	private static final String OUTPUT_DIR = null;
18
	private static final String COMPLIANCE_1_5 = null;
19
	private Object complianceLevel;
20
	public void test0001() {
21
		this.runConformTest(
22
			new String[] {
23
				"X.java",
24
				"public class X<Tx1 extends String, Tx2 extends Comparable>  extends XS<Tx2> {\n" + 
25
				"\n" + 
26
				"    public static void main(String[] args) {\n" + 
27
				"        Integer w = new X<String,Integer>().get(new Integer(12));\n" + 
28
				"        System.out.println(\"SUCCESS\");\n" + 
29
				"    }\n" + 
30
				"}\n" + 
31
				"class XS <Txs> {\n" + 
32
				"    Txs get(Txs t) {\n" + 
33
				"        return t;\n" + 
34
				"    }\n" + 
35
				"}\n"
36
			},
37
			"SUCCESS");
38
	}
39
	
40
	private void runConformTest(String[] strings, String string) {
41
	    // TODO Auto-generated method stub
42
	    
43
    }
44
45
	public void test0002() {
46
		this.runConformTest(
47
			new String[] {
48
				"X.java",
49
				"public class X<Xp1 extends String, Xp2 extends Comparable>  extends XS<Xp2> {\n" + 
50
				"\n" + 
51
				"    public static void main(String[] args) {\n" + 
52
				"        Integer w = new X<String,Integer>().get(new Integer(12));\n" + 
53
				"        System.out.println(\"SUCCESS\");\n" + 
54
				"    }\n" + 
55
				"    Xp2 get(Xp2 t){\n" + 
56
				"        System.out.print(\"{X::get}\");\n" + 
57
				"        return super.get(t);\n" + 
58
				"    }\n" + 
59
				"}\n" + 
60
				"\n" + 
61
				"class XS <XSp1> {\n" + 
62
				"    XSp1 get(XSp1 t) {\n" + 
63
				"        System.out.print(\"{XS::get}\");\n" + 
64
				"        return t;\n" + 
65
				"    }\n" + 
66
				"}\n"
67
			},
68
			"{X::get}{XS::get}SUCCESS");
69
	}
70
	
71
	// check cannot bind superclass to type variable
72
	public void test0003() {
73
		this.runNegativeTest(
74
			new String[] {
75
				"X.java",
76
				"public class X <X> extends X {\n" + 
77
				"}\n", 
78
			},
79
			"----------\n" + 
80
			"1. WARNING in X.java (at line 1)\n" + 
81
			"	public class X <X> extends X {\n" + 
82
			"	                ^\n" + 
83
			"The type parameter X is hiding the type X<X>\n" + 
84
			"----------\n" + 
85
			"2. ERROR in X.java (at line 1)\n" + 
86
			"	public class X <X> extends X {\n" + 
87
			"	                           ^\n" + 
88
			"Cannot refer to the type parameter X as a supertype\n" + 
89
			"----------\n");
90
	}
91
	
92
	private void runNegativeTest(String[] strings, String string) {
93
	    // TODO Auto-generated method stub
94
	    
95
    }
96
97
	// check cannot bind superinterface to type variable
98
	public void test0004() {
99
		this.runNegativeTest(
100
			new String[] {
101
				"X.java",
102
				"public class X <X> implements X {\n" + 
103
				"}\n", 
104
			},
105
			"----------\n" + 
106
			"1. WARNING in X.java (at line 1)\n" + 
107
			"	public class X <X> implements X {\n" + 
108
			"	                ^\n" + 
109
			"The type parameter X is hiding the type X<X>\n" + 
110
			"----------\n" + 
111
			"2. ERROR in X.java (at line 1)\n" + 
112
			"	public class X <X> implements X {\n" + 
113
			"	                              ^\n" + 
114
			"Cannot refer to the type parameter X as a supertype\n" + 
115
			"----------\n");
116
	}
117
	
118
	// check cannot bind type variable in static context
119
	public void test0005() {
120
		this.runNegativeTest(
121
			new String[] {
122
				"X.java",
123
				"public class X <T> {\n" + 
124
				"    \n" + 
125
				"    T t;\n" + 
126
				"    static {\n" + 
127
				"        T s;\n" + 
128
				"    }\n" + 
129
				"}\n",
130
			},
131
			"----------\n" + 
132
			"1. ERROR in X.java (at line 5)\n" + 
133
			"	T s;\n" + 
134
			"	^\n" + 
135
			"Cannot make a static reference to the non-static type T\n" + 
136
			"----------\n");
137
	}
138
				
139
	// check static references to type variables
140
	public void test0006() {
141
		this.runNegativeTest(
142
			new String[] {
143
				"X.java",
144
				"public class X <T> {\n" + 
145
				"    \n" + 
146
				"    T ok1;\n" + 
147
				"    static {\n" + 
148
				"        T wrong1;\n" + 
149
				"    }\n" + 
150
				"    static void foo(T wrong2) {\n" + 
151
				"		T wrong3;\n" + 
152
				"    }\n" + 
153
				"    class MX extends T {\n" + 
154
				"        T ok2;\n" + 
155
				"    }\n" + 
156
				"    static class SMX extends T {\n" + 
157
				"        T wrong4;\n" + 
158
				"    }\n" + 
159
				"}\n",
160
			},
161
			"----------\n" + 
162
			"1. ERROR in X.java (at line 5)\n" + 
163
			"	T wrong1;\n" + 
164
			"	^\n" + 
165
			"Cannot make a static reference to the non-static type T\n" + 
166
			"----------\n" + 
167
			"2. ERROR in X.java (at line 7)\n" + 
168
			"	static void foo(T wrong2) {\n" + 
169
			"	                ^\n" + 
170
			"Cannot make a static reference to the non-static type T\n" + 
171
			"----------\n" + 
172
			"3. ERROR in X.java (at line 8)\n" + 
173
			"	T wrong3;\n" + 
174
			"	^\n" + 
175
			"Cannot make a static reference to the non-static type T\n" + 
176
			"----------\n" + 
177
			"4. ERROR in X.java (at line 10)\n" + 
178
			"	class MX extends T {\n" + 
179
			"	                 ^\n" + 
180
			"Cannot refer to the type parameter T as a supertype\n" + 
181
			"----------\n" + 
182
			"5. ERROR in X.java (at line 13)\n" + 
183
			"	static class SMX extends T {\n" + 
184
			"	                         ^\n" + 
185
			"Cannot make a static reference to the non-static type T\n" + 
186
			"----------\n" + 
187
			"6. ERROR in X.java (at line 14)\n" + 
188
			"	T wrong4;\n" + 
189
			"	^\n" + 
190
			"Cannot make a static reference to the non-static type T\n" + 
191
			"----------\n");
192
	}
193
	
194
	// check static references to type variables
195
	public void test0007() {
196
		this.runNegativeTest(
197
			new String[] {
198
				"X.java",
199
				"public class X <T> {\n" + 
200
				"    \n" + 
201
				"    T ok1;\n" + 
202
				"    static class SMX {\n" + 
203
				"        T wrong4;\n" + 
204
				"    }\n" + 
205
				"}\n",
206
			},
207
			"----------\n" + 
208
			"1. ERROR in X.java (at line 5)\n" + 
209
			"	T wrong4;\n" + 
210
			"	^\n" + 
211
			"Cannot make a static reference to the non-static type T\n" + 
212
			"----------\n");
213
	}
214
	
215
	// check static references to type variables
216
	public void test0008() {
217
		this.runNegativeTest(
218
			new String[] {
219
				"X.java",
220
				"public class X <T> {\n" + 
221
				"    \n" + 
222
				"     T ok;\n" + 
223
				"    static T wrong;\n" + 
224
				"}\n",
225
			},
226
			"----------\n" + 
227
			"1. ERROR in X.java (at line 4)\n" + 
228
			"	static T wrong;\n" + 
229
			"	       ^\n" + 
230
			"Cannot make a static reference to the non-static type T\n" + 
231
			"----------\n");
232
	}
233
	
234
	// Object cannot be generic
235
	public void test0009() {
236
		this.runNegativeTest(
237
			new String[] {
238
				"Object.java",
239
				"package java.lang;\n" +
240
				"public class Object <T> {\n" + 
241
				"}\n",
242
			},
243
			"----------\n" + 
244
			"1. ERROR in Object.java (at line 2)\n" + 
245
			"	public class Object <T> {\n" + 
246
			"	                     ^\n" + 
247
			"The type java.lang.Object cannot be declared as a generic\n" + 
248
			"----------\n");
249
	}
250
	
251
	public void test0010() {
252
		this.runNegativeTest(
253
			new String[] {
254
				"X.java",
255
				"class Foo {} \n" + 
256
				"public class X<T extends Object & Comparable<? super T>> {\n" + 
257
				"    public static void main(String[] args) {\n" + 
258
				"        new X<Foo>();\n" + 
259
				"    }\n" + 
260
				"}\n",
261
			},
262
			"----------\n" + 
263
			"1. ERROR in X.java (at line 4)\n" + 
264
			"	new X<Foo>();\n" + 
265
			"	      ^^^\n" + 
266
			"Bound mismatch: The type Foo is not a valid substitute for the bounded parameter <T extends Object & Comparable<? super T>> of the type X<T>\n" + 
267
			"----------\n");
268
	}
269
	
270
	public void test0011() {
271
		this.runNegativeTest(
272
			new String[] {
273
				"X.java",
274
				"public class X<T extends Object & Comparable<? super T>> {\n" + 
275
				"    public static void main(String[] args) {\n" + 
276
				"        new X<Foo>();\n" + 
277
				"    }\n" + 
278
				"}\n",
279
			},
280
			"----------\n" + 
281
			"1. ERROR in X.java (at line 3)\n" + 
282
			"	new X<Foo>();\n" + 
283
			"	      ^^^\n" + 
284
			"Foo cannot be resolved to a type\n" + 
285
			"----------\n");
286
	}
287
	
288
	public void test0012() {
289
		this.runConformTest(
290
			new String[] {
291
				"X.java",
292
				"public class X <T extends String> {\n" + 
293
				"    T foo(T t) {\n" + 
294
				"        return t;\n" + 
295
				"    }\n" + 
296
				"    \n" + 
297
				"    public static void main(String[] args) {\n" + 
298
				"        String s = new X<String>().foo(\"SUCCESS\");\n" + 
299
				"        System.out.println(s);\n" + 
300
				"    }\n" + 
301
				"}\n",
302
			},
303
			"SUCCESS");
304
	}
305
	
306
	public void test0013() {
307
		this.runConformTest(
308
			new String[] {
309
				"X.java",
310
				"public class X <T extends String> {\n" + 
311
				"    T foo(T t) {\n" + 
312
				"        return t;\n" + 
313
				"    }\n" + 
314
				"    public static void main(String[] args) {\n" + 
315
				"        new X<String>().baz(\"SUCCESS\");\n" + 
316
				"    }\n" + 
317
				"    void baz(final T t) {\n" + 
318
				"        new Object() {\n" + 
319
				"            void print() {\n" + 
320
				"                System.out.println(foo(t));\n" + 
321
				"            }\n" + 
322
				"        }.print();\n" + 
323
				"    }\n" + 
324
				"}\n",
325
			},
326
			"SUCCESS");
327
	}
328
	
329
	public void test0014() {
330
		this.runNegativeTest(
331
			new String[] {
332
				"X.java",
333
				"public class X <T extends Exception> {\n" + 
334
				"    T foo(T t) throws T {\n" + 
335
				"        return t;\n" + 
336
				"    }\n" + 
337
				"    public static void main(String[] args) {\n" + 
338
				"        new X<EX>().baz(new EX());\n" + 
339
				"    }\n" + 
340
				"    void baz(final T t) {\n" + 
341
				"        new Object() {\n" + 
342
				"            void print() {\n" + 
343
				"                System.out.println(foo(t));\n" + 
344
				"            }\n" + 
345
				"        }.print();\n" + 
346
				"    }\n" + 
347
				"}\n" + 
348
				"class EX extends Exception {\n" + 
349
				"}\n",
350
			},
351
			"----------\n" + 
352
			"1. ERROR in X.java (at line 11)\n" + 
353
			"	System.out.println(foo(t));\n" + 
354
			"	                   ^^^^^^\n" + 
355
			"Unhandled exception type T\n" + 
356
			"----------\n" + 
357
			"2. WARNING in X.java (at line 16)\n" + 
358
			"	class EX extends Exception {\n" + 
359
			"	      ^^\n" + 
360
			"The serializable class EX does not declare a static final serialVersionUID field of type long\n" + 
361
			"----------\n");
362
	}
363
	public void test0015() {
364
		this.runConformTest(
365
			new String[] {
366
				"X.java",
367
				"public class X <T extends Exception> {\n" + 
368
				"    String foo() throws T {\n" + 
369
				"        return \"SUCCESS\";\n" + 
370
				"    }\n" + 
371
				"    public static void main(String[] args) {\n" + 
372
				"        new X<EX>().baz(new EX());\n" + 
373
				"    }\n" + 
374
				"    void baz(final T t) {\n" + 
375
				"        new Object() {\n" + 
376
				"            void print() {\n" + 
377
				"                try {\n" + 
378
				"	                System.out.println(foo());\n" + 
379
				"                } catch (Exception t) {\n" + 
380
				"                }\n" + 
381
				"            }\n" + 
382
				"        }.print();\n" + 
383
				"    }\n" + 
384
				"}\n" + 
385
				"class EX extends Exception {\n" + 
386
				"}\n",
387
			},
388
			"SUCCESS");
389
	}	
390
	
391
	public void test0016() {
392
		this.runConformTest(
393
			new String[] {
394
				"X.java",
395
				"public class X <E extends Exception> {\n" + 
396
				"    void foo(E e) throws E {\n" + 
397
				"        throw e;\n" + 
398
				"    }\n" + 
399
				"    void bar(E e) {\n" + 
400
				"        try {\n" + 
401
				"            foo(e);\n" + 
402
				"        } catch(Exception ex) {\n" + 
403
				"	        System.out.println(\"SUCCESS\");\n" + 
404
				"        }\n" + 
405
				"    }\n" + 
406
				"    public static void main(String[] args) {\n" + 
407
				"        new X<Exception>().bar(new Exception());\n" + 
408
				"    }\n" + 
409
				"}\n",
410
			},
411
			"SUCCESS");
412
	}
413
	public void test0017() {
414
		this.runNegativeTest(
415
			new String[] {
416
				"X.java",
417
				"import java.io.IOException;\n" + 
418
				"public class X <E extends Exception> {\n" + 
419
				"    void foo(E e) throws E {\n" + 
420
				"        throw e;\n" + 
421
				"    }\n" + 
422
				"    void bar(E e) {\n" + 
423
				"        try {\n" + 
424
				"            foo(e);\n" + 
425
				"        } catch(Exception ex) {\n" + 
426
				"	        System.out.println(\"SUCCESS\");\n" + 
427
				"        }\n" + 
428
				"    }\n" + 
429
				"    public static void main(String[] args) {\n" + 
430
				"        new X<IOException>().bar(new Exception());\n" + 
431
				"    }\n" + 
432
				"}\n" ,
433
			},
434
			"----------\n" + 
435
			"1. ERROR in X.java (at line 14)\n" + 
436
			"	new X<IOException>().bar(new Exception());\n" + 
437
			"	                     ^^^\n" + 
438
			"The method bar(IOException) in the type X<IOException> is not applicable for the arguments (Exception)\n" + 
439
			"----------\n");
440
	}
441
	public void test0018() {
442
		this.runConformTest(
443
			new String[] {
444
				"X.java",
445
				"public class X <T> {\n" + 
446
				"    T foo(T t) {\n" + 
447
				"        System.out.println(t);\n" + 
448
				"        return t;\n" + 
449
				"    }\n" + 
450
				"    public static void main(String[] args) {\n" + 
451
				"        new X<XY>() {\n" + 
452
				"            void run() {\n" + 
453
				"                foo(new XY());\n" + 
454
				"            }\n" + 
455
				"        }.run();\n" + 
456
				"    }\n" + 
457
				"}\n" + 
458
				"class XY {\n" + 
459
				"    public String toString() {\n" + 
460
				"        return \"SUCCESS\";\n" + 
461
				"    }\n" + 
462
				"}\n",
463
			},
464
			"SUCCESS");
465
	}
466
	public void test0019() {
467
		this.runNegativeTest(
468
			new String[] {
469
				"X.java",
470
				"public class X <T> {\n" + 
471
				"     private T foo(T t) {\n" + 
472
				"        System.out.println(t);\n" + 
473
				"        return t;\n" + 
474
				"    }\n" + 
475
				"    public static void main(String[] args) {\n" + 
476
				"        new X<XY>() {\n" + 
477
				"            void run() {\n" + 
478
				"                foo(new XY());\n" + 
479
				"            }\n" + 
480
				"        }.run();\n" + 
481
				"    }\n" + 
482
				"}\n" + 
483
				"class XY {\n" + 
484
				"    public String toString() {\n" + 
485
				"        return \"SUCCESS\";\n" + 
486
				"    }\n" + 
487
				"}",
488
			},
489
			"----------\n" + 
490
			"1. ERROR in X.java (at line 9)\n" + 
491
			"	foo(new XY());\n" + 
492
			"	^^^\n" + 
493
			"The method foo(T) in the type X<T> is not applicable for the arguments (XY)\n" + 
494
			"----------\n" + 
495
			"2. WARNING in X.java (at line 15)\n" + 
496
			"	public String toString() {\n" + 
497
			"	              ^^^^^^^^^^\n" + 
498
			"The method toString() of type XY should be tagged with @Override since it actually overrides a superclass method\n" + 
499
			"----------\n");
500
	}
501
	public void test0020() {
502
		this.runNegativeTest(
503
			new String[] {
504
				"X.java",
505
				"public class X <T> {\n" + 
506
				"     void foo(Y<T> y) {\n" + 
507
				"		System.out.print(\"SUCC\");\n" + 
508
				"    }\n" + 
509
				"    public static void main(String[] args) {\n" + 
510
				"        new X<String>().bar();\n" + 
511
				"    }\n" + 
512
				"    void bar() {\n" + 
513
				"        new Y<T>() {\n" + 
514
				"            @Override\n" +
515
				"            public void pre() {\n" + 
516
				"                foo(this);\n" + 
517
				"            }\n" + 
518
				"        }.print(\"ESS\");\n" + 
519
				"    }\n" + 
520
				"}\n" + 
521
				"class Y <P> {\n" + 
522
				"	public void print(P p) {\n" + 
523
				"		pre();\n" + 
524
				"		System.out.println(p);\n" + 
525
				"	}\n" + 
526
				"	public void pre() {\n" + 
527
				"	}\n" + 
528
				"}",
529
			},
530
			"----------\n" + 
531
			"1. ERROR in X.java (at line 14)\n" + 
532
			"	}.print(\"ESS\");\n" + 
533
			"	  ^^^^^\n" + 
534
			"The method print(T) in the type Y<T> is not applicable for the arguments (String)\n" + 
535
			"----------\n");
536
	}
537
	public void test0021() {
538
		this.runNegativeTest(
539
			new String[] {
540
				"X.java",
541
				"public class X <T extends String> {\n" + 
542
				"    void foo(T t) {\n" + 
543
				"    }\n" + 
544
				"    void bar(String x) {\n" + 
545
				"        foo(x);\n" + 
546
				"    }\n" + 
547
				"    public static void main(String[] args) {\n" + 
548
				"        new X<String>().foo(new Object());\n" + 
549
				"    }\n" + 
550
				"}\n",
551
			},
552
			"----------\n" + 
553
			"1. WARNING in X.java (at line 1)\n" + 
554
			"	public class X <T extends String> {\n" + 
555
			"	                          ^^^^^^\n" + 
556
			"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
557
			"----------\n" + 
558
			"2. ERROR in X.java (at line 5)\n" + 
559
			"	foo(x);\n" + 
560
			"	^^^\n" + 
561
			"The method foo(T) in the type X<T> is not applicable for the arguments (String)\n" + 
562
			"----------\n" + 
563
			"3. ERROR in X.java (at line 8)\n" + 
564
			"	new X<String>().foo(new Object());\n" + 
565
			"	                ^^^\n" + 
566
			"The method foo(String) in the type X<String> is not applicable for the arguments (Object)\n" + 
567
			"----------\n");
568
	}
569
	
570
	public void test0022() {
571
		this.runConformTest(
572
			new String[] {
573
				"X.java",
574
				"public class X <T extends String> {\n" + 
575
				"    X(T t) {\n" + 
576
				"        System.out.println(t);\n" + 
577
				"    }\n" + 
578
				"    \n" + 
579
				"    public static void main(String[] args) {\n" + 
580
				"       new X<String>(\"SUCCESS\");\n" + 
581
				"    }\n" + 
582
				"}\n",
583
			},
584
			"SUCCESS");
585
	}
586
	
587
	public void test0023() {
588
		this.runConformTest(
589
			new String[] {
590
				"X.java",
591
				"public class X <T extends String> {\n" + 
592
				"    X(final T t) {\n" + 
593
				"        new Object() {\n" + 
594
				"            void print() {\n" + 
595
				"                System.out.println(t);\n" + 
596
				"            }\n" + 
597
				"        }.print();\n" + 
598
				"    }\n" + 
599
				"    public static void main(String[] args) {\n" + 
600
				"        new X<String>(\"SUCCESS\");\n" + 
601
				"    }\n" + 
602
				"}\n",
603
			},
604
			"SUCCESS");
605
	}
606
	
607
	public void test0024() {
608
		this.runNegativeTest(
609
			new String[] {
610
				"X.java",
611
				"public class X <T extends Exception> {\n" + 
612
				"    X(final T t) throws T {\n" + 
613
				"        new Object() {\n" + 
614
				"            void print() {\n" + 
615
				"                System.out.println(t);\n" + 
616
				"            }\n" + 
617
				"        }.print();\n" + 
618
				"    }\n" + 
619
				"    public static void main(String[] args) {\n" + 
620
				"        new X<EX>(new EX());\n" + 
621
				"    }\n" + 
622
				"}\n" + 
623
				"class EX extends Exception {\n" + 
624
				"}\n",
625
			},
626
			"----------\n" + 
627
			"1. ERROR in X.java (at line 10)\n" + 
628
			"	new X<EX>(new EX());\n" + 
629
			"	^^^^^^^^^^^^^^^^^^^\n" + 
630
			"Unhandled exception type EX\n" + 
631
			"----------\n" + 
632
			"2. WARNING in X.java (at line 13)\n" + 
633
			"	class EX extends Exception {\n" + 
634
			"	      ^^\n" + 
635
			"The serializable class EX does not declare a static final serialVersionUID field of type long\n" + 
636
			"----------\n");
637
	}
638
	
639
	public void test0025() {
640
		this.runConformTest(
641
			new String[] {
642
				"X.java",
643
				"public class X <T extends Exception> {\n" + 
644
				"    String foo() throws T {\n" + 
645
				"        return \"SUCCESS\";\n" + 
646
				"    }\n" + 
647
				"    public static void main(String[] args) {\n" + 
648
				"        new X<EX>(new EX());\n" + 
649
				"    }\n" + 
650
				"    X(final T t) {\n" + 
651
				"        new Object() {\n" + 
652
				"            void print() {\n" + 
653
				"                try {\n" + 
654
				"	                System.out.println(foo());\n" + 
655
				"                } catch (Exception t) {\n" + 
656
				"                }\n" + 
657
				"            }\n" + 
658
				"        }.print();\n" + 
659
				"    }\n" + 
660
				"}\n" + 
661
				"class EX extends Exception {\n" + 
662
				"}\n",
663
			},
664
			"SUCCESS");
665
	}
666
	
667
	public void test0026() {
668
		this.runConformTest(
669
			new String[] {
670
				"X.java",
671
				"public class X <E extends Exception> {\n" + 
672
				"    void foo(E e) throws E {\n" + 
673
				"        throw e;\n" + 
674
				"    }\n" + 
675
				"    X(E e) {\n" + 
676
				"        try {\n" + 
677
				"            foo(e);\n" + 
678
				"        } catch(Exception ex) {\n" + 
679
				"	        System.out.println(\"SUCCESS\");\n" + 
680
				"        }\n" + 
681
				"    }\n" + 
682
				"    public static void main(String[] args) {\n" + 
683
				"        new X<Exception>(new Exception());\n" + 
684
				"    }\n" + 
685
				"}\n",
686
			},
687
			"SUCCESS");
688
	}
689
	public void test0027() {
690
		this.runNegativeTest(
691
			new String[] {
692
				"X.java",
693
				"import java.io.IOException;\n" + 
694
				"public class X <E extends Exception> {\n" + 
695
				"    void foo(E e) throws E {\n" + 
696
				"        throw e;\n" + 
697
				"    }\n" + 
698
				"    X(E e) {\n" + 
699
				"        try {\n" + 
700
				"            foo(e);\n" + 
701
				"        } catch(Exception ex) {\n" + 
702
				"	        System.out.println(\"SUCCESS\");\n" + 
703
				"        }\n" + 
704
				"    }\n" + 
705
				"    public static void main(String[] args) {\n" + 
706
				"        new X<IOException>(new Exception());\n" + 
707
				"    }\n" + 
708
				"}\n" ,
709
			},
710
			"----------\n" + 
711
			"1. ERROR in X.java (at line 14)\n" + 
712
			"	new X<IOException>(new Exception());\n" + 
713
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
714
			"The constructor X<IOException>(Exception) is undefined\n" + 
715
			"----------\n");
716
	}
717
	
718
	public void test0028() {
719
		this.runConformTest(
720
			new String[] {
721
				"X.java",
722
				"public class X <T> {\n" + 
723
				"    T t;\n" + 
724
				"    X(T t) {\n" + 
725
				"        this.t = t;\n" + 
726
				"    }\n" + 
727
				"    public static void main(String[] args) {\n" + 
728
				"        String s = new X<String>(\"SU\").t;\n" + 
729
				"        System.out.print(s);\n" + 
730
				"        s = new X<String>(\"failed\").t = \"CC\";\n" + 
731
				"        System.out.print(s);\n" + 
732
				"        s = new X<String>(\"\").t += \"ESS\";\n" + 
733
				"        System.out.println(s);\n" + 
734
				"    }\n" + 
735
				"}\n",
736
			},
737
			"SUCCESS");
738
	}
739
	
740
	public void test0029() {
741
		this.runNegativeTest(
742
			new String[] {
743
				"X.java",
744
				"public class X <T> {\n" + 
745
				"    T t;\n" + 
746
				"    X() {\n" + 
747
				"    }\n" + 
748
				"    T foo(T a, T b) {\n" + 
749
				"        T s;\n" + 
750
				"        s = t = a;\n" + 
751
				"		s = t += b;\n" + 
752
				"		return t;\n" + 
753
				"    }\n" + 
754
				"    public static void main(String[] args) {\n" + 
755
				"        System.out.println(new X<String>().foo(\"SUC\", \"CESS\"));\n" + 
756
				"    }\n" + 
757
				"}\n",
758
			},
759
			"----------\n" + 
760
			"1. ERROR in X.java (at line 8)\n" + 
761
			"	s = t += b;\n" + 
762
			"	    ^^^^^^\n" + 
763
			"The operator += is undefined for the argument type(s) T, T\n" + 
764
			"----------\n");
765
	}
766
	
767
	public void test0030() {
768
		this.runConformTest(
769
			new String[] {
770
				"X.java",
771
				"public class X <T> {\n" + 
772
				"    T t;\n" + 
773
				"    X() {\n" + 
774
				"    }\n" + 
775
				"    T foo(T a) {\n" + 
776
				"        T s;\n" + 
777
				"        s = t = a;\n" + 
778
				"		return t;\n" + 
779
				"    }\n" + 
780
				"    public static void main(String[] args) {\n" + 
781
				"        System.out.println(new X<String>().foo(\"SUCCESS\"));\n" + 
782
				"    }\n" + 
783
				"}\n" ,
784
			},
785
			"SUCCESS");
786
	}
787
	
788
	public void test0031() {
789
		this.runConformTest(
790
			new String[] {
791
				"X.java",
792
				"public class X <T> {\n" + 
793
				"    T t;\n" + 
794
				"    X(T t) {\n" + 
795
				"        this.t = t;\n" + 
796
				"    }\n" + 
797
				"    public static void main(String[] args) {\n" + 
798
				"        new X<String>(\"OUTER\").bar();\n" + 
799
				"    }\n" + 
800
				"    void bar() {\n" + 
801
				"        new X<String>(\"INNER\") {\n" + 
802
				"            void run() {\n" + 
803
				"                \n" + 
804
				"                new Object() {\n" + 
805
				"                    void run() {\n" + 
806
				"		                String s = t = \"SUC\";\n" + 
807
				"		                s = t+= \"CESS\";\n" + 
808
				"				        System.out.println(t);\n" + 
809
				"                    }\n" + 
810
				"                }.run();\n" + 
811
				"            }\n" + 
812
				"        }.run();\n" + 
813
				"    }\n" + 
814
				"}\n" ,
815
			},
816
			"SUCCESS");
817
	}
818
	
819
	public void test0032() {
820
		this.runConformTest(
821
			new String[] {
822
				"X.java",
823
				"public class X <T> {\n" + 
824
				"    T t;\n" + 
825
				"    X(T t) {\n" + 
826
				"        this.t = t;\n" + 
827
				"    }\n" + 
828
				"    public static void main(String[] args) {\n" + 
829
				"        new X<String>(\"OUTER\").bar();\n" + 
830
				"    }\n" + 
831
				"    void bar() {\n" + 
832
				"        new X<String>(\"INNER\") {\n" + 
833
				"            void run() {\n" + 
834
				"                String s = t = \"SUC\";\n" + 
835
				"                s = t+= \"CESS\";\n" + 
836
				"		        System.out.println(t);\n" + 
837
				"            }\n" + 
838
				"        }.run();\n" + 
839
				"    }\n" + 
840
				"}\n" ,
841
			},
842
			"SUCCESS");
843
	}
844
	
845
	public void test0033() {
846
		this.runNegativeTest(
847
			new String[] {
848
				"X.java",
849
				"public class X <E, T> {\n" + 
850
				"	void foo(E e){}\n" + 
851
				"	void foo(T t){}\n" + 
852
				"}\n" ,
853
			},
854
			"----------\n" + 
855
			"1. ERROR in X.java (at line 2)\n" + 
856
			"	void foo(E e){}\n" + 
857
			"	     ^^^^^^^^\n" + 
858
			"Method foo(E) has the same erasure foo(Object) as another method in type X<E,T>\n" + 
859
			"----------\n" + 
860
			"2. ERROR in X.java (at line 3)\n" + 
861
			"	void foo(T t){}\n" + 
862
			"	     ^^^^^^^^\n" + 
863
			"Method foo(T) has the same erasure foo(Object) as another method in type X<E,T>\n" + 
864
			"----------\n");
865
	}		
866
	
867
	public void test0034() {
868
		this.runNegativeTest(
869
			new String[] {
870
				"X.java",
871
				"public class X <E extends Exception, T extends Exception> {\n" + 
872
				"	void foo(E e){}\n" + 
873
				"	void foo(T t){}\n" + 
874
				"}\n" ,
875
			},
876
			"----------\n" + 
877
			"1. ERROR in X.java (at line 2)\n" + 
878
			"	void foo(E e){}\n" + 
879
			"	     ^^^^^^^^\n" + 
880
			"Method foo(E) has the same erasure foo(Exception) as another method in type X<E,T>\n" + 
881
			"----------\n" + 
882
			"2. ERROR in X.java (at line 3)\n" + 
883
			"	void foo(T t){}\n" + 
884
			"	     ^^^^^^^^\n" + 
885
			"Method foo(T) has the same erasure foo(Exception) as another method in type X<E,T>\n" + 
886
			"----------\n");
887
	}	
888
	
889
	public void test0035() {
890
		this.runNegativeTest(
891
			new String[] {
892
				"X.java",
893
				"public class X <E extends Exception, T extends Thread> {\n" + 
894
				"	void foo(E e, Thread t){}\n" + 
895
				"	void foo(Exception e, T t){}\n" + 
896
				"}\n" ,
897
			},
898
			"----------\n" + 
899
			"1. ERROR in X.java (at line 2)\n" + 
900
			"	void foo(E e, Thread t){}\n" + 
901
			"	     ^^^^^^^^^^^^^^^^^^\n" + 
902
			"Method foo(E, Thread) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" + 
903
			"----------\n" + 
904
			"2. ERROR in X.java (at line 3)\n" + 
905
			"	void foo(Exception e, T t){}\n" + 
906
			"	     ^^^^^^^^^^^^^^^^^^^^^\n" + 
907
			"Method foo(Exception, T) has the same erasure foo(Exception, Thread) as another method in type X<E,T>\n" + 
908
			"----------\n");
909
	}	
910
	
911
	public void test0036() {
912
		this.runConformTest(
913
			new String[] {
914
				"X.java",
915
				"public class X <E extends Exception, T extends Thread> {\n" + 
916
				"	void foo(E e){}\n" + 
917
				"	void foo(T t){}\n" + 
918
				"    public static void main(String[] args) {\n" + 
919
				"		 System.out.println(\"SUCCESS\");\n" + 
920
				"    }\n" + 
921
				"}\n" ,
922
			},
923
			"SUCCESS");
924
	}			
925
				
926
	public void test0037() {
927
		this.runConformTest(
928
			new String[] {
929
				"X.java",
930
				"public class X <E extends Cloneable, T extends Thread & Cloneable> {\n" + 
931
				"	void foo(E e){}\n" + 
932
				"	void foo(T t){}\n" + 
933
				"    public static void main(String[] args) {\n" + 
934
				"		 System.out.println(\"SUCCESS\");\n" + 
935
				"    }\n" + 
936
				"}\n" ,
937
			},
938
			"SUCCESS");
939
	}	
940
	
941
	public void test0038() {
942
		this.runNegativeTest(
943
			new String[] {
944
				"X.java",
945
				"public class X <E extends Cloneable, T extends Thread & Cloneable> {\n" + 
946
				"	void foo(E e){}\n" + 
947
				"	void foo(T t){}\n" + 
948
				"	public static void main(String[] args) {\n" + 
949
				"		X<XY,XY> x = new X<XY, XY>();\n" + 
950
				"		x.foo(new XY());\n" + 
951
				"	}\n" + 
952
				"}\n" + 
953
				"class XY extends Thread implements Cloneable {\n" + 
954
				"}\n" ,
955
			},		"----------\n" + 
956
			"1. ERROR in X.java (at line 6)\n" + 
957
			"	x.foo(new XY());\n" + 
958
			"	  ^^^\n" + 
959
			"The method foo(XY) is ambiguous for the type X<XY,XY>\n" + 
960
			"----------\n");
961
	}
962
963
	public void test0039() {
964
		this.runNegativeTest(
965
			new String[] {
966
				"X.java",
967
				"public class X <E extends Cloneable, T extends Thread> {\n" + 
968
				"	void foo(L<E> l1){}\n" + 
969
				"	void foo(L<T> l2){}\n" + 
970
				"	void foo(L l){}\n" + 
971
				"}\n" + 
972
				"\n" + 
973
				"class L<E> {\n" + 
974
				"}\n",
975
			},
976
			"----------\n" + 
977
			"1. ERROR in X.java (at line 2)\n" + 
978
			"	void foo(L<E> l1){}\n" + 
979
			"	     ^^^^^^^^^^^^\n" + 
980
			"Method foo(L<E>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" + 
981
			"----------\n" + 
982
			"2. ERROR in X.java (at line 3)\n" + 
983
			"	void foo(L<T> l2){}\n" + 
984
			"	     ^^^^^^^^^^^^\n" + 
985
			"Method foo(L<T>) has the same erasure foo(L<E>) as another method in type X<E,T>\n" + 
986
			"----------\n" + 
987
			"3. ERROR in X.java (at line 4)\n" + 
988
			"	void foo(L l){}\n" + 
989
			"	     ^^^^^^^^\n" + 
990
			"Duplicate method foo(L) in type X<E,T>\n" + 
991
			"----------\n" + 
992
			"4. WARNING in X.java (at line 4)\n" + 
993
			"	void foo(L l){}\n" + 
994
			"	         ^\n" + 
995
			"L is a raw type. References to generic type L<E> should be parameterized\n" + 
996
			"----------\n");
997
	}
998
	
999
	public void test0040() {
1000
		this.runConformTest(
1001
			new String[] {
1002
				"X.java",
1003
				"public class X <T extends X> {\n" + 
1004
				"    public static void main(String[] args) {\n" + 
1005
				"        System.out.println(\"SUCCESS\");\n" + 
1006
				"    }    \n" + 
1007
				"}\n",
1008
			},
1009
			"SUCCESS");
1010
	}	
1011
	
1012
	public void test0041() {
1013
		this.runConformTest(
1014
			new String[] {
1015
				"X.java",
1016
				"public class X <T, U extends T> {\n" + 
1017
				"    public static void main(String[] args) {\n" + 
1018
				"        System.out.println(\"SUCCESS\");\n" + 
1019
				"    }    \n" + 
1020
				"}\n",
1021
			},
1022
			"SUCCESS");
1023
	}	
1024
	
1025
	// **
1026
	public void test0042() {
1027
		this.runNegativeTest(
1028
			new String[] {
1029
				"X.java",
1030
				"public class X <T extends U, U> {\n" + 
1031
				"}\n",
1032
			},
1033
			"----------\n" + 
1034
			"1. ERROR in X.java (at line 1)\n" + 
1035
			"	public class X <T extends U, U> {\n" + 
1036
			"	                ^\n" + 
1037
			"Illegal forward reference to type parameter U\n" + 
1038
			"----------\n");
1039
	}	
1040
	
1041
	public void test0043() {
1042
		this.runConformTest(
1043
			new String[] {
1044
				"X.java",
1045
				"public class X <T extends L<T> , U extends T> {\n" + 
1046
				"    public static void main(String[] args) {\n" + 
1047
				"        System.out.println(\"SUCCESS\");\n" + 
1048
				"    }\n" + 
1049
				"}\n" +
1050
				"class L<E>{}\n",
1051
			},
1052
			"SUCCESS");
1053
	}	
1054
	
1055
	public void test0044() {
1056
		this.runConformTest(
1057
			new String[] {
1058
				"X.java",
1059
				"public class X extends L<X> {\n" + 
1060
				"    public static void main(String[] args) {\n" + 
1061
				"        System.out.println(\"SUCCESS\");\n" + 
1062
				"    }    \n" + 
1063
				"}\n" + 
1064
				"class L<E> {}\n",
1065
			},
1066
			"SUCCESS");
1067
	}	
1068
	
1069
	public void test0045() {
1070
		this.runNegativeTest(
1071
			new String[] {
1072
				"X.java",
1073
				"public class X {\n" + 
1074
				"    public Z<T> var;\n" + 
1075
				"}\n",
1076
			},
1077
			"----------\n" + 
1078
			"1. ERROR in X.java (at line 2)\n" + 
1079
			"	public Z<T> var;\n" + 
1080
			"	       ^\n" + 
1081
			"Z cannot be resolved to a type\n" + 
1082
			"----------\n" + 
1083
			"2. ERROR in X.java (at line 2)\n" + 
1084
			"	public Z<T> var;\n" + 
1085
			"	         ^\n" + 
1086
			"T cannot be resolved to a type\n" + 
1087
			"----------\n");
1088
	}
1089
	public void test0046() {
1090
		this.runNegativeTest(
1091
			new String[] {
1092
				"X.java",
1093
				"public class X {\n" + 
1094
				"    public Object<T> var;\n" + 
1095
				"}\n",
1096
			},
1097
			"----------\n" + 
1098
			"1. ERROR in X.java (at line 2)\n" + 
1099
			"	public Object<T> var;\n" + 
1100
			"	              ^\n" + 
1101
			"T cannot be resolved to a type\n" + 
1102
			"----------\n");
1103
	}
1104
	public void test0047() {
1105
		this.runNegativeTest(
1106
			new String[] {
1107
				"X.java",
1108
				"public class X <T> {\n" + 
1109
				"    private T t;\n" + 
1110
				"    X(T t) {\n" + 
1111
				"        this.t = t;\n" + 
1112
				"    }\n" + 
1113
				"    public static void main(String[] args) {\n" + 
1114
				"        new X<String>(\"OUTER\").bar();\n" + 
1115
				"    }\n" + 
1116
				"    void bar() {\n" + 
1117
				"        new MX<String>(\"INNER\") {\n" + 
1118
				"            void run() {\n" + 
1119
				"                \n" + 
1120
				"                new Object() {\n" + 
1121
				"                    void run() {\n" + 
1122
				"		                String s = t = \"SUC\";\n" + 
1123
				"		                s = t+= \"CESS\";\n" + 
1124
				"				        System.out.println(t);\n" + 
1125
				"                    }\n" + 
1126
				"                }.run();\n" + 
1127
				"            }\n" + 
1128
				"        }.run();\n" + 
1129
				"    }\n" + 
1130
				"}\n" + 
1131
				"class MX<U> {\n" + 
1132
				"    MX(U u){}\n" + 
1133
				"}\n",
1134
			},
1135
			"----------\n" + 
1136
			"1. ERROR in X.java (at line 15)\n" + 
1137
			"	String s = t = \"SUC\";\n" + 
1138
			"	           ^^^^^^^^^\n" + 
1139
			"Type mismatch: cannot convert from T to String\n" + 
1140
			"----------\n" + 
1141
			"2. ERROR in X.java (at line 15)\n" + 
1142
			"	String s = t = \"SUC\";\n" + 
1143
			"	               ^^^^^\n" + 
1144
			"Type mismatch: cannot convert from String to T\n" + 
1145
			"----------\n" + 
1146
			"3. ERROR in X.java (at line 16)\n" + 
1147
			"	s = t+= \"CESS\";\n" + 
1148
			"	    ^^^^^^^^^^\n" + 
1149
			"The operator += is undefined for the argument type(s) T, String\n" + 
1150
			"----------\n");
1151
	}
1152
	// Access to enclosing 't' of type 'T' (not substituted from X<X> as private thus non inherited)
1153
	// **
1154
	public void test0048() {
1155
		this.runNegativeTest(
1156
			new String[] {
1157
				"X.java",
1158
				"public class X <T> {\n" + 
1159
				"    private T t;\n" + 
1160
				"    X(T t) {\n" + 
1161
				"        this.t = t;\n" + 
1162
				"    }\n" + 
1163
				"    public static void main(String[] args) {\n" + 
1164
				"        new X<String>(\"OUTER\").bar();\n" + 
1165
				"    }\n" + 
1166
				"    void bar() {\n" + 
1167
				"        new X<X>(this) {\n" + 
1168
				"            void run() {\n" + 
1169
				"                new Object() {\n" + 
1170
				"                    void run() {\n" + 
1171
				"                        X x = t;\n" + 
1172
				"				        System.out.println(x);\n" + 
1173
				"                    }\n" + 
1174
				"                }.run();\n" + 
1175
				"            }\n" + 
1176
				"        }.run();\n" + 
1177
				"    }\n" + 
1178
				"}\n",
1179
			},
1180
			"----------\n" + 
1181
			"1. WARNING in X.java (at line 10)\n" + 
1182
			"	new X<X>(this) {\n" + 
1183
			"	      ^\n" + 
1184
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1185
			"----------\n" + 
1186
			"2. WARNING in X.java (at line 14)\n" + 
1187
			"	X x = t;\n" + 
1188
			"	^\n" + 
1189
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1190
			"----------\n" + 
1191
			"3. ERROR in X.java (at line 14)\n" + 
1192
			"	X x = t;\n" + 
1193
			"	      ^\n" + 
1194
			"Type mismatch: cannot convert from T to X\n" + 
1195
			"----------\n");
1196
	}
1197
	public void test0049() {
1198
		this.runConformTest(
1199
			new String[] {
1200
				"X.java",
1201
				"public class X <T> {\n" + 
1202
				"    public T t;\n" + 
1203
				"    X(T t) {\n" + 
1204
				"        this.t = t;\n" + 
1205
				"    }\n" + 
1206
				"    public static void main(String[] args) {\n" + 
1207
				"        new X<String>(\"OUTER\").bar();\n" + 
1208
				"    }\n" + 
1209
				"    void bar() {\n" + 
1210
				"        new X<X>(this) {\n" + 
1211
				"            void run() {\n" + 
1212
				"                new Object() {\n" + 
1213
				"                    void run() {\n" + 
1214
				"                        X x = t;\n" + 
1215
				"				        System.out.println(\"SUCCESS\");\n" + 
1216
				"                    }\n" + 
1217
				"                }.run();\n" + 
1218
				"            }\n" + 
1219
				"        }.run();\n" + 
1220
				"    }\n" + 
1221
				"}\n",
1222
			},
1223
			"SUCCESS");
1224
	}
1225
	public void test0050() {
1226
		this.runNegativeTest(
1227
			new String[] {
1228
				"X.java",
1229
				"public class X <T extends N> {\n" +
1230
				"	static class N {}" +
1231
				"}\n" +
1232
				"class Y <T extends Y.N> {\n" +
1233
				"	static class N {}" +
1234
				"}\n" 
1235
			},
1236
			"----------\n" + 
1237
			"1. ERROR in X.java (at line 1)\n" + 
1238
			"	public class X <T extends N> {\n" + 
1239
			"	                          ^\n" + 
1240
			"N cannot be resolved to a type\n" + 
1241
			"----------\n");
1242
	}
1243
	public void test0050a() {
1244
		this.runNegativeTest(
1245
			new String[] {
1246
				"X.java",
1247
				"class Super {class M {}}\n" + 
1248
				"public class X <T extends M> extends Super {}\n" +
1249
				"class Y <T extends Y.M> extends Super {}\n", 
1250
			},
1251
			"----------\n" + 
1252
			"1. ERROR in X.java (at line 2)\n" + 
1253
			"	public class X <T extends M> extends Super {}\n" + 
1254
			"	                          ^\n" + 
1255
			"M cannot be resolved to a type\n" + 
1256
			"----------\n" + 
1257
			"2. WARNING in X.java (at line 3)\n" + 
1258
			"	class Y <T extends Y.M> extends Super {}\n" + 
1259
			"	                   ^^^\n" + 
1260
			"Y.M is a raw type. References to generic type Super.M should be parameterized\n" + 
1261
			"----------\n");
1262
	}
1263
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98504
1264
	public void test0050b() {
1265
		this.runConformTest(
1266
			new String[] {
1267
				"X.java",
1268
				"public class X {\n" + 
1269
				"	class M extends Y implements I {}\n" + 
1270
				"}\n" + 
1271
				"class Y {\n" + 
1272
				"	static interface I { void foo(); }\n" + 
1273
				"}\n" + 
1274
				"interface I {}\n"
1275
			},
1276
			"");
1277
	}
1278
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98504 - variation
1279
	public void test0050c() {
1280
		this.runConformTest(
1281
			new String[] {
1282
				"Test.java",
1283
				"public class Test<T extends Test.InnerTest> implements Base<T> {\n" +
1284
				"	static class InnerTest implements Inner {}\n" + 
1285
				"}\n"+
1286
				"interface Base<T> {\n" + 
1287
				"	interface Inner {}\n" + 
1288
				"}\n"
1289
			},
1290
			"");
1291
	}
1292
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101387
1293
	public void test0050d() {
1294
		this.runConformTest(
1295
			new String[] {
1296
				"X.java",
1297
				"public class X<I, C extends I> {}\n" + 
1298
				"class Y extends X<Y.M, Y.N> {\n" + 
1299
				"	static class M {}\n" + 
1300
				"	static class N extends M {}\n" + 
1301
				"}\n"
1302
			},
1303
			"");
1304
	}
1305
	public void test0051() {
1306
		this.runConformTest(
1307
			new String[] {
1308
				"X.java",
1309
				"class Super {class M {}}\n" + 
1310
				"public class X extends Super {\n" + 
1311
				"	class N <T extends M> {}\n" + 
1312
				"	public static void main(String[] args) {\n" + 
1313
				"		System.out.println(\"SUCCESS\");\n" + 
1314
				"	}\n" + 
1315
				"}\n", 
1316
			},
1317
			"SUCCESS");
1318
	}
1319
	public void test0052() {
1320
		this.runConformTest(
1321
			new String[] {
1322
				"X.java",
1323
				"public class X <T> extends p.A<T> {\n" + 
1324
				"	public static void main(String[] args) {\n" + 
1325
				"		System.out.println(\"SUCCESS\");\n" + 
1326
				"	}\n" + 
1327
				"}\n", 
1328
				"p/A.java",
1329
				"package p; \n" +
1330
				"public class A<P> {\n" + 
1331
				"}\n", 
1332
			},
1333
			"SUCCESS");
1334
	}
1335
	public void test0053() {
1336
		this.runConformTest(
1337
			new String[] {
1338
				"X.java",
1339
				"public class X <T> extends p.A<T> {\n" + 
1340
				"    protected T t;\n" + 
1341
				"    X(T t) {\n" + 
1342
				"        this.t = t;\n" + 
1343
				"    }\n" + 
1344
				"    public static void main(String[] args) {\n" + 
1345
				"        new X<String>(\"OUTER\").bar();\n" + 
1346
				"    }\n" + 
1347
				"    void bar() {\n" + 
1348
				"        new X<X>(this) {\n" + 
1349
				"            void run() {\n" + 
1350
				"                new Object() {\n" + 
1351
				"                    void run() {\n" + 
1352
				"                        print(t);\n" + 
1353
				"                    }\n" + 
1354
				"                }.run();\n" + 
1355
				"            }\n" + 
1356
				"        }.run();\n" + 
1357
				"    }\n" + 
1358
				"}\n", 
1359
				"p/A.java",
1360
				"package p; \n" +
1361
				"public class A<P> {\n" + 
1362
				"    protected void print(P p) {\n" + 
1363
				"        System.out.println(\"SUCCESS\");\n" + 
1364
				"    }\n" + 
1365
				"}\n", 
1366
			},
1367
			"SUCCESS");
1368
	}
1369
	public void test0054() {
1370
		this.runNegativeTest(
1371
			new String[] {
1372
				"X.java",
1373
				"public class X <T> extends p.A<T> {\n" + 
1374
				"    protected T t;\n" + 
1375
				"    X(T t) {\n" + 
1376
				"        this.t = t;\n" + 
1377
				"    }\n" + 
1378
				"    public static void main(String[] args) {\n" + 
1379
				"        new X<String>(\"OUTER\").bar();\n" + 
1380
				"    }\n" + 
1381
				"    void bar() {\n" + 
1382
				"        new X<X>(this) {\n" + 
1383
				"            void run() {\n" + 
1384
				"                new Object() {\n" + 
1385
				"                    void run() {\n" + 
1386
				"                        print(X.this.t);\n" + 
1387
				"                    }\n" + 
1388
				"                }.run();\n" + 
1389
				"            }\n" + 
1390
				"        }.run();\n" + 
1391
				"    }\n" + 
1392
				"}\n", 
1393
				"p/A.java",
1394
				"package p; \n" +
1395
				"public class A<P> {\n" + 
1396
				"    protected void print(P p) {\n" + 
1397
				"        System.out.println(\"SUCCESS\");\n" + 
1398
				"    }\n" + 
1399
				"}\n", 
1400
			},
1401
			"----------\n" + 
1402
			"1. WARNING in X.java (at line 10)\n" + 
1403
			"	new X<X>(this) {\n" + 
1404
			"	      ^\n" + 
1405
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1406
			"----------\n" + 
1407
			"2. ERROR in X.java (at line 14)\n" + 
1408
			"	print(X.this.t);\n" + 
1409
			"	^^^^^\n" + 
1410
			"The method print(X) in the type A<X> is not applicable for the arguments (T)\n" + 
1411
			"----------\n");
1412
	}
1413
1414
	public void test0055() {
1415
		this.runConformTest(
1416
			new String[] {
1417
				"X.java",
1418
				"public class X <T> extends p.A<T> {\n" + 
1419
				"    protected T t;\n" + 
1420
				"    X(T t) {\n" + 
1421
				"        super(t);\n" + 
1422
				"        this.t = t;\n" + 
1423
				"    }\n" + 
1424
				"    public static void main(String[] args) {\n" + 
1425
				"	  X<String> xs = new X<String>(\"SUCCESS\");\n" + 
1426
				"	  System.out.println(xs.t);\n" + 
1427
				"    }\n" + 
1428
				"}\n", 
1429
				"p/A.java",
1430
				"package p; \n" +
1431
				"public class A<P> {\n" + 
1432
				"	 protected P p;\n" +
1433
				"    protected A(P p) {\n" +
1434
				"       this.p = p; \n" +
1435
				"    } \n" +
1436
				"    protected void print(P p) {\n" + 
1437
				"        System.out.println(\"SUCCESS\");\n" + 
1438
				"    }\n" + 
1439
				"}\n", 
1440
			},
1441
			"SUCCESS");
1442
	}
1443
	
1444
	public void test0056() {
1445
		this.runNegativeTest(
1446
			new String[] {
1447
				"X.java",
1448
				"public class X <T> extends p.A<T> {\n" + 
1449
				"    protected T t;\n" + 
1450
				"    X(T t) {\n" + 
1451
				"        super(t);\n" + 
1452
				"        this.t = t;\n" + 
1453
				"    }\n" + 
1454
				"    public static void main(String[] args) {\n" + 
1455
				"	  X<String> xs = new X<String>(\"SUCCESS\");\n" + 
1456
				"	  System.out.println((X)xs.t);\n" + 
1457
				"    }\n" + 
1458
				"}\n", 
1459
				"p/A.java",
1460
				"package p; \n" +
1461
				"public class A<P> {\n" + 
1462
				"	 protected P p;\n" +
1463
				"    protected A(P p) {\n" +
1464
				"       this.p = p; \n" +
1465
				"    } \n" +
1466
				"    protected void print(P p) {\n" + 
1467
				"        System.out.println(\"SUCCESS\");\n" + 
1468
				"    }\n" + 
1469
				"}\n", 
1470
			},
1471
			"----------\n" + 
1472
			"1. ERROR in X.java (at line 9)\n" + 
1473
			"	System.out.println((X)xs.t);\n" + 
1474
			"	                   ^^^^^^^\n" + 
1475
			"Cannot cast from String to X\n" + 
1476
			"----------\n" + 
1477
			"----------\n" + 
1478
			"1. WARNING in p\\A.java (at line 7)\n" + 
1479
			"	protected void print(P p) {\n" + 
1480
			"	                       ^\n" + 
1481
			"The parameter p is hiding a field from type A<P>\n" + 
1482
			"----------\n");
1483
	}
1484
	
1485
	public void test0057() {
1486
		this.runConformTest(
1487
			new String[] {
1488
				"X.java",
1489
				"public class X <T> extends p.A<T> {\n" + 
1490
				"    protected T t;\n" + 
1491
				"    X(T t) {\n" + 
1492
				"        super(t);\n" + 
1493
				"        this.t = t;\n" + 
1494
				"    }\n" + 
1495
				"    public static void main(String[] args) {\n" + 
1496
				"	  X<X<String>> xs = new X<X<String>>(new X<String>(\"SUCCESS\"));\n" + 
1497
				"	  System.out.println(xs.t.t);\n" + 
1498
				"    }\n" + 
1499
				"}\n", 
1500
				"p/A.java",
1501
				"package p; \n" +
1502
				"public class A<P> {\n" + 
1503
				"	 protected P p;\n" +
1504
				"    protected A(P p) {\n" +
1505
				"       this.p = p; \n" +
1506
				"    } \n" +
1507
				"    protected void print(P p) {\n" + 
1508
				"        System.out.println(\"SUCCESS\");\n" + 
1509
				"    }\n" + 
1510
				"}\n", 
1511
			},
1512
			"SUCCESS");
1513
	}
1514
1515
	// JSR14-v10[2.1,2.2]: Valid multiple parameter types
1516
	public void test0058() {
1517
		this.runConformTest(
1518
			new String[] {
1519
				"test/X.java",
1520
				"package test;\n" +
1521
					"// Valid Parameterized Type Declaration\n" + 
1522
					"public class X<A1, A2, A3> {\n" + 
1523
					"}\n" + 
1524
					"// Valid Type Syntax\n" + 
1525
					"class Y {\n" + 
1526
					"	X<String, Number, Integer> x;\n" + 
1527
					"}\n"
1528
			}
1529
		);
1530
	}
1531
	private void runConformTest(String[] strings) {
1532
	    // TODO Auto-generated method stub
1533
	    
1534
    }
1535
1536
	// JSR14-v10[2.1,2.2]: Invalid multiple parameter types: more declared than referenced
1537
	public void test0059() {
1538
		this.runNegativeTest(
1539
			new String[] {
1540
				"test/X.java",
1541
				"package test;\n" +
1542
					"// Valid Parameterized Type Declaration\n" + 
1543
					"public class X<A1, A2, A3, A4> {\n" + 
1544
					"}\n" + 
1545
					"// Invalid Valid Type Syntax (not enough parameters)\n" + 
1546
					"class Y {\n" + 
1547
					"	X<String, Number, Integer> x;\n" + 
1548
					"}\n"
1549
			},
1550
			"----------\n" + 
1551
			"1. ERROR in test\\X.java (at line 7)\n" + 
1552
			"	X<String, Number, Integer> x;\n" + 
1553
			"	^\n" + 
1554
			"Incorrect number of arguments for type X<A1,A2,A3,A4>; it cannot be parameterized with arguments <String, Number, Integer>\n" + 
1555
			"----------\n"
1556
		);
1557
	}
1558
	// JSR14-v10[2.1,2.2]: Invalid multiple parameter types: more referenced than declared
1559
	public void test0060() {
1560
		this.runNegativeTest(
1561
			new String[] {
1562
				"test/X.java",
1563
				"package test;\n" +
1564
					"// Valid Parameterized Type Declaration\n" + 
1565
					"public class X<A1, A2> {\n" + 
1566
					"}\n" + 
1567
					"// Invalid Valid Type Syntax (too many parameters)\n" + 
1568
					"class Y {\n" + 
1569
					"	X<String, Number, Integer> x;\n" + 
1570
					"}\n"
1571
			},
1572
			"----------\n" + 
1573
				"1. ERROR in test\\X.java (at line 7)\n" + 
1574
				"	X<String, Number, Integer> x;\n" + 
1575
				"	^\n" + 
1576
				"Incorrect number of arguments for type X<A1,A2>; it cannot be parameterized with arguments <String, Number, Integer>\n" + 
1577
				"----------\n"
1578
		);
1579
	}
1580
	// JSR14-v10[2.1,2.2]: Invalid multiple parameter types: primitive types
1581
	public void test0061() {
1582
		this.runNegativeTest(
1583
			new String[] {
1584
				"test/X.java",
1585
				"package test;\n" +
1586
					"// Valid Parameterized Type Declaration\n" + 
1587
					"public class X<A1, A2, A3, A4, A5, A6, A7> {\n" + 
1588
					"}\n" + 
1589
					"// Invalid Valid Type Syntax (primitive cannot be parameters)\n" + 
1590
					"class Y {\n" + 
1591
					"	X<int, short, long, float, double, boolean, char> x;\n" + 
1592
					"}\n"
1593
			},
1594
			"----------\n" + 
1595
				"1. ERROR in test\\X.java (at line 7)\n" + 
1596
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1597
				"	  ^^^\n" + 
1598
				"Syntax error on token \"int\", Dimensions expected after this token\n" + 
1599
				"----------\n" + 
1600
				"2. ERROR in test\\X.java (at line 7)\n" + 
1601
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1602
				"	       ^^^^^\n" + 
1603
				"Syntax error on token \"short\", Dimensions expected after this token\n" + 
1604
				"----------\n" + 
1605
				"3. ERROR in test\\X.java (at line 7)\n" + 
1606
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1607
				"	              ^^^^\n" + 
1608
				"Syntax error on token \"long\", Dimensions expected after this token\n" + 
1609
				"----------\n" + 
1610
				"4. ERROR in test\\X.java (at line 7)\n" + 
1611
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1612
				"	                    ^^^^^\n" + 
1613
				"Syntax error on token \"float\", Dimensions expected after this token\n" + 
1614
				"----------\n" + 
1615
				"5. ERROR in test\\X.java (at line 7)\n" + 
1616
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1617
				"	                           ^^^^^^\n" + 
1618
				"Syntax error on token \"double\", Dimensions expected after this token\n" + 
1619
				"----------\n" + 
1620
				"6. ERROR in test\\X.java (at line 7)\n" + 
1621
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1622
				"	                                   ^^^^^^^\n" + 
1623
				"Syntax error on token \"boolean\", Dimensions expected after this token\n" + 
1624
				"----------\n" + 
1625
				"7. ERROR in test\\X.java (at line 7)\n" + 
1626
				"	X<int, short, long, float, double, boolean, char> x;\n" + 
1627
				"	                                            ^^^^\n" + 
1628
				"Syntax error on token \"char\", Dimensions expected after this token\n" + 
1629
				"----------\n"
1630
		);
1631
	}
1632
	// JSR14-v10[2.1,2.2]: Valid multiple parameter types: primitive type arrays
1633
	public void test0062() {
1634
		this.runConformTest(
1635
			new String[] {
1636
				"test/X.java",
1637
				"package test;\n" +
1638
					"// Valid Parameterized Type Declaration\n" + 
1639
					"public class X<A1, A2, A3, A4, A5, A6, A7, A8> {\n" + 
1640
					"}\n" + 
1641
					"// Valid Type Syntax\n" + 
1642
					"class Y {\n" + 
1643
					"	X<int[], short[][], long[][][], float[][][][], double[][][][][], boolean[][][][][][], char[][][][][][][], Object[][][][][][][][][]> x;\n" + 
1644
					"}\n"
1645
			},
1646
			""
1647
		);
1648
	}
1649
	public void test0063() {
1650
		this.runNegativeTest(
1651
			new String[] {
1652
				"X.java",
1653
				"public class X<T> extends p.A<T> {\n" + 
1654
				"    \n" + 
1655
				"    X(T t) {\n" + 
1656
				"        super(t);\n" + 
1657
				"    }\n" + 
1658
				"    public static void main(String[] args) {\n" + 
1659
				"        X x = new X(args);\n" + 
1660
				"        X<String> xs = new X<String>(args);\n" + 
1661
				"	}\n" + 
1662
				"}\n", 
1663
				"p/A.java",
1664
				"package p; \n" +
1665
				"public class A<P> {\n" + 
1666
				"	 protected P p;\n" +
1667
				"    protected A(P p) {\n" +
1668
				"       this.p = p; \n" +
1669
				"    } \n" +
1670
				"    protected void print(P p) {\n" + 
1671
				"        System.out.println(\"SUCCESS\"+p);\n" + 
1672
				"    }\n" + 
1673
				"}\n", 
1674
			},
1675
			"----------\n" + 
1676
			"1. WARNING in X.java (at line 7)\n" + 
1677
			"	X x = new X(args);\n" + 
1678
			"	^\n" + 
1679
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1680
			"----------\n" + 
1681
			"2. WARNING in X.java (at line 7)\n" + 
1682
			"	X x = new X(args);\n" + 
1683
			"	      ^^^^^^^^^^^\n" + 
1684
			"Type safety: The constructor X(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
1685
			"----------\n" + 
1686
			"3. WARNING in X.java (at line 7)\n" + 
1687
			"	X x = new X(args);\n" + 
1688
			"	          ^\n" + 
1689
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1690
			"----------\n" + 
1691
			"4. ERROR in X.java (at line 8)\n" + 
1692
			"	X<String> xs = new X<String>(args);\n" + 
1693
			"	               ^^^^^^^^^^^^^^^^^^^\n" + 
1694
			"The constructor X<String>(String[]) is undefined\n" + 
1695
			"----------\n" + 
1696
			"----------\n" + 
1697
			"1. WARNING in p\\A.java (at line 7)\n" + 
1698
			"	protected void print(P p) {\n" + 
1699
			"	                       ^\n" + 
1700
			"The parameter p is hiding a field from type A<P>\n" + 
1701
			"----------\n");
1702
	}
1703
	// raw type: variable map to its strict erasure 
1704
	public void test0064() {
1705
		this.runNegativeTest(
1706
			new String[] {
1707
				"X.java",
1708
				"public class X<T extends Exception & IX> {\n" + 
1709
				"    T t;\n" + 
1710
				"    void bar(T t) {\n" + 
1711
				"        t.getMessage();\n" + 
1712
				"        t.foo();\n" + 
1713
				"    }\n" + 
1714
				"    public static void main(String[] args) {\n" + 
1715
				"		X x = new X();\n" + // raw type
1716
				"		x.t.getMessage();\n" + // T is strictly exception !
1717
				"		x.t.foo();\n" + 
1718
				"	}\n" + 
1719
				"}\n" + 
1720
				"\n" + 
1721
				"interface IX {\n" + 
1722
				"    void foo();\n" + 
1723
				"}\n", 
1724
			},
1725
			"----------\n" + 
1726
			"1. WARNING in X.java (at line 3)\n" + 
1727
			"	void bar(T t) {\n" + 
1728
			"	           ^\n" + 
1729
			"The parameter t is hiding a field from type X<T>\n" + 
1730
			"----------\n" + 
1731
			"2. WARNING in X.java (at line 8)\n" + 
1732
			"	X x = new X();\n" + 
1733
			"	^\n" + 
1734
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1735
			"----------\n" + 
1736
			"3. WARNING in X.java (at line 8)\n" + 
1737
			"	X x = new X();\n" + 
1738
			"	          ^\n" + 
1739
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1740
			"----------\n" + 
1741
			"4. ERROR in X.java (at line 10)\n" + 
1742
			"	x.t.foo();\n" + 
1743
			"	    ^^^\n" + 
1744
			"The method foo() is undefined for the type Exception\n" + 
1745
			"----------\n");
1746
	}
1747
	// raw type: assignments 
1748
	public void test0065() {
1749
		Map customOptions = getCompilerOptions();
1750
		this.runNegativeTest(
1751
			new String[] {
1752
				"X.java",
1753
				"import java.io.IOException;\n" + 
1754
				"\n" + 
1755
				"public class X<T extends Exception> {\n" + 
1756
				"\n" + 
1757
				"    public static void main(String[] args) {\n" + 
1758
				"		X x = new X();\n" + 
1759
				"		X<IOException> xioe = new X<IOException>(); // ok\n" + 
1760
				"		\n" + 
1761
				"		X x2 = xioe;\n" + 
1762
				"		X<IOException> xioe2 = x; // unsafe\n" + 
1763
				"	}\n" + 
1764
				"}\n", 
1765
			},
1766
			"----------\n" + 
1767
			"1. WARNING in X.java (at line 6)\n" + 
1768
			"	X x = new X();\n" + 
1769
			"	^\n" + 
1770
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1771
			"----------\n" + 
1772
			"2. WARNING in X.java (at line 6)\n" + 
1773
			"	X x = new X();\n" + 
1774
			"	          ^\n" + 
1775
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1776
			"----------\n" + 
1777
			"3. WARNING in X.java (at line 9)\n" + 
1778
			"	X x2 = xioe;\n" + 
1779
			"	^\n" + 
1780
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
1781
			"----------\n" + 
1782
			"4. WARNING in X.java (at line 10)\n" + 
1783
			"	X<IOException> xioe2 = x; // unsafe\n" + 
1784
			"	                       ^\n" + 
1785
			"Type safety: The expression of type X needs unchecked conversion to conform to X<IOException>\n" + 
1786
			"----------\n",
1787
			null,
1788
			true,
1789
			customOptions);
1790
	}
1791
1792
	private void runNegativeTest(String[] strings, String string, Object object, boolean b, Map customOptions) {
1793
	    // TODO Auto-generated method stub
1794
	    
1795
    }
1796
1797
	private Map getCompilerOptions() {
1798
	    // TODO Auto-generated method stub
1799
	    return null;
1800
    }
1801
1802
	// JSR14-v10[2.1,2.2]: Invalid PT declaration (mix with reference)
1803
	public void test0066() {
1804
		this.runNegativeTest(
1805
			new String[] {
1806
				"test/X1.java",
1807
				"package test;\n" +
1808
				"// Valid Consecutive Parameterized Type Declaration\n" + 
1809
				"public class X1<A1 extends X2<A2>> {\n" + 
1810
				"	A1 a1;\n" +
1811
				"}\n" + 
1812
				"// Valid Parameterized Type Declaration\n" + 
1813
				"class X2<A2>{\n" + 
1814
				"	A2 a2;\n" +
1815
				"}\n"
1816
			},
1817
			"----------\n" + 
1818
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1819
			"	public class X1<A1 extends X2<A2>> {\n" + 
1820
			"	                              ^^\n" + 
1821
			"A2 cannot be resolved to a type\n" + 
1822
			"----------\n"
1823
		);
1824
	}
1825
1826
	// JSR14-v10[2.1,2.2]: Invalid PT declaration (mix with reference)
1827
	public void test0067() {
1828
		this.runNegativeTest(
1829
			new String[] {
1830
				"test/X1.java",
1831
				"package test;\n" +
1832
				"// Valid Consecutive Parameterized Type Declaration\n" + 
1833
				"public class X1< A1 extends X2	<	A2	>     			> {\n" + 
1834
				"	A1 a1;\n" +
1835
				"}\n" + 
1836
				"// Valid Parameterized Type Declaration\n" + 
1837
				"class X2<A2>{\n" + 
1838
				"	A2 a2;\n" +
1839
				"}\n"
1840
			},
1841
			"----------\n" + 
1842
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1843
			"	public class X1< A1 extends X2	<	A2	>     			> {\n" + 
1844
			"	                              	 	^^\n" + 
1845
			"A2 cannot be resolved to a type\n" + 
1846
			"----------\n"
1847
		);
1848
	}
1849
1850
	// JSR14-V10[2.4]: Not terminated consecutive declaration
1851
	// TODO (david) diagnosis message on error 3 sounds strange, doesn't it?
1852
	public void test0068() {
1853
		this.runNegativeTest(
1854
			new String[] {
1855
				"test/X1.java",
1856
				"package test;\n" +
1857
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
1858
				"public class X1<A1 extends X2<A2> {\n" + 
1859
				"	A1 a1;\n" +
1860
				"}\n" + 
1861
				"// Invalid Parameterized Type Declaration\n" + 
1862
				"class X2<A2 {\n" + 
1863
				"	A2 a2;\n" +
1864
				"}\n"
1865
			},
1866
			"----------\n" + 
1867
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1868
			"	public class X1<A1 extends X2<A2> {\n" + 
1869
			"	                              ^^\n" + 
1870
			"A2 cannot be resolved to a type\n" + 
1871
			"----------\n" + 
1872
			"2. ERROR in test\\X1.java (at line 3)\n" + 
1873
			"	public class X1<A1 extends X2<A2> {\n" + 
1874
			"	                                ^\n" + 
1875
			"Syntax error, insert \">\" to complete ReferenceType1\n" + 
1876
			"----------\n" + 
1877
			"3. ERROR in test\\X1.java (at line 7)\n" + 
1878
			"	class X2<A2 {\n" + 
1879
			"	         ^^\n" + 
1880
			"Syntax error on token \"A2\", > expected after this token\n" + 
1881
			"----------\n"
1882
		);
1883
	}
1884
1885
	// JSR14-V10[2.4]: Not terminated consecutive declaration
1886
	public void test0069() {
1887
		this.runNegativeTest(
1888
			new String[] {
1889
				"test/X1.java",
1890
				"package test;\n" +
1891
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
1892
				"public class X1<A1 extends X2<A2 {\n" + 
1893
				"	A1 a1;\n" +
1894
				"}\n" + 
1895
				"// Invalid Parameterized Type Declaration\n" + 
1896
				"class X2<A2> {\n" + 
1897
				"	A2 a2;\n" +
1898
				"}\n"
1899
			},
1900
			"----------\n" + 
1901
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1902
			"	public class X1<A1 extends X2<A2 {\n" + 
1903
			"	                              ^^\n" + 
1904
			"Syntax error, insert \">>\" to complete ReferenceType2\n" + 
1905
			"----------\n"
1906
		);
1907
	}
1908
1909
	// JSR14-v10[2.4]: Unexpected consecutive PT declaration (right-shift symbol)
1910
	// TODO (david) surround expected token with (double-)quotes
1911
	public void test0070() {
1912
		this.runNegativeTest(
1913
			new String[] {
1914
				"test/X1.java",
1915
				"package test;\n" +
1916
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
1917
				"public class X1<A1>> {\n" + 
1918
				"	A1 a1;\n" +
1919
				"}\n"
1920
			},
1921
			"----------\n" + 
1922
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1923
			"	public class X1<A1>> {\n" + 
1924
			"	                  ^^\n" + 
1925
			"Syntax error on token \">>\", > expected\n" + 
1926
			"----------\n"
1927
		);
1928
	}
1929
1930
	// JSR14-v10[2.1,2.2]: Unexpected consecutive PT declaration (with spaces)
1931
	public void test0071() {
1932
		this.runNegativeTest(
1933
			new String[] {
1934
				"test/X1.java",
1935
				"package test;\n" +
1936
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
1937
				"public class X1 < A1 > > {\n" + 
1938
				"	A1 a1;\n" +
1939
				"}\n"
1940
			},
1941
			"----------\n" + 
1942
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1943
			"	public class X1 < A1 > > {\n" + 
1944
			"	                       ^\n" + 
1945
			"Syntax error on token \">\", delete this token\n" + 
1946
			"----------\n"
1947
		);
1948
	}
1949
1950
	// JSR14-v10[2.4]: Unexpected consecutive PT declaration (unary right-shift symbol)
1951
	// TODO (david) surround expected token with (double-)quotes
1952
	public void test0072() {
1953
		this.runNegativeTest(
1954
			new String[] {
1955
				"test/X1.java",
1956
				"package test;\n" +
1957
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
1958
				"public class X1<A1>>> {\n" + 
1959
				"	A1 a1;\n" +
1960
				"}\n"
1961
			},
1962
			"----------\n" + 
1963
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1964
			"	public class X1<A1>>> {\n" + 
1965
			"	                  ^^^\n" + 
1966
			"Syntax error on token \">>>\", > expected\n" + 
1967
			"----------\n"
1968
		);
1969
	}
1970
1971
	// JSR14-v10[2.4]: Unexpected consecutive PT declaration (right-shift symbol)
1972
	// TODO (david) surround expected token with (double-)quotes
1973
	public void test0073() {
1974
		this.runNegativeTest(
1975
			new String[] {
1976
				"test/X1.java",
1977
				"package test;\n" +
1978
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
1979
				"public class X1<A1 extends X2<A1>>> {\n" + 
1980
				"	A1 a1;\n" +
1981
				"}\n" + 
1982
				"// Valid Parameterized Type Declaration\n" + 
1983
				"class X2<A2> {\n" + 
1984
				"	A2 a2;\n" +
1985
				"}\n"
1986
			},
1987
			"----------\n" + 
1988
			"1. ERROR in test\\X1.java (at line 3)\n" + 
1989
			"	public class X1<A1 extends X2<A1>>> {\n" + 
1990
			"	                                ^^^\n" + 
1991
			"Syntax error on token \">>>\", >> expected\n" + 
1992
			"----------\n"
1993
		);
1994
	}
1995
1996
	// JSR14-v10[2.1,2.2]: Unexpected consecutive PT declaration (with spaces)
1997
	public void test0074() {
1998
		this.runNegativeTest(
1999
			new String[] {
2000
				"test/X1.java",
2001
				"package test;\n" +
2002
				"// Invalid Consecutive Parameterized Type Declaration\n" + 
2003
				"public class X1 < A1 > > > {\n" + 
2004
				"	A1 a1;\n" +
2005
				"}\n"
2006
			},
2007
			"----------\n" + 
2008
			"1. ERROR in test\\X1.java (at line 3)\n" + 
2009
			"	public class X1 < A1 > > > {\n" + 
2010
			"	                       ^^^\n" + 
2011
			"Syntax error on tokens, delete these tokens\n" + 
2012
			"----------\n"
2013
		);
2014
	}
2015
	
2016
	// A is not an interface
2017
	public void test0075() {
2018
		this.runNegativeTest(
2019
			new String[] {
2020
				"X.java",
2021
				"public class X <T extends Object & p.A<? super T>> extends p.A<T> {\n" + 
2022
				"    protected T t;\n" + 
2023
				"    X(T t) {\n" + 
2024
				"        super(t);\n" + 
2025
				"        this.t = t;\n" + 
2026
				"    }\n" + 
2027
				"}",
2028
				"p/A.java",
2029
				"package p;\n" + 
2030
				"public class A<P> {\n" + 
2031
				"    protected P p;\n" + 
2032
				"    protected A(P p) {\n" + 
2033
				"        this.p = p;\n" + 
2034
				"    }\n" + 
2035
				"}"
2036
			},
2037
		"----------\n" + 
2038
		"1. ERROR in X.java (at line 1)\n" + 
2039
		"	public class X <T extends Object & p.A<? super T>> extends p.A<T> {\n" + 
2040
		"	                                   ^^^\n" + 
2041
		"The type A<? super T> is not an interface; it cannot be specified as a bounded parameter\n" + 
2042
		"----------\n"
2043
		);
2044
	}
2045
2046
	// A is not an interface
2047
	public void test0076() {
2048
		this.runNegativeTest(
2049
			new String[] {
2050
				"X.java",
2051
				"public class X <T extends Object & p.A> extends p.A<T> {\n" + 
2052
				"    protected T t;\n" + 
2053
				"    X(T t) {\n" + 
2054
				"        super(t);\n" + 
2055
				"        this.t = t;\n" + 
2056
				"    }\n" + 
2057
				"}",
2058
				"p/A.java",
2059
				"package p;\n" + 
2060
				"public class A<P> {\n" + 
2061
				"    protected P p;\n" + 
2062
				"    protected A(P p) {\n" + 
2063
				"        this.p = p;\n" + 
2064
				"    }\n" + 
2065
				"}"
2066
			},
2067
			"----------\n" + 
2068
			"1. WARNING in X.java (at line 1)\n" + 
2069
			"	public class X <T extends Object & p.A> extends p.A<T> {\n" + 
2070
			"	                                   ^^^\n" + 
2071
			"A is a raw type. References to generic type A<P> should be parameterized\n" + 
2072
			"----------\n" + 
2073
			"2. ERROR in X.java (at line 1)\n" + 
2074
			"	public class X <T extends Object & p.A> extends p.A<T> {\n" + 
2075
			"	                                   ^^^\n" + 
2076
			"The type A is not an interface; it cannot be specified as a bounded parameter\n" + 
2077
			"----------\n"
2078
		);
2079
	}
2080
	// unsafe type operation: only for constructors with signature change
2081
	public void test0077() {
2082
		this.runNegativeTest(
2083
			new String[] {
2084
				"X.java",
2085
				"public class X<T> extends p.A<T> {\n" + 
2086
				"	 X() {\n" +
2087
				"		super(null);\n" +
2088
				"	}\n"+
2089
				"    X(T t) {\n" + 
2090
				"        super(t);\n" + 
2091
				"    }\n" + 
2092
				"    X(X<T> xt) {\n" + 
2093
				"        super(xt.t);\n" + 
2094
				"    }\n" + 
2095
				"    public static void main(String[] args) {\n" + 
2096
				"        X x = new X();\n" + 
2097
				"        X x1 = new X(args);\n" + 
2098
				"        X x2 = new X(x);\n" + 
2099
				"        X<String> xs = new X<String>(args);\n" + 
2100
				"	}\n" + 
2101
				"}\n",
2102
				"p/A.java",
2103
				"package p;\n" + 
2104
				"public class A<P> {\n" + 
2105
				"    protected P p;\n" + 
2106
				"    protected A(P p) {\n" + 
2107
				"        this.p = p;\n" + 
2108
				"    }\n" + 
2109
				"}"
2110
			},
2111
			"----------\n" + 
2112
			"1. ERROR in X.java (at line 9)\n" + 
2113
			"	super(xt.t);\n" + 
2114
			"	      ^^^^\n" + 
2115
			"xt.t cannot be resolved or is not a field\n" + 
2116
			"----------\n" + 
2117
			"2. WARNING in X.java (at line 12)\n" + 
2118
			"	X x = new X();\n" + 
2119
			"	^\n" + 
2120
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2121
			"----------\n" + 
2122
			"3. WARNING in X.java (at line 12)\n" + 
2123
			"	X x = new X();\n" + 
2124
			"	          ^\n" + 
2125
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2126
			"----------\n" + 
2127
			"4. WARNING in X.java (at line 13)\n" + 
2128
			"	X x1 = new X(args);\n" + 
2129
			"	^\n" + 
2130
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2131
			"----------\n" + 
2132
			"5. WARNING in X.java (at line 13)\n" + 
2133
			"	X x1 = new X(args);\n" + 
2134
			"	       ^^^^^^^^^^^\n" + 
2135
			"Type safety: The constructor X(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
2136
			"----------\n" + 
2137
			"6. WARNING in X.java (at line 13)\n" + 
2138
			"	X x1 = new X(args);\n" + 
2139
			"	           ^\n" + 
2140
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2141
			"----------\n" + 
2142
			"7. WARNING in X.java (at line 14)\n" + 
2143
			"	X x2 = new X(x);\n" + 
2144
			"	^\n" + 
2145
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2146
			"----------\n" + 
2147
			"8. WARNING in X.java (at line 14)\n" + 
2148
			"	X x2 = new X(x);\n" + 
2149
			"	       ^^^^^^^^\n" + 
2150
			"Type safety: The constructor X(X) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
2151
			"----------\n" + 
2152
			"9. WARNING in X.java (at line 14)\n" + 
2153
			"	X x2 = new X(x);\n" + 
2154
			"	           ^\n" + 
2155
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2156
			"----------\n" + 
2157
			"10. ERROR in X.java (at line 15)\n" + 
2158
			"	X<String> xs = new X<String>(args);\n" + 
2159
			"	               ^^^^^^^^^^^^^^^^^^^\n" + 
2160
			"The constructor X<String>(String[]) is undefined\n" + 
2161
			"----------\n");
2162
	}	
2163
	public void test0078() {
2164
		this.runNegativeTest(
2165
			new String[] {
2166
				"X.java",
2167
				"import p.A;\n" + 
2168
				"public class X {\n" + 
2169
				"    X(A<String> a, A<String> b) {\n" + 
2170
				"    }\n" + 
2171
				"    void foo(A<String> a) {\n" + 
2172
				"    }\n" + 
2173
				"    public static void main(String[] args) {\n" + 
2174
				"        X x = new X((A)null, (A)null);\n" + 
2175
				"        A a = new A((A)null);\n" + 
2176
				"		x.foo(a);\n" + 
2177
				"		a.print(x);\n" + 
2178
				"		A<String> as = new A<String>(null);\n" + 
2179
				"		as.print(\"hello\");\n" + 
2180
				"	}\n" + 
2181
				"}\n",
2182
				"p/A.java",
2183
				"package p;\n" +
2184
				"public class A<P> {\n" + 
2185
				"    protected P p;\n" + 
2186
				"    protected A(P p) {\n" + 
2187
				"        this.p = p;\n" + 
2188
				"    }\n" + 
2189
				"    protected void print(P p) {\n" + 
2190
				"        System.out.println(\"SUCCESS\"+p);\n" + 
2191
				"    }\n" + 
2192
				"    protected void print(A<P> a) {\n" + 
2193
				"        print(a.p);\n" + 
2194
				"    }\n" + 
2195
				"}\n",
2196
			},
2197
			"----------\n" + 
2198
			"1. WARNING in X.java (at line 8)\n" + 
2199
			"	X x = new X((A)null, (A)null);\n" + 
2200
			"	            ^^^^^^^\n" + 
2201
			"Type safety: The expression of type A needs unchecked conversion to conform to A<String>\n" + 
2202
			"----------\n" + 
2203
			"2. WARNING in X.java (at line 8)\n" + 
2204
			"	X x = new X((A)null, (A)null);\n" + 
2205
			"	             ^\n" + 
2206
			"A is a raw type. References to generic type A<P> should be parameterized\n" + 
2207
			"----------\n" + 
2208
			"3. WARNING in X.java (at line 8)\n" + 
2209
			"	X x = new X((A)null, (A)null);\n" + 
2210
			"	                     ^^^^^^^\n" + 
2211
			"Type safety: The expression of type A needs unchecked conversion to conform to A<String>\n" + 
2212
			"----------\n" + 
2213
			"4. WARNING in X.java (at line 8)\n" + 
2214
			"	X x = new X((A)null, (A)null);\n" + 
2215
			"	                      ^\n" + 
2216
			"A is a raw type. References to generic type A<P> should be parameterized\n" + 
2217
			"----------\n" + 
2218
			"5. WARNING in X.java (at line 9)\n" + 
2219
			"	A a = new A((A)null);\n" + 
2220
			"	^\n" + 
2221
			"A is a raw type. References to generic type A<P> should be parameterized\n" + 
2222
			"----------\n" + 
2223
			"6. ERROR in X.java (at line 9)\n" + 
2224
			"	A a = new A((A)null);\n" + 
2225
			"	      ^^^^^^^^^^^^^^\n" + 
2226
			"The constructor A(P) is not visible\n" + 
2227
			"----------\n" + 
2228
			"7. WARNING in X.java (at line 9)\n" + 
2229
			"	A a = new A((A)null);\n" + 
2230
			"	          ^\n" + 
2231
			"A is a raw type. References to generic type A<P> should be parameterized\n" + 
2232
			"----------\n" + 
2233
			"8. WARNING in X.java (at line 9)\n" + 
2234
			"	A a = new A((A)null);\n" + 
2235
			"	             ^\n" + 
2236
			"A is a raw type. References to generic type A<P> should be parameterized\n" + 
2237
			"----------\n" + 
2238
			"9. WARNING in X.java (at line 10)\n" + 
2239
			"	x.foo(a);\n" + 
2240
			"	      ^\n" + 
2241
			"Type safety: The expression of type A needs unchecked conversion to conform to A<String>\n" + 
2242
			"----------\n" + 
2243
			"10. ERROR in X.java (at line 11)\n" + 
2244
			"	a.print(x);\n" + 
2245
			"	  ^^^^^\n" + 
2246
			"The method print(P) from the type A is not visible\n" + 
2247
			"----------\n" + 
2248
			"11. ERROR in X.java (at line 12)\n" + 
2249
			"	A<String> as = new A<String>(null);\n" + 
2250
			"	               ^^^^^^^^^^^^^^^^^^^\n" + 
2251
			"The constructor A<String>(P) is not visible\n" + 
2252
			"----------\n" + 
2253
			"12. ERROR in X.java (at line 13)\n" + 
2254
			"	as.print(\"hello\");\n" + 
2255
			"	   ^^^^^\n" + 
2256
			"The method print(P) from the type A<String> is not visible\n" + 
2257
			"----------\n" + 
2258
			"----------\n" + 
2259
			"1. WARNING in p\\A.java (at line 7)\n" + 
2260
			"	protected void print(P p) {\n" + 
2261
			"	                       ^\n" + 
2262
			"The parameter p is hiding a field from type A<P>\n" + 
2263
			"----------\n");
2264
	}	
2265
2266
	// JSR14-v10[2.4]: Valid consecutive Type Parameters Brackets
2267
	public void test0079() {
2268
		this.runConformTest(
2269
			new String[] {
2270
				"test/X.java",
2271
				"package test;\n" +
2272
					"public class X<A extends X1<X2<X3<String>>>> {\n" + 
2273
					"	A a;\n" +
2274
					"	public static void main(String[] args) {\n" + 
2275
					"		X<X1<X2<X3<String>>>> x = new X<X1<X2<X3<String>>>>();\n" + 
2276
					"		x.a = new X1<X2<X3<String>>>();\n" + 
2277
					"		x.a.a1 = new X2<X3<String>>();\n" + 
2278
					"		x.a.a1.a2 = new X3<String>();\n" + 
2279
					"		x.a.a1.a2.a3 = \"SUCCESS\";\n" + 
2280
					"		System.out.println(x.a.a1.a2.a3);\n" + 
2281
					"	}\n" + 
2282
					"}\n" + 
2283
					"class X1<A extends X2<X3<String>>> {\n" + 
2284
					"	A a1;\n" +
2285
					"}\n" + 
2286
					"class X2<A extends X3<String>> {\n" + 
2287
					"	A a2;\n" +
2288
					"}\n" + 
2289
					"class X3<A> {\n" + 
2290
					"	A a3;\n" +
2291
					"}\n"
2292
			},
2293
			"SUCCESS" 
2294
		);
2295
	}
2296
	// TODO (david) remove errors: insert dimension to complete array type
2297
	public void test0080() {
2298
		this.runNegativeTest(
2299
			new String[] {
2300
				"test/X.java",
2301
				"package test;\n" +
2302
					"public class X<A extends X1<X2<X3<String>>> {}\n" + 
2303
					"class X1<A extends X2<X3<String>> {}\n" + 
2304
					"class X2<A extends X3<String> {}\n" + 
2305
					"class X3<A {}\n"
2306
			},
2307
			"----------\n" + 
2308
			"1. ERROR in test\\X.java (at line 2)\n" + 
2309
			"	public class X<A extends X1<X2<X3<String>>> {}\n" + 
2310
			"	                                        ^^^\n" + 
2311
			"Syntax error, insert \">\" to complete ReferenceType1\n" + 
2312
			"----------\n" + 
2313
			"2. ERROR in test\\X.java (at line 3)\n" + 
2314
			"	class X1<A extends X2<X3<String>> {}\n" + 
2315
			"	                               ^^\n" + 
2316
			"Syntax error, insert \">\" to complete ReferenceType1\n" + 
2317
			"----------\n" + 
2318
			"3. ERROR in test\\X.java (at line 4)\n" + 
2319
			"	class X2<A extends X3<String> {}\n" + 
2320
			"	                            ^\n" + 
2321
			"Syntax error, insert \">\" to complete ReferenceType1\n" + 
2322
			"----------\n" + 
2323
			"4. ERROR in test\\X.java (at line 5)\n" + 
2324
			"	class X3<A {}\n" + 
2325
			"	         ^\n" + 
2326
			"Syntax error on token \"A\", > expected after this token\n" + 
2327
			"----------\n"
2328
		);
2329
	}
2330
	// TODO (david) remove errors: insert dimension to complete array type
2331
	public void test0081() {
2332
		this.runNegativeTest(
2333
			new String[] {
2334
				"test/X.java",
2335
				"package test;\n" +
2336
					"public class X<A extends X1<X2<X3<String>> {}\n" + 
2337
					"class X1<A extends X2<X3<String> {}\n" + 
2338
					"class X2<A extends X3<String {}\n" + 
2339
					"class X3<A> {}\n"
2340
			},
2341
			"----------\n" + 
2342
			"1. ERROR in test\\X.java (at line 2)\n" + 
2343
			"	public class X<A extends X1<X2<X3<String>> {}\n" + 
2344
			"	                                        ^^\n" + 
2345
			"Syntax error, insert \">>\" to complete ReferenceType2\n" + 
2346
			"----------\n" + 
2347
			"2. ERROR in test\\X.java (at line 3)\n" + 
2348
			"	class X1<A extends X2<X3<String> {}\n" + 
2349
			"	                               ^\n" + 
2350
			"Syntax error, insert \">>\" to complete ReferenceType2\n" + 
2351
			"----------\n" + 
2352
			"3. ERROR in test\\X.java (at line 4)\n" + 
2353
			"	class X2<A extends X3<String {}\n" + 
2354
			"	                      ^^^^^^\n" + 
2355
			"Syntax error, insert \">>\" to complete ReferenceType2\n" + 
2356
			"----------\n"
2357
		);
2358
	}
2359
	// TODO (david) remove error: insert dimension to complete array type
2360
	public void test0082() {
2361
		this.runNegativeTest(
2362
			new String[] {
2363
				"test/X.java",
2364
				"package test;\n" +
2365
					"public class X<A extends X1<X2<X3<String> {}\n" + 
2366
					"class X1<A extends X2<X3<String {}\n" + 
2367
					"class X2<A extends X3<String>> {}\n" + 
2368
					"class X3<A> {}\n"
2369
			},
2370
			"----------\n" + 
2371
			"1. ERROR in test\\X.java (at line 2)\n" + 
2372
			"	public class X<A extends X1<X2<X3<String> {}\n" + 
2373
			"	                                        ^\n" + 
2374
			"Syntax error, insert \">>>\" to complete ReferenceType3\n" + 
2375
			"----------\n" + 
2376
			"2. ERROR in test\\X.java (at line 3)\n" + 
2377
			"	class X1<A extends X2<X3<String {}\n" + 
2378
			"	                         ^^^^^^\n" + 
2379
			"Syntax error, insert \">>>\" to complete ReferenceType3\n" + 
2380
			"----------\n"
2381
		);
2382
	}
2383
	// TODO (david) remove error: insert dimension to complete array type
2384
	public void test0083() {
2385
		this.runNegativeTest(
2386
			new String[] {
2387
				"test/X.java",
2388
				"package test;\n" +
2389
					"public class X<A extends X1<X2<X3<String {}\n" + 
2390
					"class X1<A extends X2<X3<String>>> {}\n" + 
2391
					"class X2<A extends X3<String>> {}\n" + 
2392
					"class X3<A> {}\n"
2393
			},
2394
			"----------\n" + 
2395
			"1. ERROR in test\\X.java (at line 2)\n" + 
2396
			"	public class X<A extends X1<X2<X3<String {}\n" + 
2397
			"	                                  ^^^^^^\n" + 
2398
			"Syntax error, insert \">>>\" to complete ReferenceType3\n" + 
2399
			"----------\n" + 
2400
			"2. ERROR in test\\X.java (at line 2)\n" + 
2401
			"	public class X<A extends X1<X2<X3<String {}\n" + 
2402
			"	                                  ^^^^^^\n" + 
2403
			"Syntax error, insert \">\" to complete ReferenceType1\n" + 
2404
			"----------\n");
2405
	}
2406
	public void test0084() {
2407
		this.runNegativeTest(
2408
			new String[] {
2409
				"X.java",
2410
				"public class X {\n" + 
2411
				"    X(AX<String> a, AX<String> b) {\n" + 
2412
				"    }\n" + 
2413
				"    void foo(AX<String> a) {\n" + 
2414
				"    }\n" + 
2415
				"    public static void main(String[] args) {\n" + 
2416
				"        X x = new X((AX)null, (AX)null);\n" + 
2417
				"        AX a = new AX((AX)null);\n" + 
2418
				"        AX a2 = new AX(null);\n" + 
2419
				"		x.foo(a);\n" + 
2420
				"		a.foo(a);\n" + 
2421
				"		a.bar(a);\n" + 
2422
				"		AX<String> as = new AX<String>(null);\n" + 
2423
				"		as.print(a);\n" + 
2424
				"		as.bar(a);\n" + 
2425
				"	}\n" + 
2426
				"}\n" + 
2427
				"class AX <P> {\n" + 
2428
				"    AX(AX<P> ax){}\n" + 
2429
				"    AX(P p){}\n" + 
2430
				"    void print(P p){}\n" + 
2431
				"    void foo(AX rawAx){}\n" + 
2432
				"    void bar(AX<P> ax){}\n" + 
2433
				"}\n",
2434
			},
2435
			"----------\n" + 
2436
			"1. WARNING in X.java (at line 7)\n" + 
2437
			"	X x = new X((AX)null, (AX)null);\n" + 
2438
			"	            ^^^^^^^^\n" + 
2439
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<String>\n" + 
2440
			"----------\n" + 
2441
			"2. WARNING in X.java (at line 7)\n" + 
2442
			"	X x = new X((AX)null, (AX)null);\n" + 
2443
			"	             ^^\n" + 
2444
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2445
			"----------\n" + 
2446
			"3. WARNING in X.java (at line 7)\n" + 
2447
			"	X x = new X((AX)null, (AX)null);\n" + 
2448
			"	                      ^^^^^^^^\n" + 
2449
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<String>\n" + 
2450
			"----------\n" + 
2451
			"4. WARNING in X.java (at line 7)\n" + 
2452
			"	X x = new X((AX)null, (AX)null);\n" + 
2453
			"	                       ^^\n" + 
2454
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2455
			"----------\n" + 
2456
			"5. WARNING in X.java (at line 8)\n" + 
2457
			"	AX a = new AX((AX)null);\n" + 
2458
			"	^^\n" + 
2459
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2460
			"----------\n" + 
2461
			"6. WARNING in X.java (at line 8)\n" + 
2462
			"	AX a = new AX((AX)null);\n" + 
2463
			"	       ^^^^^^^^^^^^^^^^\n" + 
2464
			"Type safety: The constructor AX(AX) belongs to the raw type AX. References to generic type AX<P> should be parameterized\n" + 
2465
			"----------\n" + 
2466
			"7. WARNING in X.java (at line 8)\n" + 
2467
			"	AX a = new AX((AX)null);\n" + 
2468
			"	           ^^\n" + 
2469
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2470
			"----------\n" + 
2471
			"8. WARNING in X.java (at line 8)\n" + 
2472
			"	AX a = new AX((AX)null);\n" + 
2473
			"	               ^^\n" + 
2474
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2475
			"----------\n" + 
2476
			"9. WARNING in X.java (at line 9)\n" + 
2477
			"	AX a2 = new AX(null);\n" + 
2478
			"	^^\n" + 
2479
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2480
			"----------\n" + 
2481
			"10. WARNING in X.java (at line 9)\n" + 
2482
			"	AX a2 = new AX(null);\n" + 
2483
			"	        ^^^^^^^^^^^^\n" + 
2484
			"Type safety: The constructor AX(AX) belongs to the raw type AX. References to generic type AX<P> should be parameterized\n" + 
2485
			"----------\n" + 
2486
			"11. WARNING in X.java (at line 9)\n" + 
2487
			"	AX a2 = new AX(null);\n" + 
2488
			"	            ^^\n" + 
2489
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2490
			"----------\n" + 
2491
			"12. WARNING in X.java (at line 10)\n" + 
2492
			"	x.foo(a);\n" + 
2493
			"	      ^\n" + 
2494
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<String>\n" + 
2495
			"----------\n" + 
2496
			"13. WARNING in X.java (at line 12)\n" + 
2497
			"	a.bar(a);\n" + 
2498
			"	^^^^^^^^\n" + 
2499
			"Type safety: The method bar(AX) belongs to the raw type AX. References to generic type AX<P> should be parameterized\n" + 
2500
			"----------\n" + 
2501
			"14. ERROR in X.java (at line 13)\n" + 
2502
			"	AX<String> as = new AX<String>(null);\n" + 
2503
			"	                ^^^^^^^^^^^^^^^^^^^^\n" + 
2504
			"The constructor AX<String>(AX<String>) is ambiguous\n" + 
2505
			"----------\n" + 
2506
			"15. ERROR in X.java (at line 14)\n" + 
2507
			"	as.print(a);\n" + 
2508
			"	   ^^^^^\n" + 
2509
			"The method print(String) in the type AX<String> is not applicable for the arguments (AX)\n" + 
2510
			"----------\n" + 
2511
			"16. WARNING in X.java (at line 15)\n" + 
2512
			"	as.bar(a);\n" + 
2513
			"	       ^\n" + 
2514
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<String>\n" + 
2515
			"----------\n" + 
2516
			"17. WARNING in X.java (at line 22)\n" + 
2517
			"	void foo(AX rawAx){}\n" + 
2518
			"	         ^^\n" + 
2519
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2520
			"----------\n");
2521
	}		
2522
2523
	public void test0085() {
2524
		this.runConformTest(
2525
			new String[] {
2526
				"X.java",
2527
				"public class X<T> {\n" + 
2528
				"    \n" + 
2529
				"    public static void main(String[] args) {\n" + 
2530
				"        AX ax = new AX();\n" + 
2531
				"        X x = (X)ax.p;\n" + 
2532
				"        System.out.println(x);\n" + 
2533
				"    }\n" + 
2534
				"}\n" + 
2535
				"\n" + 
2536
				"class AX <P> {\n" + 
2537
				"    \n" + 
2538
				"    P p;\n" + 
2539
				"}\n",
2540
			},
2541
		"null");
2542
	}		
2543
2544
	public void test0086() {
2545
		Map customOptions = getCompilerOptions();
2546
		this.runNegativeTest(
2547
			new String[] {
2548
				"X.java",
2549
				"public class X<T> {\n" + 
2550
				"    \n" + 
2551
				"    public static void main(String[] args) {\n" + 
2552
				"        AX ax = new AX();\n" + 
2553
				"        AX ax2 = ax.p;\n" + 
2554
				"        ax.p = new AX<String>();\n" + 
2555
				"        System.out.println(ax2);\n" + 
2556
				"    }\n" + 
2557
				"}\n" + 
2558
				"\n" + 
2559
				"class AX <P> {\n" + 
2560
				"    AX<P> p;\n" + 
2561
				"}\n",
2562
			},
2563
			"----------\n" + 
2564
			"1. WARNING in X.java (at line 4)\n" + 
2565
			"	AX ax = new AX();\n" + 
2566
			"	^^\n" + 
2567
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2568
			"----------\n" + 
2569
			"2. WARNING in X.java (at line 4)\n" + 
2570
			"	AX ax = new AX();\n" + 
2571
			"	            ^^\n" + 
2572
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2573
			"----------\n" + 
2574
			"3. WARNING in X.java (at line 5)\n" + 
2575
			"	AX ax2 = ax.p;\n" + 
2576
			"	^^\n" + 
2577
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2578
			"----------\n" + 
2579
			"4. WARNING in X.java (at line 6)\n" + 
2580
			"	ax.p = new AX<String>();\n" + 
2581
			"	   ^\n" + 
2582
			"Type safety: The field p from the raw type AX is assigned a value of type AX<String>. References to generic type AX<P> should be parameterized\n" + 
2583
			"----------\n",
2584
		null,
2585
		true,
2586
		customOptions);		
2587
	}		
2588
	
2589
	public void test0087() {
2590
		Map customOptions = getCompilerOptions();
2591
		// check no unsafe type operation problem is issued
2592
		customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);			    
2593
		customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
2594
		this.runConformTest(
2595
			new String[] {
2596
				"X.java",
2597
				"public class X<T> {\n" + 
2598
				"    \n" + 
2599
				"    public static void main(String[] args) {\n" + 
2600
				"        AX ax = new AX();\n" + 
2601
				"        AX ax2 = ax.p;\n" + 
2602
				"        AX ax3 = new AX<String>();\n" + 
2603
				"        System.out.println(\"SUCCESS\");\n" + 
2604
				"    }\n" + 
2605
				"}\n" + 
2606
				"\n" + 
2607
				"class AX <P> {\n" + 
2608
				"    AX<P> p;\n" + 
2609
				"}\n",
2610
			},
2611
		"SUCCESS",
2612
		null,
2613
		true,
2614
		null,
2615
		customOptions,
2616
		null/*no custom requestor*/);		
2617
	}			
2618
	
2619
	private void runConformTest(String[] strings,
2620
            String string,
2621
            Object object,
2622
            boolean b,
2623
            Object object2,
2624
            Map customOptions,
2625
            Object object3) {
2626
	    // TODO Auto-generated method stub
2627
	    
2628
    }
2629
2630
	public void test0088() {
2631
		Map customOptions = getCompilerOptions();
2632
		// check no unsafe type operation problem is issued
2633
		customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);			    
2634
		customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
2635
		this.runConformTest(
2636
			new String[] {
2637
				"X.java",
2638
				"public class X<T> {\n" + 
2639
				"     AX ax = new AX();\n" + 
2640
				"     AX ax2 = ax.p;\n" + 
2641
				"     AX ax3 = new AX<String>();\n" + 
2642
				"}\n" + 
2643
				"\n" + 
2644
				"class AX <P> {\n" + 
2645
				"    AX<P> p;\n" + 
2646
				"}\n",
2647
			},
2648
		"",
2649
		null,
2650
		true,
2651
		null,
2652
		customOptions,
2653
		null/*no custom requestor*/);		
2654
	}				
2655
2656
	public void test0089() {
2657
		this.runConformTest(
2658
			new String[] {
2659
				"X.java",
2660
				"public class X<T> {\n" + 
2661
				"    T q;\n" + 
2662
				"     public static void main(String[] args) {\n" + 
2663
				"         X<String[]> xss = new X<String[]>();\n" + 
2664
				"         X<X<String[]>> xxs = new X<X<String[]>>();\n" + 
2665
				"         xxs.q = xss;\n" + 
2666
				"         System.out.println(\"SUCCESS\");\n" + 
2667
				"     }\n" + 
2668
				"}\n",
2669
			},
2670
		"SUCCESS");
2671
	}				
2672
2673
	public void test0090() {
2674
		Map customOptions = getCompilerOptions();
2675
		// check no unsafe type operation problem is issued
2676
		customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);			    
2677
		this.runConformTest(
2678
			new String[] {
2679
				"X.java",
2680
				"public class X<T> {\n" + 
2681
				"    T q;\n" + 
2682
				"    \n" + 
2683
				"     public static void main(String[] args) {\n" + 
2684
				"         X<String[]> xss = new X<String[]>();\n" + 
2685
				"         X<X<String[]>> xxs = new X<X<String[]>>();\n" + 
2686
				"         xxs.q = xss;\n" + 
2687
				"         System.out.println(\"SUCCESS\");\n" + 
2688
				"     }\n" + 
2689
				"      void foo(X[] xs) {\n" + 
2690
				"          xs[0] = new X<String>();\n" + 
2691
				"     }\n" +
2692
				"}\n",
2693
			},
2694
		"SUCCESS",
2695
		null,
2696
		true,
2697
		null,
2698
		customOptions,
2699
		null/*no custom requestor*/);		
2700
	}				
2701
2702
	public void test0091() {
2703
		this.runConformTest(
2704
			new String[] {
2705
				"X.java",
2706
				"public class X<T> {\n" + 
2707
				"      void foo(X<String>[] xs) {\n" + 
2708
				"     }\n" +
2709
				"}\n",
2710
			},
2711
			"");		
2712
	}				
2713
2714
	public void test0092() {
2715
		this.runNegativeTest(
2716
			new String[] {
2717
				"X.java",
2718
				"public class X<T> {\n" + 
2719
				"    T t;\n" + 
2720
				"    X(T t) {\n" + 
2721
				"        this.t = t;\n" + 
2722
				"    }\n" + 
2723
				"     void foo() {\n" + 
2724
				"         X<String> xs = new X<String>(\"\");\n" + 
2725
				"         X<String> xs2 = (X<String>) xs;\n" + 
2726
				"         \n" + 
2727
				"         ((X)xs).t = this;\n" + 
2728
				"         \n" + 
2729
				"         System.out.prinln((T) this.t);\n" + 
2730
				"     }\n" + 
2731
				"     public static void main(String[] args) {\n" + 
2732
				"		new X<String>(\"SUCCESS\").foo();\n" + 
2733
				"	}\n" + 
2734
				"}\n",
2735
			},
2736
			"----------\n" + 
2737
			"1. WARNING in X.java (at line 8)\n" + 
2738
			"	X<String> xs2 = (X<String>) xs;\n" + 
2739
			"	                ^^^^^^^^^^^^^^\n" + 
2740
			"Unnecessary cast from X<String> to X<String>\n" + 
2741
			"----------\n" + 
2742
			"2. WARNING in X.java (at line 10)\n" + 
2743
			"	((X)xs).t = this;\n" + 
2744
			"	  ^\n" + 
2745
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
2746
			"----------\n" + 
2747
			"3. WARNING in X.java (at line 10)\n" + 
2748
			"	((X)xs).t = this;\n" + 
2749
			"	        ^\n" + 
2750
			"Type safety: The field t from the raw type X is assigned a value of type X<T>. References to generic type X<T> should be parameterized\n" + 
2751
			"----------\n" + 
2752
			"4. ERROR in X.java (at line 12)\n" + 
2753
			"	System.out.prinln((T) this.t);\n" + 
2754
			"	           ^^^^^^\n" + 
2755
			"The method prinln(T) is undefined for the type PrintStream\n" + 
2756
			"----------\n");
2757
	}		
2758
2759
	// **
2760
	public void test0093() {
2761
		this.runConformTest(
2762
			new String[] {
2763
				"X.java",
2764
				"public class X<T> {\n" + 
2765
				"    public static void main(String[] args) {\n" + 
2766
				"        AX ax = new AX();\n" + 
2767
				"        AX ax2 = new AX();\n" + 
2768
				"        ax.p = ax2.p;\n" +
2769
				"        System.out.println(\"SUCCESS\");\n" + 
2770
				"    }\n" + 
2771
				"}\n" + 
2772
				"class AX <P> {\n" + 
2773
				"    AX<P> p;\n" + 
2774
				"}\n",
2775
			},
2776
		"SUCCESS");		
2777
	}		
2778
	
2779
	// same as test001, but every type is now a SourceTypeBinding
2780
	public void test0094() {
2781
		this.runConformTest(
2782
			new String[] {
2783
				"X.java",
2784
				"public class X<Tx1 extends S, Tx2 extends C>  extends XS<Tx2> {\n" + 
2785
				"\n" + 
2786
				"    public static void main(String[] args) {\n" + 
2787
				"        I w = new X<S,I>().get(new I());\n" + 
2788
				"        System.out.println(\"SUCCESS\");\n" + 
2789
				"    }\n" + 
2790
				"}\n" + 
2791
				"class S {}\n" +
2792
				"class I implements C<I> {}\n" + 
2793
				"interface C<Tc> {}\n" +
2794
				"class XS <Txs> {\n" + 
2795
				"    Txs get(Txs t) {\n" + 
2796
				"        return t;\n" + 
2797
				"    }\n" + 
2798
				"}\n"
2799
			},
2800
			"SUCCESS");
2801
	}
2802
	public void test0095() {
2803
		this.runConformTest(
2804
			new String[] {
2805
				"X.java",
2806
				"public class X<Tx1 extends S, Tx2 extends C>  extends XS<Tx2> {\n" + 
2807
				"\n" + 
2808
				"    public static void main(String[] args) {\n" + 
2809
				"        I w = new X<S,I>().get(new I());\n" + 
2810
				"        System.out.println(\"SUCCESS\");\n" + 
2811
				"    }\n" + 
2812
				"}\n" + 
2813
				"class S {}\n" +
2814
				"class I implements C {}\n" + 
2815
				"interface C<Tc> {}\n" +
2816
				"class XS <Txs> {\n" + 
2817
				"    Txs get(Txs t) {\n" + 
2818
				"        return t;\n" + 
2819
				"    }\n" + 
2820
				"}\n"
2821
			},
2822
			"SUCCESS");
2823
	}	
2824
	public void test0096() {
2825
		this.runNegativeTest(
2826
			new String[] {
2827
				"X.java",
2828
				"public class X<T> extends X {}\n"
2829
			},
2830
			"----------\n" + 
2831
			"1. ERROR in X.java (at line 1)\n" + 
2832
			"	public class X<T> extends X {}\n" + 
2833
			"	                          ^\n" + 
2834
			"Cycle detected: the type X<T> cannot extend/implement itself or one of its own member types\n" + 
2835
			"----------\n");
2836
	}
2837
	public void test0097() {
2838
		this.runNegativeTest(
2839
			new String[] {
2840
				"X.java",
2841
				"public class X<T> extends X<String> {}\n"
2842
			},
2843
			"----------\n" + 
2844
			"1. ERROR in X.java (at line 1)\n" + 
2845
			"	public class X<T> extends X<String> {}\n" + 
2846
			"	                          ^\n" + 
2847
			"Cycle detected: the type X<T> cannot extend/implement itself or one of its own member types\n" + 
2848
			"----------\n");
2849
	}	
2850
	public void test0098() {
2851
		Map customOptions = getCompilerOptions();
2852
		customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);			    
2853
		this.runNegativeTest(
2854
			new String[] {
2855
				"X.java",
2856
				"public class X<T> {\n" + 
2857
				"    \n" + 
2858
				"    public static void main(String[] args) {\n" + 
2859
				"        AX ax = new AX();\n" + 
2860
				"        AX ax2 = ax.p;\n" + 
2861
				"        ax.p = new AX<String>();\n" + 
2862
				"        ax.q = new AX<String>();\n" + 
2863
				"        ax.r = new AX<Object>();\n" + 
2864
				"        ax.s = new AX<String>();\n" + 
2865
				"        System.out.println(ax2);\n" + 
2866
				"    }\n" + 
2867
				"}\n" + 
2868
				"\n" + 
2869
				"class AX <P> {\n" + 
2870
				"    AX<P> p;\n" + 
2871
				"    AX<Object> q;\n" + 
2872
				"    AX<String> r;\n" + 
2873
				"    BX<String> s;\n" + 
2874
				"}\n" + 
2875
				"\n" + 
2876
				"class BX<Q> {\n" + 
2877
				"}\n",
2878
			},
2879
			"----------\n" + 
2880
			"1. WARNING in X.java (at line 4)\n" + 
2881
			"	AX ax = new AX();\n" + 
2882
			"	^^\n" + 
2883
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2884
			"----------\n" + 
2885
			"2. WARNING in X.java (at line 4)\n" + 
2886
			"	AX ax = new AX();\n" + 
2887
			"	            ^^\n" + 
2888
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2889
			"----------\n" + 
2890
			"3. WARNING in X.java (at line 5)\n" + 
2891
			"	AX ax2 = ax.p;\n" + 
2892
			"	^^\n" + 
2893
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2894
			"----------\n" + 
2895
			"4. ERROR in X.java (at line 6)\n" + 
2896
			"	ax.p = new AX<String>();\n" + 
2897
			"	   ^\n" + 
2898
			"Type safety: The field p from the raw type AX is assigned a value of type AX<String>. References to generic type AX<P> should be parameterized\n" + 
2899
			"----------\n" + 
2900
			"5. ERROR in X.java (at line 7)\n" + 
2901
			"	ax.q = new AX<String>();\n" + 
2902
			"	   ^\n" + 
2903
			"Type safety: The field q from the raw type AX is assigned a value of type AX<String>. References to generic type AX<P> should be parameterized\n" + 
2904
			"----------\n" + 
2905
			"6. ERROR in X.java (at line 8)\n" + 
2906
			"	ax.r = new AX<Object>();\n" + 
2907
			"	   ^\n" + 
2908
			"Type safety: The field r from the raw type AX is assigned a value of type AX<Object>. References to generic type AX<P> should be parameterized\n" + 
2909
			"----------\n" + 
2910
			"7. ERROR in X.java (at line 9)\n" + 
2911
			"	ax.s = new AX<String>();\n" + 
2912
			"	       ^^^^^^^^^^^^^^^^\n" + 
2913
			"Type mismatch: cannot convert from AX<String> to BX\n" + 
2914
			"----------\n",
2915
		null,
2916
		true,
2917
		customOptions);		
2918
	}				
2919
	// wildcard bound cannot be base type
2920
	// TODO (david) only syntax error should be related to wilcard bound being a base type. Ripple effect is severe here.
2921
	public void test0099() {
2922
		this.runNegativeTest(
2923
			new String[] {
2924
				"X.java",
2925
				"public class X  <T extends AX<? super int>> {\n" + 
2926
				"    public static void main(String[] args) {\n" + 
2927
				"		AX<String> ax;\n" + 
2928
				"		System.out.println(\"SUCCESS\");\n" + 
2929
				"	}\n" + 
2930
				"	void foo(X<?> x) {\n" + 
2931
				"	}\n" + 
2932
				"}\n" + 
2933
				"\n" + 
2934
				"class AX<P> {\n" + 
2935
				"}\n",
2936
			},
2937
		"----------\n" + 
2938
		"1. ERROR in X.java (at line 1)\n" + 
2939
		"	public class X  <T extends AX<? super int>> {\n" + 
2940
		"	                                      ^^^\n" + 
2941
		"Syntax error on token \"int\", Dimensions expected after this token\n" + 
2942
		"----------\n");		
2943
	}		
2944
2945
	// type parameterized with wildcard cannot appear in allocation
2946
	public void test0100() {
2947
		this.runNegativeTest(
2948
			new String[] {
2949
				"X.java",
2950
				"public class X <T> {\n" + 
2951
				"    T t;\n" + 
2952
				"    X(T t){\n" + 
2953
				"        this.t = t;\n" + 
2954
				"    }\n" + 
2955
				"    public static void main(String[] args) {\n" + 
2956
				"		X<? extends AX> x = new X<? extends AX>(new AX<String>());\n" + 
2957
				"		System.out.println(\"SUCCESS\");\n" + 
2958
				"	}\n" + 
2959
				"}\n" + 
2960
				"\n" + 
2961
				"class AX<P> {\n" + 
2962
				"    P foo() { return null; }\n" + 
2963
				"}\n",
2964
			},
2965
			"----------\n" + 
2966
			"1. WARNING in X.java (at line 7)\n" + 
2967
			"	X<? extends AX> x = new X<? extends AX>(new AX<String>());\n" + 
2968
			"	            ^^\n" + 
2969
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2970
			"----------\n" + 
2971
			"2. ERROR in X.java (at line 7)\n" + 
2972
			"	X<? extends AX> x = new X<? extends AX>(new AX<String>());\n" + 
2973
			"	                        ^\n" + 
2974
			"Cannot instantiate the type X<? extends AX>\n" + 
2975
			"----------\n" + 
2976
			"3. WARNING in X.java (at line 7)\n" + 
2977
			"	X<? extends AX> x = new X<? extends AX>(new AX<String>());\n" + 
2978
			"	                                    ^^\n" + 
2979
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
2980
			"----------\n");	
2981
	}		
2982
2983
	// wilcard may not pass parameter bound check
2984
	public void test0101() {
2985
		this.runNegativeTest(
2986
			new String[] {
2987
				"X.java",
2988
				"public class X <T extends String> {\n" + 
2989
				"    T t;\n" + 
2990
				"    X(T t){\n" + 
2991
				"        this.t = t;\n" + 
2992
				"    }\n" + 
2993
				"    public static void main(String[] args) {\n" + 
2994
				"		X<? extends AX> x = new X<AX<String>>(new AX<String>());\n" + 
2995
				"		x.t.foo(\"SUCCESS\");\n" + 
2996
				"	}\n" + 
2997
				"}\n" + 
2998
				"\n" + 
2999
				"class AX<P> {\n" + 
3000
				"   void foo(P p) { \n" + 
3001
				"		System.out.println(p);\n" + 
3002
				"   }\n" + 
3003
				"}\n" + 
3004
				"\n",
3005
			},
3006
			"----------\n" + 
3007
			"1. WARNING in X.java (at line 1)\n" + 
3008
			"	public class X <T extends String> {\n" + 
3009
			"	                          ^^^^^^\n" + 
3010
			"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
3011
			"----------\n" + 
3012
			"2. ERROR in X.java (at line 7)\n" + 
3013
			"	X<? extends AX> x = new X<AX<String>>(new AX<String>());\n" + 
3014
			"	  ^^^^^^^^^^^^\n" + 
3015
			"Bound mismatch: The type ? extends AX is not a valid substitute for the bounded parameter <T extends String> of the type X<T>\n" + 
3016
			"----------\n" + 
3017
			"3. WARNING in X.java (at line 7)\n" + 
3018
			"	X<? extends AX> x = new X<AX<String>>(new AX<String>());\n" + 
3019
			"	            ^^\n" + 
3020
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
3021
			"----------\n" + 
3022
			"4. ERROR in X.java (at line 7)\n" + 
3023
			"	X<? extends AX> x = new X<AX<String>>(new AX<String>());\n" + 
3024
			"	                          ^^\n" + 
3025
			"Bound mismatch: The type AX<String> is not a valid substitute for the bounded parameter <T extends String> of the type X<T>\n" + 
3026
			"----------\n" + 
3027
			"5. WARNING in X.java (at line 8)\n" + 
3028
			"	x.t.foo(\"SUCCESS\");\n" + 
3029
			"	^^^^^^^^^^^^^^^^^^\n" + 
3030
			"Type safety: The method foo(Object) belongs to the raw type AX. References to generic type AX<P> should be parameterized\n" + 
3031
			"----------\n");		
3032
	}		
3033
	// unbound wildcard implicitly bound by matching parameter bounds
3034
	public void test0102() {
3035
		this.runNegativeTest(
3036
			new String[] {
3037
				"X.java",
3038
				"public class X <T extends AX> {\n" + 
3039
				"    T t;\n" + 
3040
				"    X(T t){\n" + 
3041
				"        this.t = t;\n" + 
3042
				"    }\n" + 
3043
				"    public static void main(String[] args) {\n" + 
3044
				"		X<?> x = new X<BX<String>>(new BX<String>());\n" + 
3045
				"		x.t.foo(\"SUCC\");\n" + 
3046
				"		x.t.bar(\"ESS\");\n" + 
3047
				"	}\n" + 
3048
				"}\n" + 
3049
				"\n" + 
3050
				"class AX<P> {\n" + 
3051
				"   void foo(P p) { \n" + 
3052
				"		System.out.print(p);\n" + 
3053
				"   }\n" + 
3054
				"}\n" + 
3055
				"\n" + 
3056
				"class BX<Q> extends AX<Q> {\n" + 
3057
				"   void bar(Q q) { \n" + 
3058
				"		System.out.println(q);\n" + 
3059
				"   }\n" + 
3060
				"}\n",
3061
			},
3062
			"----------\n" + 
3063
			"1. WARNING in X.java (at line 1)\n" + 
3064
			"	public class X <T extends AX> {\n" + 
3065
			"	                          ^^\n" + 
3066
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
3067
			"----------\n" + 
3068
			"2. WARNING in X.java (at line 8)\n" + 
3069
			"	x.t.foo(\"SUCC\");\n" + 
3070
			"	^^^^^^^^^^^^^^^\n" + 
3071
			"Type safety: The method foo(Object) belongs to the raw type AX. References to generic type AX<P> should be parameterized\n" + 
3072
			"----------\n" + 
3073
			"3. ERROR in X.java (at line 9)\n" + 
3074
			"	x.t.bar(\"ESS\");\n" + 
3075
			"	    ^^^\n" + 
3076
			"The method bar(String) is undefined for the type capture#2-of ?\n" + 
3077
			"----------\n");		
3078
	}		
3079
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85303
3080
	public void test0103() {
3081
		this.runConformTest(
3082
			new String[] {
3083
				"X.java",
3084
				"public class X <T extends AX> {\n" + 
3085
				"    T t;\n" + 
3086
				"    X(T t){\n" + 
3087
				"        this.t = t;\n" + 
3088
				"    }\n" + 
3089
				"    public static void main(String[] args) {\n" + 
3090
				"		X<? extends BX> x = new X<BX<String>>(new BX<String>());\n" + 
3091
				"		x.t.foo(\"SUCC\");\n" + 
3092
				"		x.t.bar(\"ESS\");\n" + 
3093
				"	}\n" + 
3094
				"}\n" + 
3095
				"\n" + 
3096
				"class AX<P> {\n" + 
3097
				"   void foo(P p) { \n" + 
3098
				"		System.out.print(p);\n" + 
3099
				"   }\n" + 
3100
				"}\n" + 
3101
				"\n" + 
3102
				"class BX<Q> extends AX<Q> {\n" + 
3103
				"   void bar(Q q) { \n" + 
3104
				"		System.out.println(q);\n" + 
3105
				"   }\n" + 
3106
				"}\n",
3107
			},
3108
			"SUCCESS");		
3109
		String expectedOutput =
3110
			"  // Method descriptor #25 ([Ljava/lang/String;)V\n" + 
3111
			"  // Stack: 4, Locals: 2\n" + 
3112
			"  public static void main(java.lang.String[] args);\n" + 
3113
			"     0  new X [1]\n" + 
3114
			"     3  dup\n" + 
3115
			"     4  new BX [26]\n" + 
3116
			"     7  dup\n" + 
3117
			"     8  invokespecial BX() [28]\n" + 
3118
			"    11  invokespecial X(AX) [29]\n" + 
3119
			"    14  astore_1 [x]\n" + 
3120
			"    15  aload_1 [x]\n" + 
3121
			"    16  getfield X.t : AX [16]\n" + 
3122
			"    19  checkcast BX [26]\n" + 
3123
			"    22  ldc <String \"SUCC\"> [31]\n" + 
3124
			"    24  invokevirtual BX.foo(java.lang.Object) : void [33]\n" + 
3125
			"    27  aload_1 [x]\n" + 
3126
			"    28  getfield X.t : AX [16]\n" + 
3127
			"    31  checkcast BX [26]\n" + 
3128
			"    34  ldc <String \"ESS\"> [37]\n" + 
3129
			"    36  invokevirtual BX.bar(java.lang.Object) : void [39]\n" + 
3130
			"    39  return\n" + 
3131
			"      Line numbers:\n" + 
3132
			"        [pc: 0, line: 7]\n" + 
3133
			"        [pc: 15, line: 8]\n" + 
3134
			"        [pc: 27, line: 9]\n" + 
3135
			"        [pc: 39, line: 10]\n" + 
3136
			"      Local variable table:\n" + 
3137
			"        [pc: 0, pc: 40] local: args index: 0 type: java.lang.String[]\n" + 
3138
			"        [pc: 15, pc: 40] local: x index: 1 type: X\n" + 
3139
			"      Local variable type table:\n" + 
3140
			"        [pc: 15, pc: 40] local: x index: 1 type: X<? extends BX>\n";
3141
		
3142
		try {
3143
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
3144
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
3145
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
3146
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
3147
			int index = result.indexOf(expectedOutput);
3148
			if (index == -1 || expectedOutput.length() == 0) {
3149
				System.out.println(Util.displayString(result, 3));
3150
			}
3151
			if (index == -1) {
3152
				assertEquals("Wrong contents", expectedOutput, result);
3153
			}
3154
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
3155
			assertTrue(false);
3156
		} catch (IOException e) {
3157
			assertTrue(false);
3158
		}
3159
	}
3160
3161
	private void assertTrue(boolean b) {
3162
	    // TODO Auto-generated method stub
3163
	    
3164
    }
3165
3166
	private void assertEquals(String string, String expectedOutput, String result) {
3167
	    // TODO Auto-generated method stub
3168
	    
3169
    }
3170
3171
	// wildcard bound check
3172
	public void test0104() {
3173
		this.runNegativeTest(
3174
			new String[] {
3175
				"X.java",
3176
				"public class X <T extends AX> {\n" + 
3177
				"    T t;\n" + 
3178
				"    X(T t){\n" + 
3179
				"        this.t = t;\n" + 
3180
				"    }\n" + 
3181
				"    public static void main(String[] args) {\n" + 
3182
				"		X<? extends BX> x = new X<AX<String>>(new AX<String>());\n" + 
3183
				"		x.t.foo(\"SUCC\");\n" + 
3184
				"		x.t.bar(\"ESS\");\n" + 
3185
				"	}\n" + 
3186
				"}\n" + 
3187
				"\n" + 
3188
				"class AX<P> {\n" + 
3189
				"   void foo(P p) { \n" + 
3190
				"		System.out.print(p);\n" + 
3191
				"   }\n" + 
3192
				"}\n" + 
3193
				"\n" + 
3194
				"class BX<Q> extends AX<Q> {\n" + 
3195
				"   void bar(Q q) { \n" + 
3196
				"		System.out.println(q);\n" + 
3197
				"   }\n" + 
3198
				"}\n",
3199
			},
3200
			"----------\n" + 
3201
			"1. WARNING in X.java (at line 1)\n" + 
3202
			"	public class X <T extends AX> {\n" + 
3203
			"	                          ^^\n" + 
3204
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
3205
			"----------\n" + 
3206
			"2. WARNING in X.java (at line 7)\n" + 
3207
			"	X<? extends BX> x = new X<AX<String>>(new AX<String>());\n" + 
3208
			"	            ^^\n" + 
3209
			"BX is a raw type. References to generic type BX<Q> should be parameterized\n" + 
3210
			"----------\n" + 
3211
			"3. ERROR in X.java (at line 7)\n" + 
3212
			"	X<? extends BX> x = new X<AX<String>>(new AX<String>());\n" + 
3213
			"	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
3214
			"Type mismatch: cannot convert from X<AX<String>> to X<? extends BX>\n" + 
3215
			"----------\n" + 
3216
			"4. WARNING in X.java (at line 8)\n" + 
3217
			"	x.t.foo(\"SUCC\");\n" + 
3218
			"	^^^^^^^^^^^^^^^\n" + 
3219
			"Type safety: The method foo(Object) belongs to the raw type AX. References to generic type AX<P> should be parameterized\n" + 
3220
			"----------\n" + 
3221
			"5. WARNING in X.java (at line 9)\n" + 
3222
			"	x.t.bar(\"ESS\");\n" + 
3223
			"	^^^^^^^^^^^^^^\n" + 
3224
			"Type safety: The method bar(Object) belongs to the raw type BX. References to generic type BX<Q> should be parameterized\n" + 
3225
			"----------\n");		
3226
	}			
3227
	public void test0105() {
3228
		this.runConformTest(
3229
			new String[] {
3230
				"X.java",
3231
				"public class X <T extends AX> {\n" + 
3232
				"    T t;\n" + 
3233
				"    X(T t){\n" + 
3234
				"        this.t = t;\n" + 
3235
				"    }\n" + 
3236
				"    public static void main(String[] args) {\n" + 
3237
				"		X<? extends AX> x = new X<AX<String>>(new AX<String>());\n" + 
3238
				"		x.t.foo(\"SUCCESS\");\n" + 
3239
				"	}\n" + 
3240
				"}\n" + 
3241
				"\n" + 
3242
				"class AX<P> {\n" + 
3243
				"   void foo(P p) { \n" + 
3244
				"		System.out.println(p);\n" + 
3245
				"   }\n" + 
3246
				"}\n",
3247
			},
3248
			"SUCCESS");		
3249
	}			
3250
	public void test0106() {
3251
		this.runConformTest(
3252
			new String[] {
3253
				"X.java",
3254
				"public class X <T extends AX> {\n" + 
3255
				"    T t;\n" + 
3256
				"    X(T t){\n" + 
3257
				"        this.t = t;\n" + 
3258
				"    }\n" + 
3259
				"    public static void main(String[] args) {\n" + 
3260
				"        X<BX<String>> x = new X<BX<String>>(new BX<String>());\n" + 
3261
				"		x.t.foo(\"SUCC\");\n" + 
3262
				"		x.t.bar(\"ESS\");\n" + 
3263
				"	}\n" + 
3264
				"}\n" + 
3265
				"\n" + 
3266
				"class AX<P> {\n" + 
3267
				"   void foo(P p) { \n" + 
3268
				"		System.out.print(p);\n" + 
3269
				"   }\n" + 
3270
				"}\n" + 
3271
				"\n" + 
3272
				"class BX<Q> extends AX<Q> {\n" + 
3273
				"   void bar(Q q) { \n" + 
3274
				"		System.out.println(q);\n" + 
3275
				"   }\n" + 
3276
				"}\n",
3277
			},
3278
			"SUCCESS");		
3279
	}			
3280
	// unsafe assignment thru binaries
3281
	public void test0107() {
3282
		Map customOptions = getCompilerOptions();
3283
		this.runNegativeTest(
3284
			new String[] {
3285
				"X.java",
3286
				"import java.util.ArrayList;\n" + 
3287
				"\n" + 
3288
				"public class X  {\n" + 
3289
				"    \n" + 
3290
				"    public static void main(String[] args) {\n" + 
3291
				"        \n" + 
3292
				"        Iterable<String> is = new ArrayList();\n" + 
3293
				"		is.iterator();\n" + 
3294
				"    }\n" + 
3295
				"}\n" + 
3296
				"\n",
3297
			},
3298
			"----------\n" + 
3299
			"1. WARNING in X.java (at line 7)\n" + 
3300
			"	Iterable<String> is = new ArrayList();\n" + 
3301
			"	                      ^^^^^^^^^^^^^^^\n" + 
3302
			"Type safety: The expression of type ArrayList needs unchecked conversion to conform to Iterable<String>\n" + 
3303
			"----------\n" + 
3304
			"2. WARNING in X.java (at line 7)\n" + 
3305
			"	Iterable<String> is = new ArrayList();\n" + 
3306
			"	                          ^^^^^^^^^\n" + 
3307
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
3308
			"----------\n",
3309
			null,
3310
			true,
3311
			customOptions);		
3312
	}			
3313
	// class literal: Integer.class of type Class<Integer>
3314
	public void test0108() {
3315
	    // also ensure no unsafe type operation problem is issued (assignment to variable of type raw)
3316
		Map customOptions = getCompilerOptions();
3317
		customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);			    
3318
		customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
3319
		this.runConformTest(
3320
			new String[] {
3321
				"X.java",
3322
			"public class X {\n" + 
3323
			"    Class k;\n" + 
3324
			"    public static void main(String args[]) {\n" + 
3325
			"        new X().foo();\n" + 
3326
			"    }\n" + 
3327
			"    void foo() {\n" + 
3328
			"        Class c = this.getClass();\n" + 
3329
			"        this.k = this.getClass();\n" + 
3330
			"        this.k = Integer.class;\n" + 
3331
			"        try {\n" + 
3332
			"            Integer i = Integer.class.newInstance();\n" + 
3333
			"        } catch (Exception e) {\n" + 
3334
			"        }\n" + 
3335
			"        System.out.println(\"SUCCESS\");\n" + 
3336
			"    }\n" + 
3337
			"}\n",
3338
			},
3339
		"SUCCESS",
3340
		null,
3341
		true,
3342
		null,
3343
		customOptions,
3344
		null/*no custom requestor*/);		
3345
	}	
3346
	// parameterized interface cannot be implemented simultaneously with distinct arguments
3347
	public void test0109() {
3348
		this.runNegativeTest(
3349
			new String[] {
3350
				"X.java",
3351
				"public class X implements AX<String> {}\n" + 
3352
				"class Y extends X implements AX<Thread> {}\n" + 
3353
				"interface AX<P> {}\n" + 
3354
				"\n",
3355
			},
3356
			"----------\n" + 
3357
			"1. ERROR in X.java (at line 2)\n" + 
3358
			"	class Y extends X implements AX<Thread> {}\n" + 
3359
			"	      ^\n" + 
3360
			"The interface AX cannot be implemented more than once with different arguments: AX<String> and AX<Thread>\n" + 
3361
			"----------\n");
3362
	}		
3363
	public void test0110() {
3364
		this.runNegativeTest(
3365
			new String[] {
3366
				"X.java",
3367
				"public class X implements AX {}\n" + 
3368
				"class Y extends X implements AX<Thread> {}\n" + 
3369
				"interface AX<P> {}\n" + 
3370
				"\n",
3371
			},
3372
			"----------\n" + 
3373
			"1. WARNING in X.java (at line 1)\n" + 
3374
			"	public class X implements AX {}\n" + 
3375
			"	                          ^^\n" + 
3376
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
3377
			"----------\n" + 
3378
			"2. ERROR in X.java (at line 2)\n" + 
3379
			"	class Y extends X implements AX<Thread> {}\n" + 
3380
			"	      ^\n" + 
3381
			"The interface AX cannot be implemented more than once with different arguments: AX and AX<Thread>\n" + 
3382
			"----------\n");		
3383
	}		
3384
	public void test0111() {
3385
		this.runNegativeTest(
3386
			new String[] {
3387
				"X.java",
3388
				"public class X implements AX<Object> {}\n" + 
3389
				"class Y extends X implements AX {}\n" + 
3390
				"interface AX<P> {}\n" + 
3391
				"\n",
3392
			},
3393
			"----------\n" + 
3394
			"1. ERROR in X.java (at line 2)\n" + 
3395
			"	class Y extends X implements AX {}\n" + 
3396
			"	      ^\n" + 
3397
			"The interface AX cannot be implemented more than once with different arguments: AX<Object> and AX\n" + 
3398
			"----------\n" + 
3399
			"2. WARNING in X.java (at line 2)\n" + 
3400
			"	class Y extends X implements AX {}\n" + 
3401
			"	                             ^^\n" + 
3402
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
3403
			"----------\n");		
3404
	}		
3405
	// test member types
3406
	public void test0112() {
3407
		this.runNegativeTest(
3408
			new String[] {
3409
				"X.java",
3410
				"public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3411
				"    void foo(X<Thread>.MX<String>.MMX<X> mx) {}\n" + 
3412
				"    class MX <MT> {\n" + 
3413
				"        class MMX <MMT> {}\n" + 
3414
				"    }\n" + 
3415
				"}\n",
3416
			},
3417
			"----------\n" + 
3418
			"1. WARNING in X.java (at line 1)\n" + 
3419
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3420
			"	                            ^^^^^^^^\n" + 
3421
			"X.MX.MMX is a raw type. References to generic type X<T>.MX<MT>.MMX<MMT> should be parameterized\n" + 
3422
			"----------\n" + 
3423
			"2. ERROR in X.java (at line 1)\n" + 
3424
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3425
			"	                            ^^^^^^^^\n" + 
3426
			"Bound mismatch: The type X.MX.MMX is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3427
			"----------\n" + 
3428
			"3. ERROR in X.java (at line 2)\n" + 
3429
			"	void foo(X<Thread>.MX<String>.MMX<X> mx) {}\n" + 
3430
			"	           ^^^^^^\n" + 
3431
			"Bound mismatch: The type Thread is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3432
			"----------\n" + 
3433
			"4. WARNING in X.java (at line 2)\n" + 
3434
			"	void foo(X<Thread>.MX<String>.MMX<X> mx) {}\n" + 
3435
			"	                                  ^\n" + 
3436
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
3437
			"----------\n");		
3438
		this.runNegativeTest(
3439
			new String[] {
3440
				"X.java",
3441
				"public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3442
				"    class MX <MT extends Comparable> {\n" + 
3443
				"        class MMX <MMT> {}\n" + 
3444
				"    }\n" + 
3445
				"}\n",
3446
			},
3447
			"----------\n" + 
3448
			"1. WARNING in X.java (at line 1)\n" + 
3449
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3450
			"	                            ^^^^^^^^\n" + 
3451
			"X.MX.MMX is a raw type. References to generic type X<T>.MX<MT>.MMX<MMT> should be parameterized\n" + 
3452
			"----------\n" + 
3453
			"2. ERROR in X.java (at line 1)\n" + 
3454
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3455
			"	                            ^^^^^^^^\n" + 
3456
			"Bound mismatch: The type X.MX.MMX is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3457
			"----------\n" + 
3458
			"3. ERROR in X.java (at line 1)\n" + 
3459
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3460
			"	                                         ^^^^^^^^\n" + 
3461
			"Bound mismatch: The type Runnable is not a valid substitute for the bounded parameter <MT extends Comparable> of the type X<T>.MX<MT>\n" + 
3462
			"----------\n" + 
3463
			"4. WARNING in X.java (at line 2)\n" + 
3464
			"	class MX <MT extends Comparable> {\n" + 
3465
			"	                     ^^^^^^^^^^\n" + 
3466
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
3467
			"----------\n");
3468
		this.runNegativeTest(
3469
			new String[] {
3470
				"X.java",
3471
				"public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3472
				"    class MX <MT> {\n" + 
3473
				"        class MMX <MMT extends Comparable> {}\n" + 
3474
				"    }\n" + 
3475
				"}\n",
3476
			},
3477
			"----------\n" + 
3478
			"1. WARNING in X.java (at line 1)\n" + 
3479
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3480
			"	                            ^^^^^^^^\n" + 
3481
			"X.MX.MMX is a raw type. References to generic type X<T>.MX<MT>.MMX<MMT> should be parameterized\n" + 
3482
			"----------\n" + 
3483
			"2. ERROR in X.java (at line 1)\n" + 
3484
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3485
			"	                            ^^^^^^^^\n" + 
3486
			"Bound mismatch: The type X.MX.MMX is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3487
			"----------\n" + 
3488
			"3. ERROR in X.java (at line 1)\n" + 
3489
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3490
			"	                                                       ^^^^^^^^\n" + 
3491
			"Bound mismatch: The type Iterable<String> is not a valid substitute for the bounded parameter <MMT extends Comparable> of the type X<T>.MX<MT>.MMX<MMT>\n" + 
3492
			"----------\n" + 
3493
			"4. WARNING in X.java (at line 3)\n" + 
3494
			"	class MMX <MMT extends Comparable> {}\n" + 
3495
			"	                       ^^^^^^^^^^\n" + 
3496
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
3497
			"----------\n");
3498
	}			
3499
	public void test0113() {
3500
		this.runConformTest(
3501
			new String[] {
3502
				"X.java",
3503
				"public class X<T> {\n" + 
3504
				"  class MX<U> {\n" + 
3505
				"  }\n" + 
3506
				"\n" + 
3507
				"  public static void main(String[] args) {\n" + 
3508
				"    new X<Thread>().foo();\n" + 
3509
				"	System.out.println(\"SUCCESS\");\n" + 
3510
				"  }\n" + 
3511
				"  void foo() {\n" + 
3512
				"		new X<String>().new MX<T>();\n" + 
3513
				"  }\n" + 
3514
				"}\n",
3515
			},
3516
			"SUCCESS");		
3517
	}		
3518
	public void test0114() {
3519
		this.runConformTest(
3520
			new String[] {
3521
				"X.java",
3522
				"public class X<T> {\n" + 
3523
				"  class MX<U> {\n" + 
3524
				"  }\n" + 
3525
				"\n" + 
3526
				"  public static void main(String[] args) {\n" + 
3527
				"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
3528
				"  }\n" + 
3529
				"  void foo(X<String>.MX<Thread> mx) {\n" + 
3530
				"	System.out.println(\"SUCCESS\");\n" + 
3531
				"  }\n" + 
3532
				"}\n",
3533
			},
3534
			"SUCCESS");		
3535
	}			
3536
	public void test0115() {
3537
		this.runConformTest(
3538
			new String[] {
3539
				"X.java",
3540
				"public class X<T> {\n" + 
3541
				"  class MX<U> {\n" + 
3542
				"  }\n" + 
3543
				"\n" + 
3544
				"  public static void main(String[] args) {\n" + 
3545
				"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
3546
				"  }\n" + 
3547
				"  void foo(X.MX mx) {\n" + 
3548
				"	System.out.println(\"SUCCESS\");\n" + 
3549
				"  }\n" + 
3550
				"}\n",
3551
			},
3552
			"SUCCESS");		
3553
	}		
3554
	public void test0116() {
3555
		this.runConformTest(
3556
			new String[] {
3557
				"X.java",
3558
				"public class X<T> {\n" + 
3559
				"  class MX<U> {\n" + 
3560
				"  }\n" + 
3561
				"\n" + 
3562
				"  public static void main(String[] args) {\n" + 
3563
				"    new X<Thread>().foo(new X<String>().new MX<Thread>());\n" + 
3564
				"  }\n" + 
3565
				"  void foo(X<?>.MX<?> mx) {\n" + 
3566
				"	System.out.println(\"SUCCESS\");\n" + 
3567
				"  }\n" + 
3568
				"}\n",
3569
			},
3570
			"SUCCESS");		
3571
	}			
3572
	// test member types
3573
	public void test0117() {
3574
		this.runNegativeTest(
3575
			new String[] {
3576
				"X.java",
3577
				"public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3578
				"    public static void main(String [] args) {\n" + 
3579
				"        \n" + 
3580
				"        new X<X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>().new MX<Exception>();\n" + 
3581
				"        System.out.println(\"SUCCESS\");\n" + 
3582
				"    }\n" + 
3583
				"    void foo(X<X.MX.MMX>.MX<X>.MMX<X> mx) {\n" + 
3584
				"    }\n" + 
3585
				"    \n" + 
3586
				"    class MX <MT> {\n" + 
3587
				"        class MMX <MMT> {\n" + 
3588
				"        }\n" + 
3589
				"    }\n" + 
3590
				"}\n",
3591
			},
3592
			"----------\n" + 
3593
			"1. WARNING in X.java (at line 1)\n" + 
3594
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3595
			"	                            ^^^^^^^^\n" + 
3596
			"X.MX.MMX is a raw type. References to generic type X<T>.MX<MT>.MMX<MMT> should be parameterized\n" + 
3597
			"----------\n" + 
3598
			"2. ERROR in X.java (at line 1)\n" + 
3599
			"	public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3600
			"	                            ^^^^^^^^\n" + 
3601
			"Bound mismatch: The type X.MX.MMX is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3602
			"----------\n" + 
3603
			"3. WARNING in X.java (at line 4)\n" + 
3604
			"	new X<X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>().new MX<Exception>();\n" + 
3605
			"	        ^^^^^^^^\n" + 
3606
			"X.MX.MMX is a raw type. References to generic type X<T>.MX<MT>.MMX<MMT> should be parameterized\n" + 
3607
			"----------\n" + 
3608
			"4. ERROR in X.java (at line 4)\n" + 
3609
			"	new X<X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>().new MX<Exception>();\n" + 
3610
			"	        ^^^^^^^^\n" + 
3611
			"Bound mismatch: The type X.MX.MMX is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3612
			"----------\n" + 
3613
			"5. WARNING in X.java (at line 7)\n" + 
3614
			"	void foo(X<X.MX.MMX>.MX<X>.MMX<X> mx) {\n" + 
3615
			"	           ^^^^^^^^\n" + 
3616
			"X.MX.MMX is a raw type. References to generic type X<T>.MX<MT>.MMX<MMT> should be parameterized\n" + 
3617
			"----------\n" + 
3618
			"6. ERROR in X.java (at line 7)\n" + 
3619
			"	void foo(X<X.MX.MMX>.MX<X>.MMX<X> mx) {\n" + 
3620
			"	           ^^^^^^^^\n" + 
3621
			"Bound mismatch: The type X.MX.MMX is not a valid substitute for the bounded parameter <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> of the type X<T>\n" + 
3622
			"----------\n" + 
3623
			"7. WARNING in X.java (at line 7)\n" + 
3624
			"	void foo(X<X.MX.MMX>.MX<X>.MMX<X> mx) {\n" + 
3625
			"	                        ^\n" + 
3626
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
3627
			"----------\n" + 
3628
			"8. WARNING in X.java (at line 7)\n" + 
3629
			"	void foo(X<X.MX.MMX>.MX<X>.MMX<X> mx) {\n" + 
3630
			"	                               ^\n" + 
3631
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
3632
			"----------\n");		
3633
	}				
3634
	// test generic method with recursive parameter bound <T extends Comparable<? super T>>
3635
	public void test0118() {
3636
		this.runConformTest(
3637
			new String[] {
3638
				"X.java",
3639
				"public class X {\n" + 
3640
				"    public static void main(String[] args) {\n" + 
3641
				"        java.util.Collections.sort(new java.util.LinkedList<String>());\n" + 
3642
				"        System.out.println(\"SUCCESS\");\n" + 
3643
				"    }\n" + 
3644
				"}\n"
3645
			},
3646
			"SUCCESS");
3647
	}
3648
	// test generic method
3649
	// **
3650
	public void test0118a() {
3651
		this.runConformTest(
3652
			new String[] {
3653
				"X.java",
3654
				"class A<T> {}\n" + 
3655
				"\n" + 
3656
				"public class X {\n" + 
3657
				"	static <T extends A<U>, U> void foo() {}\n" + 
3658
				"	void bar(A<?> a) {\n" + 
3659
				"		foo();\n" + 
3660
				"	}\n" + 
3661
				"}"
3662
			}, 
3663
			"");
3664
	}	
3665
	// test binary member types **
3666
	public void _test0119() {
3667
		this.runConformTest(
3668
			new String[] {
3669
				"X.java",
3670
				"public class X <T extends X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>{\n" + 
3671
				"    public static void main(String [] args) {\n" + 
3672
				"        \n" + 
3673
				"        new X<X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>>().new MX<Exception>();\n" + 
3674
				"        System.out.println(\"SUCCESS\");\n" + 
3675
				"    }\n" + 
3676
				"    void foo(X<X.MX.MMX>.MX<Object>.MMX<X> mx) {\n" + 
3677
				"    }\n" + 
3678
				"    void foo2(X<X.MX.MMX>.MX<Iterable>.MMX<X> mx) {\n" + 
3679
				"    }\n" + 
3680
				"    void foo3(X<X<X.MX.MMX>.MX<Runnable>.MMX<Iterable<String>>> mx) {\n" + 
3681
				"    }\n" + 
3682
				"    \n" + 
3683
				"    class MX <MT> {\n" + 
3684
				"        class MMX <MMT> {\n" + 
3685
				"        }\n" + 
3686
				"    }\n" + 
3687
				"}\n",
3688
			},
3689
			"SUCCESS"
3690
		);
3691
3692
		// TODO (philippe) bounds checks are done before binaryType X is finished creating its type variables
3693
		this.runConformTest(
3694
			new String[] {
3695
				"Y.java",
3696
				"public class Y extends X {\n" + 
3697
				"    public static void main(String [] args) {\n" + 
3698
				"        System.out.println(\"SUCCESS\");\n" + 
3699
				"    }\n" + 
3700
				"}\n",
3701
			},
3702
			"SUCCESS",
3703
			null,
3704
			false, // do not flush output
3705
			null);		
3706
	}
3707
	private void runConformTest(String[] strings, String string, Object object, boolean b, Object object2) {
3708
	    // TODO Auto-generated method stub
3709
	    
3710
    }
3711
3712
	// test generic method
3713
	public void test0120() {
3714
		this.runConformTest(
3715
			new String[] {
3716
				"X.java",
3717
				"public class X <T>{\n" + 
3718
				"    public static void main(String[] args) {\n" + 
3719
				"        \n" + 
3720
				"        String s = new X<String>().foo(\"SUCCESS\");\n" + 
3721
				"	}\n" + 
3722
				"    <U extends String> T foo (U u) {\n" + 
3723
				"        System.out.println(u);\n" + 
3724
				"        return null;\n" + 
3725
				"    }\n" + 
3726
				"}\n",
3727
			},
3728
			"SUCCESS");
3729
	}
3730
	// test generic method
3731
	public void test0120a() {
3732
		this.runConformTest(
3733
			new String[] {
3734
				"X.java",
3735
				"public class X<E> {\n" + 
3736
				"    <U extends X<?>> U foo() {\n" + 
3737
				"    	return null;\n" + 
3738
				"    }\n" + 
3739
				"    <V extends X<?>> V bar() {\n" + 
3740
				"        return foo();\n" + 
3741
				"    }\n" + 
3742
				"}"
3743
			}, 
3744
			"");
3745
	}
3746
	// substitute array types
3747
	public void test0121() {
3748
		this.runConformTest(
3749
			new String[] {
3750
				"X.java",
3751
				"public class X <T> {\n" + 
3752
				"    public static void main(String[] args) {\n" + 
3753
				"		new X<String>().foo(args);\n" + 
3754
				"	}\n" + 
3755
				"    \n" + 
3756
				"    void foo(T[] ts) {\n" + 
3757
				"        System.out.println(\"SUCCESS\");\n" + 
3758
				"    }\n" + 
3759
				"}\n",
3760
			},
3761
			"SUCCESS");
3762
	}			
3763
	// generic method with most specific common supertype: U --> String
3764
	public void test0122() {
3765
		this.runConformTest(
3766
			new String[] {
3767
				"X.java",
3768
				"public class X <T> {\n" + 
3769
				"    public static void main(String[] args) {\n" + 
3770
				"		new X<String>().foo(args, new X<X<String>>());\n" + 
3771
				"	}\n" + 
3772
				"    <U> void foo(U[] us, X<X<U>> xxu) {\n" + 
3773
				"        System.out.println(\"SUCCESS\");\n" + 
3774
				"    }\n" + 
3775
				"}\n",
3776
			},
3777
			"SUCCESS");
3778
	}			
3779
	// invalid parameterized type
3780
	public void test0123() {
3781
		this.runNegativeTest(
3782
			new String[] {
3783
				"X.java",
3784
				"public class X <T> {\n" + 
3785
				"    T<String> ts;\n" + 
3786
				"}\n",
3787
			},
3788
			"----------\n" + 
3789
			"1. ERROR in X.java (at line 2)\n" + 
3790
			"	T<String> ts;\n" + 
3791
			"	^\n" + 
3792
			"The type T is not generic; it cannot be parameterized with arguments <String>\n" + 
3793
			"----------\n");
3794
	}		
3795
	// generic method with indirect type inference: BX<String, Thread> --> AX<W>
3796
	public void test0124() {
3797
		this.runConformTest(
3798
			new String[] {
3799
				"X.java",
3800
				"public class X {\n" + 
3801
				"    \n" + 
3802
				"    <W> void foo(AX<W> aw) {\n" + 
3803
				"        System.out.println(\"SUCCESS\");\n" + 
3804
				"     }\n" + 
3805
				"    \n" + 
3806
				"    public static void main(String[] args) {\n" + 
3807
				"		new X().foo(new BX<String,Thread>());\n" + 
3808
				"	}\n" + 
3809
				"}\n" + 
3810
				"\n" + 
3811
				"class AX<T> {\n" + 
3812
				"}\n" + 
3813
				"class BX<U, V> extends AX<V> {\n" + 
3814
				"}\n",
3815
			},
3816
			"SUCCESS");
3817
	}		
3818
	// generic method with indirect type inference: CX  --> AX<W>
3819
	public void test0125() {
3820
		this.runConformTest(
3821
			new String[] {
3822
				"X.java",
3823
				"public class X {\n" + 
3824
				"    \n" + 
3825
				"    <W> void foo(AX<W> aw) {\n" + 
3826
				"        System.out.println(\"SUCCESS\");\n" + 
3827
				"     }\n" + 
3828
				"    \n" + 
3829
				"    public static void main(String[] args) {\n" + 
3830
				"		new X().foo(new CX());\n" + 
3831
				"	}\n" + 
3832
				"}\n" + 
3833
				"\n" + 
3834
				"class AX<T> {\n" + 
3835
				"}\n" + 
3836
				"class BX<U, V> extends AX<V> {\n" + 
3837
				"}\n" + 
3838
				"class CX extends BX<String, Thread> {\n" + 
3839
				"}\n",
3840
			},
3841
			"SUCCESS");
3842
	}			
3843
	// variation on test0125 with typo: CX extends B instead of BX.
3844
	public void test0126() {
3845
		this.runNegativeTest(
3846
			new String[] {
3847
				"X.java",
3848
				"public class X {\n" + 
3849
				"    \n" + 
3850
				"    <W> void foo(AX<W> aw) {\n" + 
3851
				"        System.out.println(\"SUCCESS\");\n" + 
3852
				"     }\n" + 
3853
				"    \n" + 
3854
				"    public static void main(String[] args) {\n" + 
3855
				"		new X().foo(new CX());\n" + 
3856
				"	}\n" + 
3857
				"}\n" + 
3858
				"\n" + 
3859
				"class AX<T> {\n" + 
3860
				"}\n" + 
3861
				"class BX<U, V> extends AX<V> {\n" + 
3862
				"}\n" + 
3863
				"class CX extends B<String, Thread> {\n" + 
3864
				"}\n",
3865
			},
3866
			"----------\n" + 
3867
			"1. ERROR in X.java (at line 8)\n" + 
3868
			"	new X().foo(new CX());\n" + 
3869
			"	        ^^^\n" + 
3870
			"The method foo(AX<W>) in the type X is not applicable for the arguments (CX)\n" + 
3871
			"----------\n" + 
3872
			"2. ERROR in X.java (at line 16)\n" + 
3873
			"	class CX extends B<String, Thread> {\n" + 
3874
			"	                 ^\n" + 
3875
			"B cannot be resolved to a type\n" + 
3876
			"----------\n");
3877
	}			
3878
	// 57784: test generic method
3879
	public void test0127() {
3880
		this.runConformTest(
3881
			new String[] {
3882
				"X.java",
3883
				"public class X {\n" + 
3884
				"    public static void main(String[] args) {\n" + 
3885
				"        java.util.Arrays.asList(new Object[] {\"1\"});\n" + 
3886
				"        System.out.println(\"SUCCESS\");\n" + 
3887
				"    }\n" + 
3888
				"}\n"
3889
			},
3890
			"SUCCESS");
3891
	}	
3892
	// 58666: special treatment for Object#getClass declared of type: Class<? extends Object>
3893
	// but implicitly converted to Class<? extends X> for free.
3894
	public void test0128() {
3895
		this.runNegativeTest(
3896
			new String[] {
3897
				"X.java",
3898
				"public class X { \n" + 
3899
				"    public static void main(String[] args) {\n" + 
3900
				"		X x = new X();\n" + 
3901
				"		Class c1 = x.getClass();\n" + 
3902
				"		Class<? extends X> c2 = x.getClass();\n" + 
3903
				"		String s = \"hello\";\n" + 
3904
				"		Class<? extends X> c3 = s.getClass();\n" + 
3905
				"		System.out.println(\"SUCCESS\");\n" + 
3906
				"    }\n" + 
3907
				"}\n"
3908
			},
3909
			"----------\n" + 
3910
			"1. WARNING in X.java (at line 4)\n" + 
3911
			"	Class c1 = x.getClass();\n" + 
3912
			"	^^^^^\n" + 
3913
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
3914
			"----------\n" + 
3915
			"2. ERROR in X.java (at line 7)\n" + 
3916
			"	Class<? extends X> c3 = s.getClass();\n" + 
3917
			"	                        ^^^^^^^^^^^^\n" + 
3918
			"Type mismatch: cannot convert from Class<capture#3-of ? extends String> to Class<? extends X>\n" + 
3919
			"----------\n");
3920
	}		
3921
	// variation on test0128
3922
	public void test0129() {
3923
		this.runNegativeTest(
3924
			new String[] {
3925
				"X.java",
3926
				"public class X { \n" + 
3927
				"\n" + 
3928
				"    public static void main(String[] args) {\n" + 
3929
				"		XY xy = new XY();\n" + 
3930
				"		Class c1 = xy.getClass();\n" + 
3931
				"		Class<? extends XY> c2 = xy.getClass();\n" + 
3932
				"		String s = \"hello\";\n" + 
3933
				"		Class<? extends XY> c3 = s.getClass();\n" + 
3934
				"		System.out.println(\"SUCCESS\");\n" + 
3935
				"    }\n" + 
3936
				"}\n" + 
3937
				"\n" + 
3938
				"class XY extends X {\n" + 
3939
				"    public Class <? extends Object> getClass() {\n" + 
3940
				"        return super.getClass();\n" + 
3941
				"    }\n" + 
3942
				"}\n"
3943
			},
3944
			"----------\n" + 
3945
			"1. WARNING in X.java (at line 5)\n" + 
3946
			"	Class c1 = xy.getClass();\n" + 
3947
			"	^^^^^\n" + 
3948
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
3949
			"----------\n" + 
3950
			"2. ERROR in X.java (at line 8)\n" + 
3951
			"	Class<? extends XY> c3 = s.getClass();\n" + 
3952
			"	                         ^^^^^^^^^^^^\n" + 
3953
			"Type mismatch: cannot convert from Class<capture#3-of ? extends String> to Class<? extends XY>\n" + 
3954
			"----------\n" + 
3955
			"3. ERROR in X.java (at line 14)\n" + 
3956
			"	public Class <? extends Object> getClass() {\n" + 
3957
			"	                                ^^^^^^^^^^\n" + 
3958
			"Cannot override the final method from Object\n" + 
3959
			"----------\n" + 
3960
			"4. WARNING in X.java (at line 14)\n" + 
3961
			"	public Class <? extends Object> getClass() {\n" + 
3962
			"	                                ^^^^^^^^^^\n" + 
3963
			"The method getClass() of type XY should be tagged with @Override since it actually overrides a superclass method\n" + 
3964
			"----------\n");
3965
	}			
3966
	// getClass on array type
3967
	public void test0130() {
3968
		this.runConformTest(
3969
			new String[] {
3970
				"X.java",
3971
				"public class X { \n" + 
3972
				"\n" + 
3973
				"    public static void main(String[] args) {\n" + 
3974
				"		X[] x = new X[0];\n" + 
3975
				"		Class<? extends X[]> c = x.getClass();\n" + 
3976
				"		System.out.println(\"SUCCESS\");\n" + 
3977
				"    }\n" + 
3978
				"}\n"
3979
			},
3980
			"SUCCESS");
3981
	}			
3982
	// 58979
3983
	public void test0131() {
3984
		this.runNegativeTest(
3985
			new String[] {
3986
				"ArrayList.java",
3987
				" interface List<T> {\n" + 
3988
				"	 List<T> foo();\n" + 
3989
				"}\n" + 
3990
				"\n" + 
3991
				" class ArrayList<T> implements List<T> {\n" + 
3992
				"	public List<T> foo() {\n" + 
3993
				"		List<T> lt = this;\n" + 
3994
				"		lt.bar();\n" + 
3995
				"		return this;\n" + 
3996
				"	}\n" + 
3997
				"}\n",
3998
			},
3999
			"----------\n" + 
4000
			"1. ERROR in ArrayList.java (at line 8)\n" + 
4001
			"	lt.bar();\n" + 
4002
			"	   ^^^\n" + 
4003
			"The method bar() is undefined for the type List<T>\n" + 
4004
			"----------\n");
4005
	}
4006
	public void test0132() {
4007
		this.runNegativeTest(
4008
			new String[] {
4009
				"X.java",
4010
				"public class X {\n" +
4011
				"  <T extends X<W>.Z> foo() {}\n" +
4012
				"}"
4013
			},
4014
			"----------\n" + 
4015
			"1. ERROR in X.java (at line 2)\n" + 
4016
			"	<T extends X<W>.Z> foo() {}\n" + 
4017
			"	             ^\n" + 
4018
			"W cannot be resolved to a type\n" + 
4019
			"----------\n" + 
4020
			"2. ERROR in X.java (at line 2)\n" + 
4021
			"	<T extends X<W>.Z> foo() {}\n" + 
4022
			"	                   ^^^^^\n" + 
4023
			"Return type for the method is missing\n" + 
4024
			"----------\n");
4025
	}
4026
	// bridge method
4027
	public void test0133() {
4028
		this.runConformTest(
4029
			new String[] {
4030
				"X.java",
4031
				"public class X<T> {\n" + 
4032
				"    public static void main(String[] args) {\n" + 
4033
				"        X x = new Y();\n" + 
4034
				"        System.out.println(x.foo());\n" + 
4035
				"    }\n" + 
4036
				"   T foo() {return null;}\n" + 
4037
				"   void foo(T t) {}\n" + 
4038
				"}\n" + 
4039
				"class Y extends X<Object> {\n" + 
4040
				"    String foo() {return \"SUCCESS\";}\n" + 
4041
				"    void foo(String s) {}\n" + 
4042
				"}\n"
4043
			},
4044
			"SUCCESS");
4045
	}
4046
	public void test0134() {
4047
		this.runConformTest(
4048
			new String[] {
4049
				"Z.java",
4050
				"import java.util.ArrayList;\n" + 
4051
				"import java.util.List;\n" + 
4052
				"\n" + 
4053
				"public class Z <T extends List> { \n" + 
4054
				"    T t;\n" + 
4055
				"    public static void main(String[] args) {\n" + 
4056
				"        foo(new Z<ArrayList>().set(new ArrayList<String>()));\n" + 
4057
				"        System.out.println(\"SUCCESS\");\n" + 
4058
				"    }\n" + 
4059
				"    Z<T> set(T t) {\n" + 
4060
				"        this.t = t;\n" + 
4061
				"        return this;\n" + 
4062
				"    }\n" + 
4063
				"    T get() { \n" + 
4064
				"        return this.t; \n" + 
4065
				"    }\n" + 
4066
				"    \n" + 
4067
				"    static void foo(Z<? super ArrayList> za) {\n" + 
4068
				"        za.get().isEmpty();\n" + 
4069
				"    }\n" + 
4070
				"}\n"
4071
			},
4072
			"SUCCESS");
4073
	}	
4074
	public void test0135() {
4075
		this.runNegativeTest(
4076
			new String[] {
4077
				"Z.java",
4078
				"public class Z <T extends ZA> { \n" + 
4079
				"    public static void main(String[] args) {\n" + 
4080
				"        foo(new Z<ZA>());\n" + 
4081
				"        System.out.println(\"SUCCESS\");\n" + 
4082
				"    }\n" + 
4083
				"    static void foo(Z<? super String> zs) {\n" + 
4084
				"    }\n" + 
4085
				"}\n" + 
4086
				"\n" + 
4087
				"class ZA {\n" + 
4088
				"    void foo() {}\n" + 
4089
				"}\n" + 
4090
				"\n" + 
4091
				"class ZB extends ZA {\n" + 
4092
				"}"
4093
			},
4094
			"----------\n" + 
4095
			"1. ERROR in Z.java (at line 3)\n" + 
4096
			"	foo(new Z<ZA>());\n" + 
4097
			"	^^^\n" + 
4098
			"The method foo(Z<? super String>) in the type Z<T> is not applicable for the arguments (Z<ZA>)\n" + 
4099
			"----------\n" + 
4100
			"2. ERROR in Z.java (at line 6)\n" + 
4101
			"	static void foo(Z<? super String> zs) {\n" + 
4102
			"	                  ^^^^^^^^^^^^^^\n" + 
4103
			"Bound mismatch: The type ? super String is not a valid substitute for the bounded parameter <T extends ZA> of the type Z<T>\n" + 
4104
			"----------\n");
4105
	}
4106
	public void test0136() {
4107
		this.runNegativeTest(
4108
			new String[] {
4109
				"Z.java",
4110
				"public class Z <T extends ZB> { \n" + 
4111
				"    public static void main(String[] args) {\n" + 
4112
				"        foo(new Z<ZB>());\n" + 
4113
				"    }\n" + 
4114
				"    static void foo(Z<? super ZA> zs) {\n" + 
4115
				"        zs.foo();\n" + 
4116
				"    }\n" + 
4117
				"}\n" + 
4118
				"class ZA {\n" + 
4119
				"}\n" + 
4120
				"class ZB extends ZA {\n" + 
4121
				"    void foo() {}\n" + 
4122
				"}"
4123
			},
4124
			"----------\n" + 
4125
			"1. ERROR in Z.java (at line 3)\n" + 
4126
			"	foo(new Z<ZB>());\n" + 
4127
			"	^^^\n" + 
4128
			"The method foo(Z<? super ZA>) in the type Z<T> is not applicable for the arguments (Z<ZB>)\n" + 
4129
			"----------\n" + 
4130
			"2. ERROR in Z.java (at line 5)\n" + 
4131
			"	static void foo(Z<? super ZA> zs) {\n" + 
4132
			"	                  ^^^^^^^^^^\n" + 
4133
			"Bound mismatch: The type ? super ZA is not a valid substitute for the bounded parameter <T extends ZB> of the type Z<T>\n" + 
4134
			"----------\n" + 
4135
			"3. ERROR in Z.java (at line 6)\n" + 
4136
			"	zs.foo();\n" + 
4137
			"	   ^^^\n" + 
4138
			"The method foo(Z<? super ZA>) in the type Z<capture#1-of ? super ZA> is not applicable for the arguments ()\n" + 
4139
			"----------\n");
4140
	}
4141
	public void test0137() {
4142
		this.runConformTest(
4143
			new String[] {
4144
				"Z.java",
4145
				"import java.util.ArrayList;\n" + 
4146
				"import java.util.List;\n" + 
4147
				"\n" + 
4148
				"public class Z <T extends List> { \n" + 
4149
				"    T t;\n" + 
4150
				"    public static void main(String[] args) {\n" + 
4151
				"        foo(new Z<ArrayList>().set(new ArrayList<String>()));\n" + 
4152
				"        System.out.println(\"SUCCESS\");\n" + 
4153
				"    }\n" + 
4154
				"    Z<T> set(T t) {\n" + 
4155
				"        this.t = t;\n" + 
4156
				"        return this;\n" + 
4157
				"    }\n" + 
4158
				"    T get() { \n" + 
4159
				"        return this.t; \n" + 
4160
				"    }\n" + 
4161
				"    \n" + 
4162
				"    static void foo(Z<? extends ArrayList> za) {\n" + 
4163
				"        za.get().isEmpty();\n" + 
4164
				"    }\n" + 
4165
				"}\n"
4166
			},
4167
			"SUCCESS");
4168
	}		
4169
	// unbound wildcard still remembers its variable bound: Z<?> behaves like Z<AX>
4170
	public void test0138() {
4171
		this.runConformTest(
4172
			new String[] {
4173
				"Z.java",
4174
				"public class Z <T extends AX> {\n" + 
4175
				"    T t;\n" + 
4176
				"    Z(T t){\n" + 
4177
				"        this.t = t;\n" + 
4178
				"    }\n" + 
4179
				"    public static void main(String[] args) {\n" + 
4180
				"		 Z<AX<String>> zax = new Z<AX<String>>(new AX<String>());\n" + 
4181
				"        System.out.println(\"SUCCESS\");\n" + 
4182
				"	}\n" + 
4183
				"    void baz(Z<?> zu){\n" + 
4184
				"        zu.t.foo(null);\n" + 
4185
				"    }\n" + 
4186
				"}\n" + 
4187
				"\n" + 
4188
				"class AX<P> {\n" + 
4189
				"   void foo(P p) { \n" + 
4190
				"		System.out.print(p);\n" + 
4191
				"   }\n" + 
4192
				"}\n"
4193
			},
4194
			"SUCCESS");
4195
	}		
4196
	// extending wildcard considers its bound prior to its corresponding variable
4197
	public void test0139() {
4198
		this.runNegativeTest(
4199
			new String[] {
4200
				"X.java",
4201
				"public class X<T extends AX> {\n" + 
4202
				"    T t;\n" + 
4203
				"    X(T t) {\n" + 
4204
				"        this.t = t;\n" + 
4205
				"    }\n" + 
4206
				"    T get() {\n" + 
4207
				"        return this.t;\n" + 
4208
				"    }\n" + 
4209
				"    void bar(X<? extends BX> x) {\n" + 
4210
				"        x.get().afoo();\n" + 
4211
				"        x.get().bfoo();\n" + 
4212
				"    }\n" + 
4213
				"}\n" + 
4214
				"class AX {\n" + 
4215
				"    void afoo() {}\n" + 
4216
				"}\n" + 
4217
				"class BX {\n" + 
4218
				"    void bfoo() {}\n" + 
4219
				"}\n",
4220
			},
4221
			"----------\n" + 
4222
			"1. ERROR in X.java (at line 9)\n" + 
4223
			"	void bar(X<? extends BX> x) {\n" + 
4224
			"	           ^^^^^^^^^^^^\n" + 
4225
			"Bound mismatch: The type ? extends BX is not a valid substitute for the bounded parameter <T extends AX> of the type X<T>\n" + 
4226
			"----------\n" + 
4227
			"2. ERROR in X.java (at line 10)\n" + 
4228
			"	x.get().afoo();\n" + 
4229
			"	        ^^^^\n" + 
4230
			"The method afoo() is undefined for the type capture#1-of ? extends BX\n" + 
4231
			"----------\n");
4232
	}		
4233
	// extending wildcard considers its bound prior to its corresponding variable
4234
	public void test0140() {
4235
		this.runConformTest(
4236
			new String[] {
4237
				"X.java",
4238
				"public class X<T extends AX> {\n" + 
4239
				"    T t;\n" + 
4240
				"    X(T t) {\n" + 
4241
				"        this.t = t;\n" + 
4242
				"    }\n" + 
4243
				"    T get() {\n" + 
4244
				"        return this.t;\n" + 
4245
				"    }\n" + 
4246
				"    void bar(X<? extends BX> x) {\n" + 
4247
				"        x.get().afoo();\n" + 
4248
				"        x.get().bfoo();\n" + 
4249
				"    }\n" + 
4250
				"    public static void main(String[] args) {\n" + 
4251
				"        System.out.println(\"SUCCESS\");\n" + 
4252
				"	}\n" + 
4253
				"}\n" + 
4254
				"class AX {\n" + 
4255
				"    void afoo() {}\n" + 
4256
				"}\n" + 
4257
				"class BX extends AX {\n" + 
4258
				"    void bfoo() {}\n" + 
4259
				"}\n",
4260
			},
4261
			"SUCCESS");
4262
	}		
4263
	// super wildcard considers its variable for lookups
4264
	public void test0141() {
4265
		this.runNegativeTest(
4266
			new String[] {
4267
				"X.java",
4268
				"public class X<T extends AX> {\n" + 
4269
				"    T t;\n" + 
4270
				"    X(T t) {\n" + 
4271
				"        this.t = t;\n" + 
4272
				"    }\n" + 
4273
				"    T get() {\n" + 
4274
				"        return this.t;\n" + 
4275
				"    }\n" + 
4276
				"    void bar(X<? super BX> x) {\n" + 
4277
				"        x.get().afoo();\n" + 
4278
				"        x.get().bfoo();\n" + 
4279
				"    }\n" + 
4280
				"}\n" + 
4281
				"class AX {\n" + 
4282
				"    void afoo() {}\n" + 
4283
				"}\n" + 
4284
				"class BX extends AX {\n" + 
4285
				"    void bfoo() {}\n" + 
4286
				"}\n",
4287
			},
4288
			"----------\n" + 
4289
			"1. ERROR in X.java (at line 11)\n" + 
4290
			"	x.get().bfoo();\n" + 
4291
			"	        ^^^^\n" + 
4292
			"The method bfoo() is undefined for the type capture#2-of ? super BX\n" + 
4293
			"----------\n");
4294
	}		
4295
	public void test0142() {
4296
		this.runNegativeTest(
4297
			new String[] {
4298
				"X.java",
4299
				"public class X<T extends AX> {\n" + 
4300
				"    T t;\n" + 
4301
				"    X(T t) {\n" + 
4302
				"        this.t = t;\n" + 
4303
				"    }\n" + 
4304
				"    T get() {\n" + 
4305
				"        return this.t;\n" + 
4306
				"    }\n" + 
4307
				"    void bar(X<? extends X> x) {\n" + 
4308
				"        x = identity(x);\n" + 
4309
				"    }\n" + 
4310
				"    <P extends AX> X<P> identity(X<P> x) {\n" + 
4311
				"        return x;\n" + 
4312
				"    }\n" + 
4313
				"    public static void main(String[] args) {\n" + 
4314
				"    }\n" + 
4315
				"}\n" + 
4316
				"class AX {\n" + 
4317
				"    void afoo() {}\n" + 
4318
				"}\n" + 
4319
				"class BX extends AX {\n" + 
4320
				"    void bfoo() {}\n" + 
4321
				"}\n",
4322
			},
4323
			"----------\n" + 
4324
			"1. ERROR in X.java (at line 9)\n" + 
4325
			"	void bar(X<? extends X> x) {\n" + 
4326
			"	           ^^^^^^^^^^^\n" + 
4327
			"Bound mismatch: The type ? extends X is not a valid substitute for the bounded parameter <T extends AX> of the type X<T>\n" + 
4328
			"----------\n" + 
4329
			"2. WARNING in X.java (at line 9)\n" + 
4330
			"	void bar(X<? extends X> x) {\n" + 
4331
			"	                     ^\n" + 
4332
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
4333
			"----------\n" + 
4334
			"3. ERROR in X.java (at line 10)\n" + 
4335
			"	x = identity(x);\n" + 
4336
			"	    ^^^^^^^^\n" + 
4337
			"Bound mismatch: The generic method identity(X<P>) of type X<T> is not applicable for the arguments (X<capture#2-of ? extends X>). The inferred type capture#2-of ? extends X is not a valid substitute for the bounded parameter <P extends AX>\n" + 
4338
			"----------\n");
4339
	}			
4340
	public void test0143() {
4341
		this.runNegativeTest(
4342
			new String[] {
4343
				"X.java",
4344
				"public class X {\n" + 
4345
				"    public static void main(String[] args) {\n" + 
4346
				"        Class<? extends X> xx = null;\n" + 
4347
				"        Class<? extends Object> xo = xx;\n" + 
4348
				"        Class<Object> xo2 = xx;\n" + 
4349
				"    }\n" + 
4350
				"}\n",
4351
			},
4352
			"----------\n" + 
4353
			"1. ERROR in X.java (at line 5)\n" + 
4354
			"	Class<Object> xo2 = xx;\n" + 
4355
			"	                    ^^\n" + 
4356
			"Type mismatch: cannot convert from Class<capture#2-of ? extends X> to Class<Object>\n" + 
4357
			"----------\n");
4358
	}			
4359
	public void test0144() {
4360
		this.runConformTest(
4361
			new String[] {
4362
				"X.java",
4363
				"public class X {\n" + 
4364
				"    public static void main(String[] args) {\n" + 
4365
				"        Class<? extends X> xx = null;\n" + 
4366
				"        Class<? extends Object> xo = xx;\n" + 
4367
				"        X x = get(xx);\n" + 
4368
				"        System.out.println(\"SUCCESS\");\n" + 
4369
				"    }\n" + 
4370
				"    static <P> P get(Class<P> cp) {\n" + 
4371
				"        return null;\n" + 
4372
				"    }\n" + 
4373
				"}\n",
4374
			},
4375
			"SUCCESS");
4376
	}
4377
	// 59641: check assign/invoke with wildcards
4378
	public void test0145() {
4379
		this.runNegativeTest(
4380
			new String[] {
4381
				"X.java",
4382
				"public class X {\n" + 
4383
				"	public static void main(String[] args) {\n" + 
4384
				"		XList<?> lx = new XList<X>();\n" + 
4385
				"		X x = lx.get();\n" + 
4386
				"		lx.add(null);\n" + 
4387
				"		lx.add(x);\n" + 
4388
				"		lx.slot = x;\n" + 
4389
				"		lx.addAll(lx);\n" + 
4390
				"    }    	\n" + 
4391
				"}\n" + 
4392
				"class XList<E extends X> {\n" + 
4393
				"    E slot;\n" + 
4394
				"    void add(E e) {}\n" + 
4395
				"    E get() { return null; \n" + 
4396
				"    }\n" + 
4397
				"    void addAll(XList<E> le) {}\n" + 
4398
				"}\n",
4399
			},
4400
			"----------\n" + 
4401
			"1. ERROR in X.java (at line 6)\n" + 
4402
			"	lx.add(x);\n" + 
4403
			"	   ^^^\n" + 
4404
			"The method add(capture#3-of ?) in the type XList<capture#3-of ?> is not applicable for the arguments (X)\n" + 
4405
			"----------\n" + 
4406
			"2. ERROR in X.java (at line 7)\n" + 
4407
			"	lx.slot = x;\n" + 
4408
			"	          ^\n" + 
4409
			"Type mismatch: cannot convert from X to capture#4-of ?\n" + 
4410
			"----------\n" + 
4411
			"3. ERROR in X.java (at line 8)\n" + 
4412
			"	lx.addAll(lx);\n" + 
4413
			"	   ^^^^^^\n" + 
4414
			"The method addAll(XList<capture#5-of ?>) in the type XList<capture#5-of ?> is not applicable for the arguments (XList<capture#6-of ?>)\n" + 
4415
			"----------\n");
4416
	}
4417
	// 59628
4418
	public void test0146() {
4419
		this.runConformTest(
4420
			new String[] {
4421
				"X.java",
4422
				"import java.util.AbstractList;\n" + 
4423
				"public class X extends AbstractList {\n" + 
4424
				"    public static void main(String[] args) {\n" + 
4425
				"        System.out.println(\"SUCCESS\");\n" + 
4426
				"    }\n" + 
4427
				"    public int size() { return 0; }\n" + 
4428
				"    public Object get(int index) { return null; }\n" + 
4429
				"}\n"
4430
			},
4431
			"SUCCESS");
4432
	}
4433
	// 59723
4434
	public void test0147() {
4435
		this.runConformTest(
4436
			new String[] {
4437
				"X.java",
4438
				"import java.util.ArrayList;\n" + 
4439
				"\n" + 
4440
				"public class X {\n" + 
4441
				"	public static void main(String[] args) {\n" + 
4442
				"	    char[][] tokens = new char[0][];\n" + 
4443
				"	    ArrayList list = new ArrayList();\n" + 
4444
				"		list.toArray(tokens);\n" + 
4445
				"      System.out.println(\"SUCCESS\");\n" + 
4446
				"    }    	\n" + 
4447
				"}\n"
4448
			},
4449
			"SUCCESS");
4450
	}	
4451
	// bridge method
4452
	public void test0148() {
4453
		this.runConformTest(
4454
			new String[] {
4455
				"X.java",
4456
				"public class X extends AX<String>{\n" + 
4457
				"    \n" + 
4458
				"    String foo(String s) {\n" + 
4459
				"        System.out.println(s);\n" + 
4460
				"        return s;\n" + 
4461
				"    }\n" + 
4462
				"	public static void main(String[] args) {\n" + 
4463
				"	   new X().bar(\"SUCCESS\");\n" + 
4464
				"    }    	\n" + 
4465
				"}\n" + 
4466
				"class AX<T> {\n" + 
4467
				"    T foo(T t) {\n" + 
4468
				"        return null;\n" + 
4469
				"    }\n" + 
4470
				"    void bar(T t) {\n" + 
4471
				"        foo(t);\n" + 
4472
				"    }\n" + 
4473
				"}\n"
4474
			},
4475
			"SUCCESS");
4476
	}		
4477
	// method compatibility
4478
	public void test0149() {
4479
		this.runConformTest(
4480
			new String[] {
4481
				"X.java",
4482
				"public abstract class X implements java.util.Collection {\n" + 
4483
				"	public Object[] toArray(Object[] a) {\n" + 
4484
				"		return a;\n" + 
4485
				"	}\n" + 
4486
				"	public static void main(String[] args) {\n" + 
4487
				"	   System.out.println(\"SUCCESS\");\n" + 
4488
				"    }\n" + 
4489
				"}\n"
4490
			},
4491
			"SUCCESS");
4492
		this.runNegativeTest(
4493
			new String[] {
4494
				"X.java",
4495
				"public abstract class X implements java.util.Collection<Object> {\n" + 
4496
				"	public Object[] toArray(Object[] a) {\n" + 
4497
				"		return a;\n" + 
4498
				"	}\n" + 
4499
				"}\n"
4500
			},
4501
			"----------\n" + 
4502
			"1. WARNING in X.java (at line 2)\n" + 
4503
			"	public Object[] toArray(Object[] a) {\n" + 
4504
			"	       ^^^^^^^^\n" + 
4505
			"Type safety: The return type Object[] for toArray(Object[]) from the type X needs unchecked conversion to conform to T[] from the type Collection<E>\n" + 
4506
			"----------\n");
4507
	}			
4508
	public void test0150() {
4509
		this.runNegativeTest(
4510
			new String[] {
4511
				"X.java",
4512
				"import java.util.*;\n" + 
4513
				"public class X {\n" + 
4514
				"    \n" + 
4515
				"    <T extends X> void foo(T[] ta, List<T> lt) {\n" + 
4516
				"    }\n" + 
4517
				"    \n" + 
4518
				"    public static void main(String[] args) {\n" + 
4519
				"		new X().foo(args, new ArrayList<String>());\n" + 
4520
				"	}\n" + 
4521
				"}\n"
4522
			},
4523
			"----------\n" + 
4524
			"1. ERROR in X.java (at line 8)\n" + 
4525
			"	new X().foo(args, new ArrayList<String>());\n" + 
4526
			"	        ^^^\n" + 
4527
			"Bound mismatch: The generic method foo(T[], List<T>) of type X is not applicable for the arguments (String[], ArrayList<String>). The inferred type String is not a valid substitute for the bounded parameter <T extends X>\n" + 
4528
			"----------\n");
4529
	}			
4530
	public void test0151() {
4531
		this.runNegativeTest(
4532
			new String[] {
4533
				"X.java",
4534
				"import java.util.*;\n" + 
4535
				"public class X <E>{\n" + 
4536
				"    \n" + 
4537
				"    <T extends X> X(T[] ta, List<T> lt) {\n" + 
4538
				"    }\n" + 
4539
				"    \n" + 
4540
				"    public static void main(String[] args) {\n" + 
4541
				"		new X<Object>(args, new ArrayList<String>());\n" + 
4542
				"	}\n" + 
4543
				"}\n"
4544
			},
4545
			"----------\n" + 
4546
			"1. WARNING in X.java (at line 4)\n" + 
4547
			"	<T extends X> X(T[] ta, List<T> lt) {\n" + 
4548
			"	           ^\n" + 
4549
			"X is a raw type. References to generic type X<E> should be parameterized\n" + 
4550
			"----------\n" + 
4551
			"2. ERROR in X.java (at line 8)\n" + 
4552
			"	new X<Object>(args, new ArrayList<String>());\n" + 
4553
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
4554
			"Bound mismatch: The generic constructor X(T[], List<T>) of type X<E> is not applicable for the arguments (String[], ArrayList<String>). The inferred type String is not a valid substitute for the bounded parameter <T extends X>\n" + 
4555
			"----------\n");
4556
	}
4557
	// 60556
4558
	public void test0152() {
4559
		this.runConformTest(
4560
			new String[] {
4561
				"X.java",
4562
				"import java.util.*;\n" + 
4563
				"public class X {\n" + 
4564
				"    \n" + 
4565
				"    public static void main(String[] args) {\n" + 
4566
				"        System.out.println(\"SUCCESS\");\n" + 
4567
				"	}\n" + 
4568
				"    List<X> x(List<X> list) {\n" + 
4569
				"        return Collections.unmodifiableList(list);\n" + 
4570
				"    }\n" + 
4571
				"}\n"
4572
			},
4573
			"SUCCESS");
4574
	}		
4575
	public void test0153() {
4576
		this.runConformTest(
4577
			new String[] {
4578
				"X.java",
4579
				"public class X {\n" + 
4580
				"    \n" + 
4581
				"    public static void main(String[] args) {\n" + 
4582
				"        AX<X> ax = new AX<X>();\n" + 
4583
				"        AX<X> a = bar(ax);\n" + 
4584
				"        System.out.println(\"SUCCESS\");\n" + 
4585
				"	}\n" + 
4586
				"    public static <T> AX<T> bar(AX<? extends T> a) {\n" + 
4587
				"		return null;\n" + 
4588
				"    }    \n" + 
4589
				"}\n" + 
4590
				"class AX<E> {\n" + 
4591
				"}\n"
4592
			},
4593
			"SUCCESS");
4594
	}		
4595
	public void test0154() {
4596
		this.runConformTest(
4597
			new String[] {
4598
				"X.java",
4599
				"public class X {\n" + 
4600
				"    \n" + 
4601
				"    public static void main(String[] args) {\n" + 
4602
				"        AX<X> ax = new AX<X>();\n" + 
4603
				"        AX<X> a = bar(ax);\n" + 
4604
				"        System.out.println(\"SUCCESS\");\n" + 
4605
				"	}\n" + 
4606
				"    public static <T> AX<T> bar(AX<? super T> a) {\n" + 
4607
				"		return null;\n" + 
4608
				"    }    \n" + 
4609
				"}\n" + 
4610
				"class AX<E> {\n" + 
4611
				"}\n"
4612
			},
4613
			"SUCCESS");
4614
	}		
4615
	public void test0155() {
4616
		this.runConformTest(
4617
			new String[] {
4618
				"X.java",
4619
				"public class X {\n" + 
4620
				"    \n" + 
4621
				"    public static void main(String[] args) {\n" + 
4622
				"        AX<X> ax = new AX<X>();\n" + 
4623
				"        AX<X> a = bar(ax);\n" + 
4624
				"        System.out.println(\"SUCCESS\");\n" + 
4625
				"	}\n" + 
4626
				"    public static <T> AX<T> bar(AX<?> a) {\n" + 
4627
				"		return null;\n" + 
4628
				"    }    \n" + 
4629
				"}\n" + 
4630
				"class AX<E> {\n" + 
4631
				"}\n"
4632
			},
4633
			"SUCCESS");
4634
	}		
4635
	public void test0156() {
4636
		this.runNegativeTest(
4637
			new String[] {
4638
				"X.java",
4639
				"public class X {\n" + 
4640
				"    \n" + 
4641
				"    public static void main(String[] args) {\n" + 
4642
				"        AX<X> ax = new AX<X>();\n" + 
4643
				"        AX<X> a = bar(ax);\n" + 
4644
				"	}\n" + 
4645
				"    public static <T> AX<T> bar(AX<?> a) {\n" + 
4646
				"		return null;\n" + 
4647
				"    }    \n" + 
4648
				"}\n" + 
4649
				"class AX<E extends X> {\n" + 
4650
				"}\n"
4651
			},
4652
			"----------\n" + 
4653
			"1. ERROR in X.java (at line 7)\n" + 
4654
			"	public static <T> AX<T> bar(AX<?> a) {\n" + 
4655
			"	                     ^\n" + 
4656
			"Bound mismatch: The type T is not a valid substitute for the bounded parameter <E extends X> of the type AX<E>\n" + 
4657
			"----------\n");
4658
	}			
4659
	public void test0157() {
4660
		this.runNegativeTest(
4661
			new String[] {
4662
				"X.java",
4663
				"public class X {\n" + 
4664
				"    \n" + 
4665
				"    public static void main(String[] args) {\n" + 
4666
				"        AX<X> ax = new AX<X>();\n" + 
4667
				"        AX<String> as = new AX<String>();\n" + 
4668
				"        AX<X> a = bar(ax, as);\n" + 
4669
				"        System.out.println(\"SUCCESS\");\n" + 
4670
				"	}\n" + 
4671
				"    public static <T,U> AX<T> bar(AX<? extends U> a, AX<? super U> b) {\n" + 
4672
				"		return null;\n" + 
4673
				"    }    \n" + 
4674
				"}\n" + 
4675
				"class AX<E> {\n" + 
4676
				"}\n"
4677
			},
4678
			"----------\n" + 
4679
			"1. ERROR in X.java (at line 6)\n" + 
4680
			"	AX<X> a = bar(ax, as);\n" + 
4681
			"	          ^^^\n" + 
4682
			"The method bar(AX<? extends U>, AX<? super U>) in the type X is not applicable for the arguments (AX<X>, AX<String>)\n" + 
4683
			"----------\n");
4684
	}
4685
	public void test0158() {
4686
		this.runConformTest(
4687
			new String[] {
4688
				"X.java",
4689
				"public class X {\n" + 
4690
				"    \n" + 
4691
				"    public static void main(String[] args) {\n" + 
4692
				"        AX<X> ax = new AX<X>();\n" + 
4693
				"        AX<String> as = new AX<String>();\n" + 
4694
				"        AX<X> a = bar(ax, as);\n" + 
4695
				"        System.out.println(\"SUCCESS\");\n" + 
4696
				"	}\n" + 
4697
				"    public static <T,U> AX<T> bar(AX<?> a, AX<? super U> b) {\n" + 
4698
				"		return null;\n" + 
4699
				"    }    \n" + 
4700
				"}\n" + 
4701
				"class AX<E> {\n" + 
4702
				"}\n"
4703
			},
4704
			"SUCCESS");
4705
	}
4706
	public void test0159() {
4707
		this.runNegativeTest(
4708
			new String[] {
4709
				"X.java",
4710
				"public class X {\n" + 
4711
				"    \n" + 
4712
				"    public static void main(String[] args) {\n" + 
4713
				"        AX<X> ax = new AX<X>(new X());\n" + 
4714
				"        AX<String> as = new AX<String>(\"SUCCESS\");\n" + 
4715
				"        AX<X> a = bar(ax, as);\n" + 
4716
				"	}\n" + 
4717
				"    public static <T,U> T bar(AX<?> a, AX<? super U> b) {\n" + 
4718
				"		return a.get();\n" + 
4719
				"    }    \n" + 
4720
				"}\n" + 
4721
				"class AX<E> {\n" + 
4722
				"	 E e;\n" +
4723
				"    AX(E e) { this.e = e; }\n" + 
4724
				"    E get() { return this.e; }\n" + 
4725
				"}\n"
4726
			},
4727
			"----------\n" + 
4728
			"1. ERROR in X.java (at line 9)\n" + 
4729
			"	return a.get();\n" + 
4730
			"	       ^^^^^^^\n" + 
4731
			"Type mismatch: cannot convert from capture#1-of ? to T\n" + 
4732
			"----------\n");
4733
	}		
4734
	public void test0160() {
4735
		this.runNegativeTest(
4736
			new String[] {
4737
				"X.java",
4738
				"public class X {\n" + 
4739
				"    \n" + 
4740
				"    public static void main(String[] args) {\n" + 
4741
				"        String s = foo(new AX<String>(\"aaa\"));\n" + 
4742
				"	}\n" + 
4743
				"    static <V> V foo(AX<String> a) {\n" + 
4744
				"        return a.get();\n" + 
4745
				"    }\n" + 
4746
				"}\n" + 
4747
				"class AX<E> {\n" + 
4748
				"    E e;\n" + 
4749
				"    AX(E e) { this.e = e; }\n" + 
4750
				"    E get() { return this.e; }\n" + 
4751
				"}\n"
4752
			},
4753
			"----------\n" + 
4754
			"1. ERROR in X.java (at line 7)\n" + 
4755
			"	return a.get();\n" + 
4756
			"	       ^^^^^^^\n" + 
4757
			"Type mismatch: cannot convert from String to V\n" + 
4758
			"----------\n");
4759
	}		
4760
	public void test0161() {
4761
		this.runNegativeTest(
4762
			new String[] {
4763
				"X.java",
4764
				"public class X {\n" + 
4765
				"    \n" + 
4766
				"    public static void main(String[] args) {\n" + 
4767
				"        boolean b = foo(new AX<String>(\"aaa\")).equals(args);\n" + 
4768
				"	}\n" + 
4769
				"    static <V> V foo(AX<String> a) {\n" + 
4770
				"        return a.get();\n" + 
4771
				"    }\n" + 
4772
				"    String bar() {\n" + 
4773
				"        return \"bbb\";\n" + 
4774
				"    }\n" + 
4775
				"}\n" + 
4776
				"class AX<E> {\n" + 
4777
				"    E e;\n" + 
4778
				"    AX(E e) { this.e = e; }\n" + 
4779
				"    E get() { return this.e; }\n" + 
4780
				"}\n"
4781
			},
4782
			"----------\n" + 
4783
			"1. ERROR in X.java (at line 7)\n" + 
4784
			"	return a.get();\n" + 
4785
			"	       ^^^^^^^\n" + 
4786
			"Type mismatch: cannot convert from String to V\n" + 
4787
			"----------\n");
4788
	}		
4789
	public void test0162() {
4790
		this.runNegativeTest(
4791
			new String[] {
4792
				"X.java",
4793
				"public class X {\n" + 
4794
				"    \n" + 
4795
				"    public static void main(String[] args) {\n" + 
4796
				"        String s = foo(new AX<String>(\"aaa\")).bar();\n" + 
4797
				"	}\n" + 
4798
				"    static <V> V foo(AX<String> a) {\n" + 
4799
				"        return a.get();\n" + 
4800
				"    }\n" + 
4801
				"    String bar() {\n" + 
4802
				"        return \"bbb\";\n" + 
4803
				"    }\n" + 
4804
				"}\n" + 
4805
				"class AX<E> {\n" + 
4806
				"    E e;\n" + 
4807
				"    AX(E e) { this.e = e; }\n" + 
4808
				"    E get() { return this.e; }\n" + 
4809
				"}\n"
4810
			},
4811
			"----------\n" + 
4812
			"1. ERROR in X.java (at line 4)\n" + 
4813
			"	String s = foo(new AX<String>(\"aaa\")).bar();\n" + 
4814
			"	                                      ^^^\n" + 
4815
			"The method bar() is undefined for the type Object\n" + 
4816
			"----------\n" + 
4817
			"2. ERROR in X.java (at line 7)\n" + 
4818
			"	return a.get();\n" + 
4819
			"	       ^^^^^^^\n" + 
4820
			"Type mismatch: cannot convert from String to V\n" + 
4821
			"----------\n");
4822
	}		
4823
	public void test0163() {
4824
		this.runNegativeTest(
4825
			new String[] {
4826
				"X.java",
4827
				"public class X {\n" + 
4828
				"    \n" + 
4829
				"    public static void main(String[] args) {\n" + 
4830
				"        String s = foo(new AX<String>(\"aaa\")).bar();\n" + 
4831
				"	}\n" + 
4832
				"    static <V> V foo(AX<String> a) {\n" + 
4833
				"        return a.get();\n" + 
4834
				"    }\n" + 
4835
				"    String bar() {\n" + 
4836
				"        return \"bbb\";\n" + 
4837
				"    }\n" + 
4838
				"}\n" + 
4839
				"class AX<E> {\n" + 
4840
				"    E e;\n" + 
4841
				"    AX(E e) { this.e = e; }\n" + 
4842
				"    E get() { return this.e; }\n" + 
4843
				"}\n"
4844
			},
4845
			"----------\n" + 
4846
			"1. ERROR in X.java (at line 4)\n" + 
4847
			"	String s = foo(new AX<String>(\"aaa\")).bar();\n" + 
4848
			"	                                      ^^^\n" + 
4849
			"The method bar() is undefined for the type Object\n" + 
4850
			"----------\n" + 
4851
			"2. ERROR in X.java (at line 7)\n" + 
4852
			"	return a.get();\n" + 
4853
			"	       ^^^^^^^\n" + 
4854
			"Type mismatch: cannot convert from String to V\n" + 
4855
			"----------\n");
4856
	}		
4857
	public void test0164() {
4858
		this.runConformTest(
4859
			new String[] {
4860
				"X.java",
4861
				"import java.util.List;\n" + 
4862
				"public class X {\n" + 
4863
				"    public static void main(String[] args) {\n" + 
4864
				"        foo(new AX<String>(\"SUCCESS\"));\n" + 
4865
				"	}\n" + 
4866
				"    static <V> List<V> foo(AX<String> a) {\n" + 
4867
				"        System.out.println(a.get());\n" + 
4868
				"        List<V> v = null;\n" + 
4869
				"        if (a == null) v = foo(a); \n" + 
4870
				"        return v;\n" + 
4871
				"    }\n" + 
4872
				"}\n" + 
4873
				"class AX<E> {\n" + 
4874
				"    E e;\n" + 
4875
				"    AX(E e) { this.e = e; }\n" + 
4876
				"    E get() { return this.e; }\n" + 
4877
				"}\n"
4878
			},
4879
			"SUCCESS");
4880
	}		
4881
	public void test0165() {
4882
		this.runConformTest(
4883
			new String[] {
4884
				"X.java",
4885
				"public class X {\n" + 
4886
				"    \n" + 
4887
				"    public static void main(String[] args) {\n" + 
4888
				"        AX<X> ax = new AX<X>();\n" + 
4889
				"        AX<String> a = bar(ax);\n" + 
4890
				"        System.out.println(\"SUCCESS\");\n" + 
4891
				"	}\n" + 
4892
				"    public static <T> AX<T> bar(AX<?> a) {\n" + 
4893
				"		 if (a == null) {\n" +
4894
				"        	AX<String> as = bar(a);\n" + 
4895
				"        	String s = as.get();\n" + 
4896
				"		}\n" +
4897
				"		return null;\n" + 
4898
				"    }    \n" + 
4899
				"}\n" + 
4900
				"class AX<E> {\n" + 
4901
				"    E get() { return null; }\n" + 
4902
				"}\n"
4903
			},
4904
			"SUCCESS");
4905
	}
4906
	public void test0166() {
4907
		this.runConformTest(
4908
			new String[] {
4909
				"X.java",
4910
				"public class X {\n" + 
4911
				"    \n" + 
4912
				"    public static void main(String[] args) {\n" + 
4913
				"        AX<X> ax = new AX<X>(new X());\n" + 
4914
				"        AX<String> a = bar(ax, true);\n" + 
4915
				"        String s = a.get();\n" + 
4916
				"        System.out.println(s);\n" + 
4917
				"	}\n" + 
4918
				"    public static <T> AX<T> bar(AX<?> a, boolean recurse) {\n" + 
4919
				"        if (recurse) {\n" + 
4920
				"	        AX<String> as = bar(a, false);\n" + 
4921
				"			String s = as.get();\n" + 
4922
				"        }\n" + 
4923
				"		return new AX(\"SUCCESS\");\n" + 
4924
				"    }    \n" + 
4925
				"}\n" + 
4926
				"class AX<E> {\n" + 
4927
				"    E e;\n" + 
4928
				"    AX(E e) { this.e = e; }\n" + 
4929
				"    E get() { return this.e; }\n" + 
4930
				"}\n"
4931
			},
4932
			"SUCCESS");
4933
	}	
4934
	public void test0167() {
4935
		this.runConformTest(
4936
			new String[] {
4937
				"X.java",
4938
				"public class X {\n" + 
4939
				"    \n" + 
4940
				"    public static void main(String[] args) {\n" + 
4941
				"        AX<String, Thread> a = bar();\n" + 
4942
				"        String s = a.get();\n" + 
4943
				"        System.out.println(s);\n" + 
4944
				"	}\n" + 
4945
				"    public static <T, U> AX<T, U> bar() {\n" + 
4946
				"		return new AX(\"SUCCESS\");\n" + 
4947
				"    }    \n" + 
4948
				"}\n" + 
4949
				"class AX<E, F> {\n" + 
4950
				"    E e;\n" + 
4951
				"    AX(E e) { this.e = e; }\n" + 
4952
				"    E get() { return this.e; }\n" + 
4953
				"}\n"
4954
			},
4955
			"SUCCESS");
4956
	}		
4957
	public void test0168() {
4958
		this.runNegativeTest(
4959
			new String[] {
4960
				"X.java",
4961
				"public class X {\n" + 
4962
				"    \n" + 
4963
				"    public static void main(String[] args) {\n" + 
4964
				"        AX<String, Thread> a = bar();\n" + 
4965
				"        String s = a.get();\n" + 
4966
				"        System.out.println(s);\n" + 
4967
				"	}\n" + 
4968
				"    public static <T, U> AX<AX<T, T>, U> bar() {\n" + 
4969
				"		return new AX(\"SUCCESS\");\n" + 
4970
				"    }    \n" + 
4971
				"}\n" + 
4972
				"class AX<E, F> {\n" + 
4973
				"    E e;\n" + 
4974
				"    AX(E e) { this.e = e; }\n" + 
4975
				"    E get() { return this.e; }\n" + 
4976
				"}\n"
4977
			},
4978
			"----------\n" + 
4979
			"1. ERROR in X.java (at line 4)\n" + 
4980
			"	AX<String, Thread> a = bar();\n" + 
4981
			"	                       ^^^^^\n" + 
4982
			"Type mismatch: cannot convert from AX<AX<Object,Object>,Thread> to AX<String,Thread>\n" + 
4983
			"----------\n" + 
4984
			"2. WARNING in X.java (at line 9)\n" + 
4985
			"	return new AX(\"SUCCESS\");\n" + 
4986
			"	       ^^^^^^^^^^^^^^^^^\n" + 
4987
			"Type safety: The constructor AX(Object) belongs to the raw type AX. References to generic type AX<E,F> should be parameterized\n" + 
4988
			"----------\n" + 
4989
			"3. WARNING in X.java (at line 9)\n" + 
4990
			"	return new AX(\"SUCCESS\");\n" + 
4991
			"	       ^^^^^^^^^^^^^^^^^\n" + 
4992
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<AX<T,T>,U>\n" + 
4993
			"----------\n" + 
4994
			"4. WARNING in X.java (at line 9)\n" + 
4995
			"	return new AX(\"SUCCESS\");\n" + 
4996
			"	           ^^\n" + 
4997
			"AX is a raw type. References to generic type AX<E,F> should be parameterized\n" + 
4998
			"----------\n");
4999
	}		
5000
	public void test0169() {
5001
		this.runNegativeTest(
5002
			new String[] {
5003
				"X.java",
5004
				"public class X {\n" + 
5005
				"    \n" + 
5006
				"    public static void main(String[] args) {\n" + 
5007
				"        AX<String> a = bar(new X());\n" + 
5008
				"        String s = a.get();\n" + 
5009
				"        System.out.println(s);\n" + 
5010
				"	}\n" + 
5011
				"    public static <T> AX<T> bar(T t) {\n" + 
5012
				"		return new AX(\"SUCCESS\");\n" + 
5013
				"    }    \n" + 
5014
				"}\n" + 
5015
				"class AX<E> {\n" + 
5016
				"    E e;\n" + 
5017
				"    AX(E e) { this.e = e; }\n" + 
5018
				"    E get() { return this.e; }\n" + 
5019
				"}\n"
5020
			},
5021
			"----------\n" + 
5022
			"1. ERROR in X.java (at line 4)\n" + 
5023
			"	AX<String> a = bar(new X());\n" + 
5024
			"	               ^^^^^^^^^^^^\n" + 
5025
			"Type mismatch: cannot convert from AX<X> to AX<String>\n" + 
5026
			"----------\n" + 
5027
			"2. WARNING in X.java (at line 9)\n" + 
5028
			"	return new AX(\"SUCCESS\");\n" + 
5029
			"	       ^^^^^^^^^^^^^^^^^\n" + 
5030
			"Type safety: The constructor AX(Object) belongs to the raw type AX. References to generic type AX<E> should be parameterized\n" + 
5031
			"----------\n" + 
5032
			"3. WARNING in X.java (at line 9)\n" + 
5033
			"	return new AX(\"SUCCESS\");\n" + 
5034
			"	       ^^^^^^^^^^^^^^^^^\n" + 
5035
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<T>\n" + 
5036
			"----------\n" + 
5037
			"4. WARNING in X.java (at line 9)\n" + 
5038
			"	return new AX(\"SUCCESS\");\n" + 
5039
			"	           ^^\n" + 
5040
			"AX is a raw type. References to generic type AX<E> should be parameterized\n" + 
5041
			"----------\n");
5042
	}
5043
	// Expected type inference for cast operation
5044
	public void test0170() {
5045
		this.runNegativeTest(
5046
			new String[] {
5047
				"X.java",
5048
				"public class X {\n" + 
5049
				"    \n" + 
5050
				"    public static void main(String[] args) {\n" + 
5051
				"        AX<X> ax = new AX<X>(new X());\n" + 
5052
				"        AX<String> as = new AX<String>(\"\");\n" + 
5053
				"        ax = (AX)bar(ax);\n" + // shouldn't complain about unnecessary cast
5054
				"	}\n" + 
5055
				"    public static <T> T bar(AX<?> a) {\n" + 
5056
				"		return a.get();\n" + 
5057
				"    }    \n" + 
5058
				"}\n" + 
5059
				"class AX<E> {\n" + 
5060
				"	 E e;\n" + 
5061
				"    AX(E e) { this.e = e; }\n" + 
5062
				"    E get() { return this.e; }\n" + 
5063
				"}\n"
5064
			},
5065
			"----------\n" + 
5066
			"1. WARNING in X.java (at line 6)\n" + 
5067
			"	ax = (AX)bar(ax);\n" + 
5068
			"	     ^^^^^^^^^^^\n" + 
5069
			"Type safety: The expression of type AX needs unchecked conversion to conform to AX<X>\n" + 
5070
			"----------\n" + 
5071
			"2. WARNING in X.java (at line 6)\n" + 
5072
			"	ax = (AX)bar(ax);\n" + 
5073
			"	      ^^\n" + 
5074
			"AX is a raw type. References to generic type AX<E> should be parameterized\n" + 
5075
			"----------\n" + 
5076
			"3. ERROR in X.java (at line 9)\n" + 
5077
			"	return a.get();\n" + 
5078
			"	       ^^^^^^^\n" + 
5079
			"Type mismatch: cannot convert from capture#1-of ? to T\n" + 
5080
			"----------\n");
5081
	}
5082
	// Expected type inference for cast operation
5083
	public void test0171() {
5084
		this.runNegativeTest(
5085
			new String[] {
5086
				"X.java",
5087
				"public class X {\n" + 
5088
				"    \n" + 
5089
				"    public static void main(String[] args) {\n" + 
5090
				"        AX<X> ax = new AX<X>(new X());\n" + 
5091
				"        AX<String> as = new AX<String>(\"\");\n" + 
5092
				"        ax = (AX<X>)bar(ax);\n" + // shouldn't complain about unnecessary cast as return type inference do not
5093
				"	}\n" +                                         // work on cast conversion
5094
				"    public static <T> T bar(AX<?> a) {\n" + 
5095
				"		return a.get();\n" + 
5096
				"    }    \n" + 
5097
				"}\n" + 
5098
				"class AX<E> {\n" + 
5099
				"	 E e;\n" + 
5100
				"    AX(E e) { this.e = e; }\n" + 
5101
				"    E get() { return this.e; }\n" + 
5102
				"}\n"
5103
			},
5104
			"----------\n" + 
5105
			"1. WARNING in X.java (at line 6)\n" + 
5106
			"	ax = (AX<X>)bar(ax);\n" + 
5107
			"	     ^^^^^^^^^^^^^^\n" + 
5108
			"Type safety: Unchecked cast from Object to AX<X>\n" + 
5109
			"----------\n" + 
5110
			"2. ERROR in X.java (at line 9)\n" + 
5111
			"	return a.get();\n" + 
5112
			"	       ^^^^^^^\n" + 
5113
			"Type mismatch: cannot convert from capture#1-of ? to T\n" + 
5114
			"----------\n");
5115
	}
5116
	// Expected type inference for cast operation
5117
	public void test0172() {
5118
		this.runNegativeTest(
5119
			new String[] {
5120
				"X.java",
5121
				"public class X {\n" + 
5122
				"    \n" + 
5123
				"    public static void main(String[] args) {\n" + 
5124
				"        AX<X> ax = new AX<X>(new X());\n" + 
5125
				"        AX<String> as = new AX<String>(\"SUCCESS\");\n" + 
5126
				"        ax = (AX<X>)bar(ax);\n" + // no warn for unsafe cast, since forbidden cast
5127
				"	}\n" + 
5128
				"    public static <T> String bar(AX<?> a) {\n" + 
5129
				"		return null;\n" + 
5130
				"    }    \n" + 
5131
				"}\n" + 
5132
				"class AX<E> {\n" + 
5133
				"	 E e;\n" + 
5134
				"    AX(E e) { this.e = e; }\n" + 
5135
				"    E get() { return this.e; }\n" + 
5136
				"}\n"
5137
			},
5138
			"----------\n" + 
5139
			"1. ERROR in X.java (at line 6)\n" + 
5140
			"	ax = (AX<X>)bar(ax);\n" + 
5141
			"	     ^^^^^^^^^^^^^^\n" + 
5142
			"Cannot cast from String to AX<X>\n" + 
5143
			"----------\n");
5144
	}
5145
	// Expected type inference for return statement
5146
	public void test0173() {
5147
		this.runConformTest(
5148
			new String[] {
5149
				"X.java",
5150
				"public class X {\n" + 
5151
				"    \n" + 
5152
				"    public static void main(String[] args) {\n" + 
5153
				"    	foo();\n" + 
5154
				"    	System.out.println(\"SUCCESS\");\n" + 
5155
				"	}\n" + 
5156
				"    public static <T> T bar(AX<?> a) {\n" + 
5157
				"		return null;\n" + 
5158
				"    }    \n" + 
5159
				"    public static AX<X> foo() {\n" + 
5160
				"        AX<X> ax = new AX<X>(new X());\n" + 
5161
				"       return bar(ax);\n" + // use return type of enclosing method for type inference
5162
				"    }\n" + 
5163
				"}\n" + 
5164
				"class AX<E> {\n" + 
5165
				"	 E e;\n" + 
5166
				"    AX(E e) { this.e = e; }\n" + 
5167
				"    E get() { return this.e; }\n" + 
5168
				"}\n" + 
5169
				"\n"
5170
			},
5171
			"SUCCESS");
5172
	}	
5173
	// Expected type inference for field declaration
5174
	public void test0174() {
5175
		this.runConformTest(
5176
			new String[] {
5177
				"X.java",
5178
				"public class X {\n" + 
5179
				"    \n" + 
5180
				"    public static void main(String[] args) {\n" + 
5181
				"    	Object o = foo;\n" + 
5182
				"    	System.out.println(\"SUCCESS\");\n" + 
5183
				"	}\n" + 
5184
				"    public static <T> T bar(AX<?> a) {\n" + 
5185
				"		return null;\n" + 
5186
				"    }    \n" + 
5187
				"    static AX<X> foo = bar(new AX<X>(new X()));\n" + // use field type for type inference
5188
				"}\n" + 
5189
				"class AX<E> {\n" + 
5190
				"	 E e;\n" + 
5191
				"    AX(E e) { this.e = e; }\n" + 
5192
				"    E get() { return this.e; }\n" + 
5193
				"}\n" + 
5194
				"\n"
5195
			},
5196
			"SUCCESS");
5197
	}		
5198
	// 60563
5199
	public void test0175() {
5200
		this.runConformTest(
5201
			new String[] {
5202
				"X.java",
5203
				"    interface A<T> {\n" + 
5204
				"        T[] m1(T x);                          \n" + 
5205
				"    }\n" + 
5206
				"    public class X { \n" + 
5207
				"    	public static void main(String[] args) {\n" + 
5208
				"			new X().m2(new A<X>(){ \n" + 
5209
				"				public X[] m1(X x) { \n" + 
5210
				"					System.out.println(\"SUCCESS\");\n" + 
5211
				"					return null;\n" + 
5212
				"				}\n" + 
5213
				"			});\n" + 
5214
				"		}\n" + 
5215
				"        void m2(A<X> x) { \n" + 
5216
				"            m3(x.m1(new X())); \n" + 
5217
				"        }\n" + 
5218
				"        void m3(X[] x) {\n" + 
5219
				"        }                    \n" + 
5220
				"    }\n"
5221
			},
5222
			"SUCCESS");
5223
	}
5224
	// unsafe raw return value
5225
	public void test0176() {
5226
		Map customOptions = getCompilerOptions();
5227
		this.runNegativeTest(
5228
			new String[] {
5229
				"X.java",
5230
				"import java.util.*;\n" + 
5231
				"\n" + 
5232
				"public class X {\n" + 
5233
				"    <T> Vector<T> valuesOf(Hashtable<?, T> h) {\n" + 
5234
				"        return new Vector();\n" + 
5235
				"    }\n" + 
5236
				"    Vector<Object> data;\n" + 
5237
				"    \n" + 
5238
				"    public void t() {\n" + 
5239
				"        Vector<Object> v = (Vector<Object>) data.elementAt(0);\n" + 
5240
				"    }\n" + 
5241
				"}\n", 
5242
			},
5243
			"----------\n" + 
5244
			"1. WARNING in X.java (at line 5)\n" + 
5245
			"	return new Vector();\n" + 
5246
			"	       ^^^^^^^^^^^^\n" + 
5247
			"Type safety: The expression of type Vector needs unchecked conversion to conform to Vector<T>\n" + 
5248
			"----------\n" + 
5249
			"2. WARNING in X.java (at line 5)\n" + 
5250
			"	return new Vector();\n" + 
5251
			"	           ^^^^^^\n" + 
5252
			"Vector is a raw type. References to generic type Vector<E> should be parameterized\n" + 
5253
			"----------\n" + 
5254
			"3. WARNING in X.java (at line 10)\n" + 
5255
			"	Vector<Object> v = (Vector<Object>) data.elementAt(0);\n" + 
5256
			"	                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5257
			"Type safety: Unchecked cast from Object to Vector<Object>\n" + 
5258
			"----------\n",
5259
			null,
5260
			true,
5261
			customOptions);
5262
	}
5263
	// cast to type variable allowed, can be diagnosed as unnecessary
5264
	public void test0177() {
5265
		Map customOptions = getCompilerOptions();
5266
		this.runNegativeTest(
5267
			new String[] {
5268
				"X.java",
5269
				"public class X <T> {\n" + 
5270
				"	\n" + 
5271
				"	T foo(T t) {\n" + 
5272
				"		return (T) t;\n" + 
5273
				"	}\n" + 
5274
				"}\n", 
5275
			},
5276
			"----------\n" + 
5277
			"1. WARNING in X.java (at line 4)\n" + 
5278
			"	return (T) t;\n" + 
5279
			"	       ^^^^^\n" + 
5280
			"Unnecessary cast from T to T\n" + 
5281
			"----------\n",
5282
			null,
5283
			true,
5284
			customOptions);
5285
	}
5286
	// reject instanceof type variable or parameterized type
5287
	public void test0178() {
5288
		Map customOptions = getCompilerOptions();
5289
		this.runNegativeTest(
5290
			new String[] {
5291
				"X.java",
5292
				"public class X <T> {\n" + 
5293
				"	\n" + 
5294
				"	T foo(T t) {\n" + 
5295
				"		if (t instanceof X<T>) {\n" + 
5296
				"			return t;\n" + 
5297
				"		} else if (t instanceof X<String>) {\n" + 
5298
				"			return t;\n" + 
5299
				"		} else if (t instanceof X<?>) {\n" +  // ok
5300
				"			return t;\n" + 
5301
				"		} else 	if (t instanceof T) {\n" + 
5302
				"			return t;\n" + 
5303
				"		} else if (t instanceof X) {\n" + 
5304
				"			return t;\n" + 
5305
				"		}\n" + 
5306
				"		return null;\n" + 
5307
				"	}\n" + 
5308
				"}\n", 
5309
			},
5310
			"----------\n" + 
5311
			"1. ERROR in X.java (at line 4)\n" + 
5312
			"	if (t instanceof X<T>) {\n" + 
5313
			"	    ^^^^^^^^^^^^^^\n" + 
5314
			"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" + 
5315
			"----------\n" + 
5316
			"2. ERROR in X.java (at line 6)\n" + 
5317
			"	} else if (t instanceof X<String>) {\n" + 
5318
			"	           ^^^^^^^^^^^^^^\n" + 
5319
			"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" + 
5320
			"----------\n" + 
5321
			"3. ERROR in X.java (at line 10)\n" + 
5322
			"	} else 	if (t instanceof T) {\n" + 
5323
			"	       	    ^^^^^^^^^^^^^^\n" + 
5324
			"Cannot perform instanceof check against type parameter T. Use instead its erasure Object since generic type information will be erased at runtime\n" + 
5325
			"----------\n",
5326
			null,
5327
			true,
5328
			customOptions);
5329
	}
5330
	// 61507
5331
	public void test0179() {
5332
		this.runConformTest(
5333
			new String[] {
5334
				"X.java",
5335
				"class U {\n" + 
5336
				" static <T> T notNull(T t) { return t; }\n" + 
5337
				"}\n" + 
5338
				"public class X {\n" + 
5339
				" void t() {\n" + 
5340
				"  String s = U.notNull(null);\n" + 
5341
				" }\n" + 
5342
				" public static void main(String[] args) {\n" + 
5343
				"	new X().t();\n" + 
5344
				"	System.out.println(\"SUCCESS\");\n" + 
5345
				"}\n" + 
5346
				"}\n", 
5347
			},
5348
			"SUCCESS");
5349
	}	
5350
	public void test0180() {
5351
		this.runConformTest(
5352
			new String[] {
5353
				"X.java",
5354
				"class U {\n" + 
5355
				" static <T> T notNull(T t) { return t; }\n" + 
5356
				"}\n" + 
5357
				"public class X {\n" + 
5358
				" void t() {\n" + 
5359
				"  String s = U.notNull(\"\");\n" + 
5360
				" }\n" + 
5361
				" public static void main(String[] args) {\n" + 
5362
				"	new X().t();\n" + 
5363
				"	System.out.println(\"SUCCESS\");\n" + 
5364
				"}\n" + 
5365
				"}\n", 
5366
			},
5367
			"SUCCESS");
5368
	}	
5369
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=61507 - variation computing most specific type with 'null'
5370
	public void test0181() {
5371
		this.runConformTest(
5372
			new String[] {
5373
				"X.java",
5374
				"class U {\n" + 
5375
				" static <T> T notNull(T t, V<T> vt) { return t; }\n" + 
5376
				"}\n" + 
5377
				"class V<T> {}\n" + 
5378
				"\n" + 
5379
				"public class X {\n" + 
5380
				" void t() {\n" + 
5381
				"  String s = U.notNull(null, new V<String>());\n" + 
5382
				" }\n" + 
5383
				" public static void main(String[] args) {\n" + 
5384
				"	new X().t();\n" + 
5385
				"	System.out.println(\"SUCCESS\");\n" + 
5386
				"}\n" + 
5387
				"}\n", 
5388
			},
5389
			"SUCCESS");
5390
	}
5391
	public void test0182() {
5392
		this.runNegativeTest(
5393
			new String[] {
5394
				"X.java",
5395
				"public class X<E> {\n" + 
5396
				"    X<E> foo() {\n" + 
5397
				"    	return (X<E>) this;\n" + 
5398
				"    }\n" + 
5399
				"    X<String> bar() {\n" + 
5400
				"    	return (AX<String>) new X<String>();\n" + 
5401
				"    }\n" + 
5402
				"    X<String> bar(Object o) {\n" + 
5403
				"    	return (AX<String>) o;\n" + 
5404
				"    }\n" + 
5405
				"    X<E> foo(Object o) {\n" + 
5406
				"    	return (AX<E>) o;\n" + 
5407
				"    }    \n" + 
5408
				"    X<E> baz(Object o) {\n" + 
5409
				"    	return (AX<E>) null;\n" + 
5410
				"    }\n" + 
5411
				"    X<String> baz2(BX bx) {\n" + 
5412
				"    	return (X<String>) bx;\n" + 
5413
				"    }    \n" + 
5414
				"}\n" + 
5415
				"class AX<F> extends X<F> {}\n" + 
5416
				"class BX extends AX<String> {}\n", 
5417
			},
5418
			"----------\n" + 
5419
			"1. WARNING in X.java (at line 3)\n" + 
5420
			"	return (X<E>) this;\n" + 
5421
			"	       ^^^^^^^^^^^\n" + 
5422
			"Unnecessary cast from X<E> to X<E>\n" + 
5423
			"----------\n" + 
5424
			"2. WARNING in X.java (at line 6)\n" + 
5425
			"	return (AX<String>) new X<String>();\n" + 
5426
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5427
			"Unnecessary cast from X<String> to AX<String>\n" + 
5428
			"----------\n" + 
5429
			"3. WARNING in X.java (at line 9)\n" + 
5430
			"	return (AX<String>) o;\n" + 
5431
			"	       ^^^^^^^^^^^^^^\n" + 
5432
			"Type safety: Unchecked cast from Object to AX<String>\n" + 
5433
			"----------\n" + 
5434
			"4. WARNING in X.java (at line 12)\n" + 
5435
			"	return (AX<E>) o;\n" + 
5436
			"	       ^^^^^^^^^\n" + 
5437
			"Type safety: Unchecked cast from Object to AX<E>\n" + 
5438
			"----------\n" + 
5439
			"5. WARNING in X.java (at line 15)\n" + 
5440
			"	return (AX<E>) null;\n" + 
5441
			"	       ^^^^^^^^^^^^\n" + 
5442
			"Unnecessary cast from null to AX<E>\n" + 
5443
			"----------\n" + 
5444
			"6. WARNING in X.java (at line 18)\n" + 
5445
			"	return (X<String>) bx;\n" + 
5446
			"	       ^^^^^^^^^^^^^^\n" + 
5447
			"Unnecessary cast from BX to X<String>\n" + 
5448
			"----------\n");
5449
	}
5450
	public void test0183() {
5451
		this.runNegativeTest(
5452
			new String[] {
5453
				"X.java",
5454
				"import java.util.*;\n" + 
5455
				"\n" + 
5456
				"public class X {\n" + 
5457
				"	\n" + 
5458
				"	{\n" + 
5459
				"		Dictionary<String, Integer> d;\n" + 
5460
				"		Object o;\n" + 
5461
				"		\n" + 
5462
				"		Object a1 = (Hashtable<String,Integer>) d;\n" + 
5463
				"		Object a2 = (Hashtable) o;\n" + 
5464
				"\n" + 
5465
				"		Object a3 = (Hashtable<Float, Double>) d;\n" + 
5466
				"		Object a4 = (Hashtable<String,Integer>) o;\n" + 
5467
				"		\n" + 
5468
				"		abstract class Z1 extends Hashtable<String,Integer> {\n" + 
5469
				"		}\n" + 
5470
				"		Z1 z1;\n" + 
5471
				"		Object a5 = (Hashtable<String,Integer>) z1;\n" + 
5472
				"\n" + 
5473
				"		abstract class Z2 extends Z1 {\n" + 
5474
				"		}\n" + 
5475
				"		Object a6 = (Z2) z1;\n" + 
5476
				"\n" + 
5477
				"		abstract class Z3 extends Hashtable {\n" + 
5478
				"		}\n" + 
5479
				"		Z3 z3;\n" + 
5480
				"		Object a7 = (Hashtable<String,Integer>) z3;\n" + 
5481
				"	}\n" + 
5482
				"}\n", 
5483
			},
5484
			"----------\n" + 
5485
			"1. WARNING in X.java (at line 9)\n" + 
5486
			"	Object a1 = (Hashtable<String,Integer>) d;\n" + 
5487
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5488
			"Unnecessary cast from Dictionary<String,Integer> to Hashtable<String,Integer>\n" + 
5489
			"----------\n" + 
5490
			"2. WARNING in X.java (at line 10)\n" + 
5491
			"	Object a2 = (Hashtable) o;\n" + 
5492
			"	            ^^^^^^^^^^^^^\n" + 
5493
			"Unnecessary cast from Object to Hashtable\n" + 
5494
			"----------\n" + 
5495
			"3. WARNING in X.java (at line 10)\n" + 
5496
			"	Object a2 = (Hashtable) o;\n" + 
5497
			"	             ^^^^^^^^^\n" + 
5498
			"Hashtable is a raw type. References to generic type Hashtable<K,V> should be parameterized\n" + 
5499
			"----------\n" + 
5500
			"4. ERROR in X.java (at line 12)\n" + 
5501
			"	Object a3 = (Hashtable<Float, Double>) d;\n" + 
5502
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5503
			"Cannot cast from Dictionary<String,Integer> to Hashtable<Float,Double>\n" + 
5504
			"----------\n" + 
5505
			"5. WARNING in X.java (at line 12)\n" + 
5506
			"	Object a3 = (Hashtable<Float, Double>) d;\n" + 
5507
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5508
			"Unnecessary cast from Dictionary<String,Integer> to Hashtable<Float,Double>\n" + 
5509
			"----------\n" + 
5510
			"6. WARNING in X.java (at line 13)\n" + 
5511
			"	Object a4 = (Hashtable<String,Integer>) o;\n" + 
5512
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5513
			"Type safety: Unchecked cast from Object to Hashtable<String,Integer>\n" + 
5514
			"----------\n" + 
5515
			"7. WARNING in X.java (at line 13)\n" + 
5516
			"	Object a4 = (Hashtable<String,Integer>) o;\n" + 
5517
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5518
			"Unnecessary cast from Object to Hashtable<String,Integer>\n" + 
5519
			"----------\n" + 
5520
			"8. WARNING in X.java (at line 18)\n" + 
5521
			"	Object a5 = (Hashtable<String,Integer>) z1;\n" + 
5522
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5523
			"Unnecessary cast from Z1 to Hashtable<String,Integer>\n" + 
5524
			"----------\n" + 
5525
			"9. WARNING in X.java (at line 22)\n" + 
5526
			"	Object a6 = (Z2) z1;\n" + 
5527
			"	            ^^^^^^^\n" + 
5528
			"Unnecessary cast from Z1 to Z2\n" + 
5529
			"----------\n" + 
5530
			"10. WARNING in X.java (at line 24)\n" + 
5531
			"	abstract class Z3 extends Hashtable {\n" + 
5532
			"	                          ^^^^^^^^^\n" + 
5533
			"Hashtable is a raw type. References to generic type Hashtable<K,V> should be parameterized\n" + 
5534
			"----------\n" + 
5535
			"11. WARNING in X.java (at line 27)\n" + 
5536
			"	Object a7 = (Hashtable<String,Integer>) z3;\n" + 
5537
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5538
			"Type safety: Unchecked cast from Z3 to Hashtable<String,Integer>\n" + 
5539
			"----------\n" + 
5540
			"12. WARNING in X.java (at line 27)\n" + 
5541
			"	Object a7 = (Hashtable<String,Integer>) z3;\n" + 
5542
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5543
			"Unnecessary cast from Z3 to Hashtable<String,Integer>\n" + 
5544
			"----------\n");
5545
	}
5546
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=62292 - parameterized message send
5547
	public void test0184() {
5548
		this.runConformTest(
5549
			new String[] {
5550
				"X.java",
5551
				"public class X {\n" + 
5552
				"\n" + 
5553
				"	static <T, U> T foo(T t, U u) {\n" + 
5554
				"		return t;\n" + 
5555
				"	}\n" + 
5556
				"	public static void main(String[] args) {\n" + 
5557
				"		System.out.println(X.<String,X>foo(\"SUCCESS\", null));\n" + 
5558
				"	}\n" + 
5559
				"}\n", 
5560
			},
5561
			"SUCCESS");
5562
	}
5563
	// parameterized message send - variation on 184 with non-static generic method
5564
	public void test0185() {
5565
		this.runConformTest(
5566
			new String[] {
5567
				"X.java",
5568
				"public class X {\n" + 
5569
				"\n" + 
5570
				"	<T, U> T foo(T t, U u) {\n" + 
5571
				"		return t;\n" + 
5572
				"	}\n" + 
5573
				"	public static void main(String[] args) {\n" + 
5574
				"		System.out.println(new X().<String,X>foo(\"SUCCESS\", null));\n" + 
5575
				"	}\n" + 
5576
				"}\n", 
5577
			},
5578
			"SUCCESS");
5579
	}			
5580
	// message send parameterized with type not matching parameter bounds
5581
	public void test0186() {
5582
		this.runNegativeTest(
5583
			new String[] {
5584
				"X.java",
5585
				"public class X {\n" + 
5586
				"\n" + 
5587
				"	<T, U extends String> T foo(T t, U u) {\n" + 
5588
				"		return t;\n" + 
5589
				"	}\n" + 
5590
				"	public static void main(String[] args) {\n" + 
5591
				"		System.out.println(new X().<String, X>foo(\"SUCCESS\", null));\n" + 
5592
				"	}\n" + 
5593
				"}\n", 
5594
			},
5595
			"----------\n" + 
5596
			"1. WARNING in X.java (at line 3)\n" + 
5597
			"	<T, U extends String> T foo(T t, U u) {\n" + 
5598
			"	              ^^^^^^\n" + 
5599
			"The type parameter U should not be bounded by the final type String. Final types cannot be further extended\n" + 
5600
			"----------\n" + 
5601
			"2. ERROR in X.java (at line 7)\n" + 
5602
			"	System.out.println(new X().<String, X>foo(\"SUCCESS\", null));\n" + 
5603
			"	                                      ^^^\n" + 
5604
			"Bound mismatch: The generic method foo(T, U) of type X is not applicable for the arguments (String, null). The inferred type X is not a valid substitute for the bounded parameter <U extends String>\n" + 
5605
			"----------\n");
5606
	}			
5607
	// invalid type argument arity for parameterized message send
5608
	public void test0187() {
5609
		this.runNegativeTest(
5610
			new String[] {
5611
				"X.java",
5612
				"public class X {\n" + 
5613
				"\n" + 
5614
				"	<T, U extends String> T foo(T t, U u) {\n" + 
5615
				"		return t;\n" + 
5616
				"	}\n" + 
5617
				"	public static void main(String[] args) {\n" + 
5618
				"		System.out.println(new X().<String>foo(\"SUCCESS\", null));\n" + 
5619
				"	}\n" + 
5620
				"}\n", 
5621
			},
5622
			"----------\n" + 
5623
			"1. WARNING in X.java (at line 3)\n" + 
5624
			"	<T, U extends String> T foo(T t, U u) {\n" + 
5625
			"	              ^^^^^^\n" + 
5626
			"The type parameter U should not be bounded by the final type String. Final types cannot be further extended\n" + 
5627
			"----------\n" + 
5628
			"2. ERROR in X.java (at line 7)\n" + 
5629
			"	System.out.println(new X().<String>foo(\"SUCCESS\", null));\n" + 
5630
			"	                                   ^^^\n" + 
5631
			"Incorrect number of type arguments for generic method <T, U>foo(T, U) of type X; it cannot be parameterized with arguments <String>\n" + 
5632
			"----------\n");
5633
	}				
5634
	// parameterized invocation of non generic method with incorrect argument count
5635
	public void test0188() {
5636
		this.runNegativeTest(
5637
			new String[] {
5638
				"X.java",
5639
				"public class X {\n" + 
5640
				"\n" + 
5641
				"	void foo() {\n" + 
5642
				"		return;\n" + 
5643
				"	}\n" + 
5644
				"	public static void main(String[] args) {\n" + 
5645
				"		System.out.println(new X().<String>foo(\"SUCCESS\", null));\n" + 
5646
				"	}\n" + 
5647
				"}\n", 
5648
			},
5649
			"----------\n" + 
5650
			"1. ERROR in X.java (at line 7)\n" + 
5651
			"	System.out.println(new X().<String>foo(\"SUCCESS\", null));\n" + 
5652
			"	                                   ^^^\n" + 
5653
			"The method foo() in the type X is not applicable for the arguments (String, null)\n" + 
5654
			"----------\n");
5655
	}
5656
	// parameterized invocation of non generic method
5657
	public void test0189() {
5658
		this.runNegativeTest(
5659
			new String[] {
5660
				"X.java",
5661
				"public class X {\n" + 
5662
				"\n" + 
5663
				"	void foo() {\n" + 
5664
				"		return;\n" + 
5665
				"	}\n" + 
5666
				"	public static void main(String[] args) {\n" + 
5667
				"		System.out.println(new X().<String>foo());\n" + 
5668
				"	}\n" + 
5669
				"}\n", 
5670
			},
5671
			"----------\n" + 
5672
			"1. ERROR in X.java (at line 7)\n" + 
5673
			"	System.out.println(new X().<String>foo());\n" + 
5674
			"	                                   ^^^\n" + 
5675
			"The method foo() of type X is not generic; it cannot be parameterized with arguments <String>\n" + 
5676
			"----------\n");
5677
	}		
5678
	// parameterized allocation
5679
	public void test0190() {
5680
		this.runConformTest(
5681
			new String[] {
5682
				"X.java",
5683
				"public class X {\n" + 
5684
				"	public <T> X(T t){\n" + 
5685
				"		System.out.println(t);\n" + 
5686
				"	}\n" + 
5687
				"	public static void main(String[] args) {\n" + 
5688
				"		new <String>X(\"SUCCESS\");\n" + 
5689
				"	}\n" + 
5690
				"}\n", 
5691
			},
5692
			"SUCCESS");
5693
	}		
5694
	// parameterized allocation - wrong arity
5695
	public void test0191() {
5696
		this.runNegativeTest(
5697
			new String[] {
5698
				"X.java",
5699
				"public class X {\n" + 
5700
				"	public <T> X(T t){\n" + 
5701
				"		System.out.println(t);\n" + 
5702
				"	}\n" + 
5703
				"	public static void main(String[] args) {\n" + 
5704
				"		new <String, String>X(\"FAILED\");\n" + 
5705
				"	}\n" + 
5706
				"}\n", 
5707
			},
5708
			"----------\n" + 
5709
			"1. ERROR in X.java (at line 6)\n" + 
5710
			"	new <String, String>X(\"FAILED\");\n" + 
5711
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5712
			"Incorrect number of type arguments for generic constructor <T>X(T) of type X; it cannot be parameterized with arguments <String, String>\n" + 
5713
			"----------\n");
5714
	}			
5715
	// parameterized allocation - non generic target constructor
5716
	// **
5717
	public void test0192() {
5718
		this.runNegativeTest(
5719
			new String[] {
5720
				"X.java",
5721
				"public class X {\n" + 
5722
				"	public X(String t){\n" + 
5723
				"		System.out.println(t);\n" + 
5724
				"	}\n" + 
5725
				"	public static void main(String[] args) {\n" + 
5726
				"		new <String>X(\"FAILED\");\n" + 
5727
				"	}\n" + 
5728
				"}\n", 
5729
			},
5730
			"----------\n" + 
5731
			"1. ERROR in X.java (at line 6)\n" + 
5732
			"	new <String>X(\"FAILED\");\n" + 
5733
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5734
			"The constructor X(String) of type X is not generic; it cannot be parameterized with arguments <String>\n" + 
5735
			"----------\n");
5736
	}			
5737
	// parameterized allocation - argument type mismatch
5738
	public void test0193() {
5739
		this.runNegativeTest(
5740
			new String[] {
5741
				"X.java",
5742
				"public class X {\n" + 
5743
				"	public <T> X(T t){\n" + 
5744
				"		System.out.println(t);\n" + 
5745
				"	}\n" + 
5746
				"	public static void main(String[] args) {\n" + 
5747
				"		new <String>X(new X(null));\n" + 
5748
				"	}\n" + 
5749
				"}\n", 
5750
			},
5751
			"----------\n" + 
5752
			"1. ERROR in X.java (at line 6)\n" + 
5753
			"	new <String>X(new X(null));\n" + 
5754
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5755
			"The parameterized constructor <String>X(String) of type X is not applicable for the arguments (X)\n" + 
5756
			"----------\n");
5757
	}			
5758
	// parameterized invocation - argument type mismatch
5759
	public void test0194() {
5760
		this.runNegativeTest(
5761
			new String[] {
5762
				"X.java",
5763
				"public class X {\n" + 
5764
				"\n" + 
5765
				"	<T> void foo(T t) {\n" + 
5766
				"		return;\n" + 
5767
				"	}\n" + 
5768
				"	public static void main(String[] args) {\n" + 
5769
				"		System.out.println(new X().<String>foo(new X()));\n" + 
5770
				"	}\n" + 
5771
				"}\n", 
5772
			},
5773
			"----------\n" + 
5774
			"1. ERROR in X.java (at line 7)\n" + 
5775
			"	System.out.println(new X().<String>foo(new X()));\n" + 
5776
			"	                                   ^^^\n" + 
5777
			"The parameterized method <String>foo(String) of type X is not applicable for the arguments (X)\n" + 
5778
			"----------\n");
5779
	}
5780
	// parameterized qualified allocation
5781
	public void test0195() {
5782
		this.runConformTest(
5783
			new String[] {
5784
				"X.java",
5785
				"public class X {\n" + 
5786
				"	public class MX {\n" +
5787
				"		public <T> MX(T t){\n" + 
5788
				"			System.out.println(t);\n" + 
5789
				"		}\n" + 
5790
				"	}\n" + 
5791
				"	public static void main(String[] args) {\n" + 
5792
				"		new X().new <String>MX(\"SUCCESS\");\n" + 
5793
				"	}\n" + 
5794
				"}\n", 
5795
			},
5796
			"SUCCESS");
5797
	}		
5798
	// parameterized qualified allocation - wrong arity
5799
	public void test0196() {
5800
		this.runNegativeTest(
5801
			new String[] {
5802
				"X.java",
5803
				"public class X {\n" + 
5804
				"	public class MX {\n" +
5805
				"		public <T> MX(T t){\n" + 
5806
				"			System.out.println(t);\n" + 
5807
				"		}\n" + 
5808
				"	}\n" + 
5809
				"	public static void main(String[] args) {\n" + 
5810
				"		new X().new <String,String>MX(\"FAILED\");\n" + 
5811
				"	}\n" + 
5812
				"}\n", 
5813
			},
5814
			"----------\n" + 
5815
			"1. ERROR in X.java (at line 8)\n" + 
5816
			"	new X().new <String,String>MX(\"FAILED\");\n" + 
5817
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5818
			"Incorrect number of type arguments for generic constructor <T>MX(T) of type X.MX; it cannot be parameterized with arguments <String, String>\n" + 
5819
			"----------\n");
5820
	}			
5821
	// parameterized qualified allocation - non generic target constructor
5822
	// **
5823
	public void test0197() {
5824
		this.runNegativeTest(
5825
			new String[] {
5826
				"X.java",
5827
				"public class X {\n" + 
5828
				"	public class MX {\n" +
5829
				"		public MX(String t){\n" + 
5830
				"			System.out.println(t);\n" + 
5831
				"		}\n" + 
5832
				"	}\n" + 
5833
				"	public static void main(String[] args) {\n" + 
5834
				"		new X().new <String>MX(\"FAILED\");\n" + 
5835
				"	}\n" + 
5836
				"}\n", 
5837
			},
5838
			"----------\n" + 
5839
			"1. ERROR in X.java (at line 8)\n" + 
5840
			"	new X().new <String>MX(\"FAILED\");\n" + 
5841
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5842
			"The constructor MX(String) of type X.MX is not generic; it cannot be parameterized with arguments <String>\n" + 
5843
			"----------\n");
5844
	}			
5845
	// parameterized qualified allocation - argument type mismatch
5846
	public void test0198() {
5847
		this.runNegativeTest(
5848
			new String[] {
5849
				"X.java",
5850
				"public class X {\n" + 
5851
				"	public class MX {\n" +
5852
				"		public <T>MX(T t){\n" + 
5853
				"			System.out.println(t);\n" + 
5854
				"		}\n" + 
5855
				"	}\n" + 
5856
				"	public static void main(String[] args) {\n" + 
5857
				"		new X().new <String>MX(new X());\n" + 
5858
				"	}\n" + 
5859
				"}\n", 
5860
			},
5861
			"----------\n" + 
5862
			"1. ERROR in X.java (at line 8)\n" + 
5863
			"	new X().new <String>MX(new X());\n" + 
5864
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
5865
			"The parameterized constructor <String>MX(String) of type X.MX is not applicable for the arguments (X)\n" + 
5866
			"----------\n");
5867
	}			
5868
	// parameterized explicit constructor call
5869
	public void test0199() {
5870
		this.runConformTest(
5871
			new String[] {
5872
				"X.java",
5873
				"public class X {\n" + 
5874
				"	public <T> X(T t){\n" + 
5875
				"		System.out.println(t);\n" + 
5876
				"	}\n" + 
5877
				"	public static void main(String[] args) {\n" + 
5878
				"		class Local extends X {\n" + 
5879
				"			Local() {\n" +
5880
				"				<String>super(\"SUCCESS\");\n" + 
5881
				"			}\n" + 
5882
				"		};\n" + 
5883
				"		new Local();\n" +				
5884
				"	}\n" + 
5885
				"}\n", 
5886
			},
5887
			"SUCCESS");
5888
	}		
5889
	// parameterized explicit constructor call - wrong arity
5890
	public void test0200() {
5891
		this.runNegativeTest(
5892
			new String[] {
5893
				"X.java",
5894
				"public class X {\n" + 
5895
				"	public <T> X(T t){\n" + 
5896
				"		System.out.println(t);\n" + 
5897
				"	}\n" + 
5898
				"	public static void main(String[] args) {\n" + 
5899
				"		class Local extends X {\n" + 
5900
				"			Local() {\n" +
5901
				"				<String,String>super(\"FAILED\");\n" + 
5902
				"			}\n" + 
5903
				"		};\n" + 
5904
				"		new Local();\n" +				
5905
				"	}\n" + 
5906
				"}\n", 
5907
			},
5908
			"----------\n" + 
5909
			"1. ERROR in X.java (at line 8)\n" + 
5910
			"	<String,String>super(\"FAILED\");\n" + 
5911
			"	               ^^^^^^^^^^^^^^^^\n" + 
5912
			"Incorrect number of type arguments for generic constructor <T>X(T) of type X; it cannot be parameterized with arguments <String, String>\n" + 
5913
			"----------\n");
5914
	}			
5915
	// parameterized explicit constructor call - non generic target constructor
5916
	// **
5917
	public void test0201() {
5918
		this.runNegativeTest(
5919
			new String[] {
5920
				"X.java",
5921
				"public class X {\n" + 
5922
				"	public X(String t){\n" + 
5923
				"		System.out.println(t);\n" + 
5924
				"	}\n" + 
5925
				"	public static void main(String[] args) {\n" + 
5926
				"		class Local extends X {\n" + 
5927
				"			Local() {\n" +
5928
				"				<String>super(\"FAILED\");\n" + 
5929
				"			}\n" + 
5930
				"		};\n" + 
5931
				"		new Local();\n" +				
5932
				"	}\n" + 
5933
				"}\n", 
5934
			},
5935
			"----------\n" + 
5936
			"1. ERROR in X.java (at line 8)\n" + 
5937
			"	<String>super(\"FAILED\");\n" + 
5938
			"	        ^^^^^^^^^^^^^^^^\n" + 
5939
			"The constructor X(String) of type X is not generic; it cannot be parameterized with arguments <String>\n" + 
5940
			"----------\n");
5941
	}			
5942
	// parameterized explicit constructor call - argument type mismatch
5943
	public void test0202() {
5944
		this.runNegativeTest(
5945
			new String[] {
5946
				"X.java",
5947
				"public class X {\n" + 
5948
				"	public <T> X(T t){\n" + 
5949
				"		System.out.println(t);\n" + 
5950
				"	}\n" + 
5951
				"	public static void main(String[] args) {\n" + 
5952
				"		class Local extends X {\n" + 
5953
				"			Local() {\n" +
5954
				"				<String>super(new X(null));\n" + 
5955
				"			}\n" + 
5956
				"		};\n" + 
5957
				"		new Local();\n" +				
5958
				"	}\n" + 
5959
				"}\n", 			},
5960
			"----------\n" + 
5961
			"1. ERROR in X.java (at line 8)\n" + 
5962
			"	<String>super(new X(null));\n" + 
5963
			"	        ^^^^^^^^^^^^^^^^^^^\n" + 
5964
			"The parameterized constructor <String>X(String) of type X is not applicable for the arguments (X)\n" + 
5965
			"----------\n");
5966
	}			
5967
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=62822 - supertypes partially resolved during bound check
5968
	public void test0203() {
5969
		this.runConformTest(
5970
			new String[] {
5971
				"X.java",
5972
				"public class X {\n" + 
5973
				"	public static void main(String[] args) {\n" + 
5974
				"		demo.AD ad;\n" +
5975
				"		System.out.println(\"SUCCESS\");\n" + 
5976
				"	}\n" + 
5977
				"}\n", 			
5978
				"demo/AD.java",
5979
				"package demo;\n" +
5980
				"public interface AD extends LIST<ADXP> {}\n",
5981
				"demo/ADXP.java",
5982
				"package demo;\n" +
5983
				"public interface ADXP extends BIN {}\n",
5984
				"demo/ANY.java",
5985
				"package demo;\n" +
5986
				"public interface ANY {}\n",
5987
				"demo/BL.java",
5988
				"package demo;\n" +
5989
				"public interface BL extends ANY {}\n",
5990
				"demo/LIST.java",
5991
				"package demo;\n" +
5992
				"public interface LIST<T extends ANY> extends ANY {}\n",
5993
				"demo/BIN.java",
5994
				"package demo;\n" +
5995
				"public interface BIN extends LIST<BL> {}\n",
5996
			},
5997
			"SUCCESS");
5998
	}
5999
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=62806
6000
	public void test0204() {
6001
		this.runConformTest(
6002
			new String[] {
6003
				"Function.java",
6004
				"public abstract class Function<Y,X> {\n" + 
6005
				"    public abstract Y eval(X x);\n" + 
6006
				"\n" + 
6007
				"}\n",
6008
				"FunctionMappedComparator.java",
6009
				"import java.util.*;\n" + 
6010
				"public class FunctionMappedComparator<Y,X> implements Comparator<X> {\n" + 
6011
				"	/*\n" + 
6012
				"	 * \'Function\' is highlighted as an error here - the message is:\n" + 
6013
				"	 * The type Function is not generic; it cannot be parameterized with arguments <Y, X>\n" + 
6014
				"	 */\n" + 
6015
				"    protected Function<Y,X> function;\n" + 
6016
				"    protected Comparator<Y> comparator;\n" + 
6017
				"    public FunctionMappedComparator(Function<Y,X> function,Comparator<Y> comparator ) {\n" + 
6018
				"        this.function=function;\n" + 
6019
				"        this.comparator=comparator;\n" + 
6020
				"    }\n" + 
6021
				"\n" + 
6022
				"    public int compare(X x1, X x2) {\n" + 
6023
				"        return comparator.compare(function.eval(x1),function.eval(x2));\n" + 
6024
				"    }\n" + 
6025
				"}\n", 			
6026
			},
6027
			"");
6028
	}
6029
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=63555 - reference to static type parameter allowed inside type itself
6030
	public void test0205() {
6031
		this.runConformTest(
6032
			new String[] {
6033
				"Alpha.java",
6034
				"public class Alpha {\n" + 
6035
				"	static class Beta<T> {\n" + 
6036
				"		T obj;\n" + 
6037
				"	}\n" + 
6038
				"}\n", 			
6039
			},
6040
			"");
6041
	}
6042
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=63555 - variation on static method type parameter
6043
	public void test0206() {
6044
		this.runConformTest(
6045
			new String[] {
6046
				"Alpha.java",
6047
				"public class Alpha {\n" + 
6048
				"	static <T> void Beta(T t) {\n" + 
6049
				"	}\n" + 
6050
				"}\n", 			
6051
			},
6052
			"");
6053
	}			
6054
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=63590 - disallow parameterized type in catch/throws clause
6055
	public void test0207() {
6056
		this.runNegativeTest(
6057
			new String[] {
6058
				"Alpha.java",
6059
				"public class Alpha<T> extends RuntimeException {\n" + 
6060
				"	public static void main(String[] args) {\n" + 
6061
				"		new Object() {\n" + 
6062
				"			public void m() throws Alpha<String> {\n" + 
6063
				"				System.out.println(\"SUCCESS\");\n" + 
6064
				"			}\n" + 
6065
				"		}.m();\n" + 
6066
				"	}\n" + 
6067
				"}\n", 			
6068
			},
6069
			"----------\n" + 
6070
			"1. WARNING in Alpha.java (at line 1)\n" + 
6071
			"	public class Alpha<T> extends RuntimeException {\n" + 
6072
			"	             ^^^^^\n" + 
6073
			"The serializable class Alpha does not declare a static final serialVersionUID field of type long\n" + 
6074
			"----------\n" + 
6075
			"2. ERROR in Alpha.java (at line 1)\n" + 
6076
			"	public class Alpha<T> extends RuntimeException {\n" + 
6077
			"	                              ^^^^^^^^^^^^^^^^\n" + 
6078
			"The generic class Alpha<T> may not subclass java.lang.Throwable\n" + 
6079
			"----------\n" + 
6080
			"3. ERROR in Alpha.java (at line 4)\n" + 
6081
			"	public void m() throws Alpha<String> {\n" + 
6082
			"	                       ^^^^^\n" + 
6083
			"Cannot use the parameterized type Alpha<String> either in catch block or throws clause\n" + 
6084
			"----------\n");
6085
	}			
6086
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=63590 - disallow parameterized type in catch/throws clause
6087
	public void test0208() {
6088
		this.runNegativeTest(
6089
			new String[] {
6090
				"X.java",
6091
				"public class X<T> extends RuntimeException {\n" + 
6092
				"	public static void main(String[] args) {\n" + 
6093
				"		try {\n" + 
6094
				"			throw new X<String>();\n" + 
6095
				"		} catch(X<String> e) {\n" + 
6096
				"			System.out.println(\"X<String>\");\n" + 
6097
				"		} catch(X<X<String>> e) {\n" + 
6098
				"			System.out.println(\"X<X<String>>\");\n" + 
6099
				"		} catch(RuntimeException e) {\n" + 
6100
				"			System.out.println(\"RuntimeException\");\n" + 
6101
				"		}\n" + 
6102
				"	}\n" + 
6103
				"}\n", 			
6104
			},
6105
			"----------\n" + 
6106
			"1. WARNING in X.java (at line 1)\n" + 
6107
			"	public class X<T> extends RuntimeException {\n" + 
6108
			"	             ^\n" + 
6109
			"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
6110
			"----------\n" + 
6111
			"2. ERROR in X.java (at line 1)\n" + 
6112
			"	public class X<T> extends RuntimeException {\n" + 
6113
			"	                          ^^^^^^^^^^^^^^^^\n" + 
6114
			"The generic class X<T> may not subclass java.lang.Throwable\n" + 
6115
			"----------\n" + 
6116
			"3. ERROR in X.java (at line 5)\n" + 
6117
			"	} catch(X<String> e) {\n" + 
6118
			"	                  ^\n" + 
6119
			"Cannot use the parameterized type X<String> either in catch block or throws clause\n" + 
6120
			"----------\n" + 
6121
			"4. ERROR in X.java (at line 7)\n" + 
6122
			"	} catch(X<X<String>> e) {\n" + 
6123
			"	                     ^\n" + 
6124
			"Cannot use the parameterized type X<X<String>> either in catch block or throws clause\n" + 
6125
			"----------\n");
6126
	}
6127
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=63556 - should resolve all occurrences of A to type variable
6128
	public void test0209() {
6129
		this.runConformTest(
6130
			new String[] {
6131
				"X.java",
6132
				"public class X<A,B,C extends java.util.List<A>> {}\n" + 
6133
				"class X2<A,C extends java.util.List<A>, B> {}\n" + 
6134
				"class X3<B, A,C extends java.util.List<A>> {}\n", 			
6135
			},
6136
			"");
6137
	}	
6138
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=68006 - Invalid modifier after parse
6139
	public void test0210() {
6140
		this.runNegativeTest(
6141
			new String[] {
6142
				"X.java",
6143
				"public class X {\n" + 
6144
				"	void foo(Map<? super Object, ? extends String> m){\n" + 
6145
				"	}\n" + 
6146
				"}\n", 			
6147
			},
6148
			"----------\n" + 
6149
			"1. ERROR in X.java (at line 2)\n" + 
6150
			"	void foo(Map<? super Object, ? extends String> m){\n" + 
6151
			"	         ^^^\n" + 
6152
			"Map cannot be resolved to a type\n" + 
6153
			"----------\n");
6154
	}
6155
	// test compilation against binaries
6156
	public void test0211() {
6157
		this.runConformTest(
6158
			new String[] {
6159
				"p/Top.java",
6160
				"package p;\n" +
6161
				"public interface Top<T> {}\n",
6162
			},
6163
			"");
6164
6165
		this.runConformTest(
6166
			new String[] {
6167
				"p/Super.java",
6168
				"package p;\n" +
6169
				"public class Super<T> implements Top<T>{\n" +
6170
				"    public static void main(String [] args) {\n" + 
6171
				"        System.out.println(\"SUCCESS\");\n" + 
6172
				"    }\n" + 
6173
				"}\n",
6174
			},
6175
			"SUCCESS",
6176
			null,
6177
			false, // do not flush output
6178
			null);		
6179
	}			
6180
	// check type variable equivalence
6181
	public void test0212() {
6182
		this.runConformTest(
6183
			new String[] {
6184
				"X.java",
6185
				"import java.util.*;\n" + 
6186
				"\n" + 
6187
				"public class X<T>{\n" + 
6188
				"    public static void main(String [] args) {\n" + 
6189
				"        System.out.println(\"SUCCESS\");\n" + 
6190
				"    }\n" + 
6191
				"	X<T> _recurse; \n" + 
6192
				"	public List<T> toList(){\n" + 
6193
				"		List<T> result = new ArrayList<T>();\n" + 
6194
				"		result.addAll(_recurse.toList()); // should be applicable\n" + 
6195
				"		return result;\n" + 
6196
				"	}\n" + 
6197
				"}\n"
6198
			},
6199
			"SUCCESS");
6200
	}
6201
	public void test0213() {
6202
		this.runConformTest(
6203
			new String[] {
6204
				"X.java",
6205
				"public class X<R,T extends Comparable<T>>{\n" + 
6206
				"	T test;\n" + 
6207
				"	public Comparable<? extends T> getThis(){\n" + 
6208
				"		return test;\n" + 
6209
				"	}\n" + 
6210
				"    public static void main(String [] args) {\n" + 
6211
				"        System.out.println(\"SUCCESS\");\n" + 
6212
				"    }\n" + 
6213
				"}\n"
6214
			},
6215
			"SUCCESS");
6216
	}
6217
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=68133 - verify error
6218
	public void test0214() {
6219
		this.runConformTest(
6220
			new String[] {
6221
				"X.java",
6222
				"import java.util.ArrayList;\n" + 
6223
				"public class X {\n" + 
6224
				"    public static void main(String[] args) {\n" + 
6225
				"        ArrayList<Object> l;\n" + 
6226
				"        switch (args.length) {\n" + 
6227
				"        case 1:\n" + 
6228
				"            l = new ArrayList<Object>();\n" + 
6229
				"            System.out.println(l);\n" + 
6230
				"            break;\n" + 
6231
				"        default:\n" + 
6232
				"            System.out.println(\"SUCCESS\");\n" + 
6233
				"            return;\n" + 
6234
				"        }\n" + 
6235
				"    }\n" + 
6236
				"}\n"
6237
			},
6238
			"SUCCESS");
6239
	}	
6240
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=68133 variation
6241
	public void test0215() { 
6242
		this.runConformTest(
6243
			new String[] {
6244
				"X.java",
6245
				"public class X {\n" + 
6246
				"	public static void main(String[] args) {\n" + 
6247
				"		java.util.ArrayList<Object> i;	\n" + 
6248
				"		outer: {\n" + 
6249
				"			if (args == null) {\n" + 
6250
				"				i = null;\n" + 
6251
				"				break outer;\n" + 
6252
				"			}\n" + 
6253
				"			return;\n" + 
6254
				"		}\n" + 
6255
				"		System.out.println(i);	\n" + 
6256
				"		System.out.println(\"SUCCESS\");	\n" + 
6257
				"	}\n" + 
6258
				"}\n",
6259
			},
6260
			"");
6261
			
6262
		String expectedOutput =
6263
			"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
6264
			"  // Stack: 2, Locals: 2\n" + 
6265
			"  public static void main(java.lang.String[] args);\n" + 
6266
			"     0  aload_0 [args]\n" + 
6267
			"     1  ifnonnull 9\n" + 
6268
			"     4  aconst_null\n" + 
6269
			"     5  astore_1 [i]\n" + 
6270
			"     6  goto 10\n" + 
6271
			"     9  return\n" + 
6272
			"    10  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
6273
			"    13  aload_1 [i]\n" + 
6274
			"    14  invokevirtual java.io.PrintStream.println(java.lang.Object) : void [22]\n" + 
6275
			"    17  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
6276
			"    20  ldc <String \"SUCCESS\"> [28]\n" + 
6277
			"    22  invokevirtual java.io.PrintStream.println(java.lang.String) : void [30]\n" + 
6278
			"    25  return\n" + 
6279
			"      Line numbers:\n" + 
6280
			"        [pc: 0, line: 5]\n" + 
6281
			"        [pc: 4, line: 6]\n" + 
6282
			"        [pc: 6, line: 7]\n" + 
6283
			"        [pc: 9, line: 9]\n" + 
6284
			"        [pc: 10, line: 11]\n" + 
6285
			"        [pc: 17, line: 12]\n" + 
6286
			"        [pc: 25, line: 13]\n" + 
6287
			"      Local variable table:\n" + 
6288
			"        [pc: 0, pc: 26] local: args index: 0 type: java.lang.String[]\n" + 
6289
			"        [pc: 6, pc: 9] local: i index: 1 type: java.util.ArrayList\n" + 
6290
			"        [pc: 10, pc: 26] local: i index: 1 type: java.util.ArrayList\n" + 
6291
			"      Local variable type table:\n" + 
6292
			"        [pc: 6, pc: 9] local: i index: 1 type: java.util.ArrayList<java.lang.Object>\n" + 
6293
			"        [pc: 10, pc: 26] local: i index: 1 type: java.util.ArrayList<java.lang.Object>\n";
6294
		
6295
		try {
6296
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
6297
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
6298
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
6299
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
6300
			int index = result.indexOf(expectedOutput);
6301
			if (index == -1 || expectedOutput.length() == 0) {
6302
				System.out.println(Util.displayString(result, 3));
6303
			}
6304
			if (index == -1) {
6305
				assertEquals("Wrong contents", expectedOutput, result);
6306
			}
6307
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
6308
			assertTrue(false);
6309
		} catch (IOException e) {
6310
			assertTrue(false);
6311
		}
6312
	}
6313
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=68998 parameterized field constants
6314
	public void test0216() { 
6315
		this.runConformTest(
6316
			new String[] {
6317
				"test/cheetah/NG.java",
6318
				"package test.cheetah;\n" +
6319
				"public class NG extends G {\n" +
6320
				"		public static void main(String[] args) {\n" + 
6321
				"			System.out.println(\"SUCCESS\");	\n" + 
6322
				"		}\n" + 
6323
				"    public boolean test() {\n" +
6324
				"        return o == null;\n" +
6325
				"    }\n" +
6326
				"}\n",
6327
				"test/cheetah/G.java",
6328
				"package test.cheetah;\n" +
6329
				"public class G<E> {\n" +
6330
				"    protected Object o;\n" +
6331
				"}\n",
6332
			},
6333
			"SUCCESS");
6334
	}
6335
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69135 - unnecessary cast operation
6336
	public void test0217() {
6337
		Map customOptions = getCompilerOptions();
6338
		this.runNegativeTest(
6339
			new String[] {
6340
				"X.java",
6341
				"import java.util.ArrayList;\n" + 
6342
				"public class X {\n" + 
6343
				"    public static void main(String [] args) {\n" + 
6344
				"		ArrayList<String> l= new ArrayList<String>();\n" + 
6345
				"		String string = (String) l.get(0);\n" + 
6346
				"    }\n" + 
6347
				"}\n", 
6348
			},
6349
			"----------\n" + 
6350
			"1. WARNING in X.java (at line 5)\n" + 
6351
			"	String string = (String) l.get(0);\n" + 
6352
			"	                ^^^^^^^^^^^^^^^^^\n" + 
6353
			"Unnecessary cast from String to String\n" + 
6354
			"----------\n",
6355
			null,
6356
			true,
6357
			customOptions);
6358
	}
6359
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=64154 visibility issue due to invalid use of parameterized binding
6360
	public void test0218() {
6361
		this.runConformTest(
6362
			new String[] {
6363
				"X.java",
6364
				"public class X<T>{\n" + 
6365
				"	private final T _data;\n" + 
6366
				"	private X(T data){\n" + 
6367
				"		_data = data;\n" + 
6368
				"	}\n" + 
6369
				"	public T getData(){\n" + 
6370
				"		return _data;\n" + 
6371
				"	}\n" + 
6372
				"	public static <E> X<E> create(E data) {\n" + 
6373
				"		return new X<E>(data);\n" + 
6374
				"	}\n" + 
6375
				"	public static void main(String[] args) {\n" + 
6376
				"		create(new Object());\n" + 
6377
				"		System.out.println(\"SUCCESS\");\n" + 
6378
				"	}\n" + 
6379
				"}\n", 
6380
			},
6381
			"SUCCESS");
6382
	}	
6383
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=64154 variation
6384
	public void test0219() {
6385
		this.runConformTest(
6386
			new String[] {
6387
				"X.java",
6388
				"public class X<T>{\n" + 
6389
				"	private final T _data;\n" + 
6390
				"	private X(T data){\n" + 
6391
				"		_data = data;\n" + 
6392
				"	}\n" + 
6393
				"	public T getData(){\n" + 
6394
				"		return _data;\n" + 
6395
				"	}\n" + 
6396
				"	public static <E> E create(E data) {\n" + 
6397
				"		return new X<E>(data)._data;\n" + 
6398
				"	}\n" + 
6399
				"	public static void main(String[] args) {\n" + 
6400
				"		create(new Object());\n" + 
6401
				"		System.out.println(\"SUCCESS\");\n" + 
6402
				"	}\n" + 
6403
				"}\n", 
6404
			},
6405
			"SUCCESS");
6406
	}	
6407
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69141 unsafe wildcard operation tolerates wildcard with lower bounds
6408
	public void test0220() {
6409
		this.runNegativeTest(
6410
			new String[] {
6411
				"X.java",
6412
				"import java.util.ArrayList;\n" + 
6413
				"\n" + 
6414
				"public class X {\n" + 
6415
				"	void foo() {\n" + 
6416
				"		ArrayList<? super Integer> al = new ArrayList<Object>();\n" + 
6417
				"		al.add(new Integer(1)); // (1)\n" + 
6418
				"		Integer i = al.get(0);  // (2)\n" + 
6419
				"	}\n" + 
6420
				"}\n", 
6421
			},
6422
			"----------\n" + 
6423
			"1. ERROR in X.java (at line 7)\n" + 
6424
			"	Integer i = al.get(0);  // (2)\n" + 
6425
			"	            ^^^^^^^^^\n" + 
6426
			"Type mismatch: cannot convert from capture#2-of ? super Integer to Integer\n" + 
6427
			"----------\n");
6428
	}		
6429
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69141 variation
6430
	public void test0221() {
6431
		this.runNegativeTest(
6432
			new String[] {
6433
				"X.java",
6434
				"import java.util.ArrayList;\n" + 
6435
				"\n" + 
6436
				"public class X {\n" + 
6437
				"	void foo() {\n" + 
6438
				"		ArrayList<? extends Integer> al = new ArrayList<Integer>();\n" + 
6439
				"		al.add(new Integer(1)); // (1)\n" + 
6440
				"	}\n" + 
6441
				"}\n", 
6442
			},
6443
			"----------\n" + 
6444
			"1. ERROR in X.java (at line 6)\n" + 
6445
			"	al.add(new Integer(1)); // (1)\n" + 
6446
			"	   ^^^\n" + 
6447
			"The method add(capture#1-of ? extends Integer) in the type ArrayList<capture#1-of ? extends Integer> is not applicable for the arguments (Integer)\n" + 
6448
			"----------\n");
6449
	}
6450
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69141: variation
6451
	public void test0222() {
6452
		this.runNegativeTest(
6453
			new String[] {
6454
				"X.java",
6455
				"public class X {\n" + 
6456
				"	public static void main(String[] args) {\n" + 
6457
				"		XList<? super Integer> lx = new XList<Integer>();\n" + 
6458
				"		lx.slot = new Integer(1);\n" + 
6459
				"		Integer i = lx.slot;\n" +
6460
				"    }    	\n" + 
6461
				"}\n" + 
6462
				"class XList<E> {\n" + 
6463
				"    E slot;\n" + 
6464
				"}\n",
6465
			},
6466
			"----------\n" + 
6467
			"1. ERROR in X.java (at line 5)\n" + 
6468
			"	Integer i = lx.slot;\n" + 
6469
			"	            ^^^^^^^\n" + 
6470
			"Type mismatch: cannot convert from capture#2-of ? super Integer to Integer\n" + 
6471
			"----------\n");
6472
	}	
6473
	
6474
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69251- instantiating wildcards
6475
	public void test0223() {
6476
		Map customOptions = getCompilerOptions();
6477
		this.runNegativeTest(
6478
			new String[] {
6479
				"X.java",
6480
				"import java.util.HashMap;\n" + 
6481
				"import java.util.Map;\n" + 
6482
				"public class X {\n" + 
6483
				"    static final Map<String, Class<? extends Object>> classes \n" + 
6484
				"            = new HashMap<String, Class<? extends Object>>();\n" + 
6485
				"    \n" + 
6486
				"    static final Map<String, Class<? extends Object>> classes2 \n" + 
6487
				"            = new HashMap<String, Class>();\n" + 
6488
				"    \n" + 
6489
				"    class MX<E> {\n" + 
6490
				"    	E get() { return null; }\n" + 
6491
				"    	void foo(E e) {}\n" + 
6492
				"    }\n" + 
6493
				"    \n" + 
6494
				"    void foo() {\n" + 
6495
				"    	MX<Class<? extends Object>> mx1 = new MX<Class<? extends Object>>();\n" + 
6496
				"    	MX<Class> mx2 = new MX<Class>();\n" + 
6497
				"    	mx1.foo(mx2.get());\n" + 
6498
				"    }\n" + 
6499
				"}\n"	, 
6500
			},
6501
			"----------\n" + 
6502
			"1. ERROR in X.java (at line 7)\n" + 
6503
			"	static final Map<String, Class<? extends Object>> classes2 \n" + 
6504
			"	                                                  ^^^^^^^^\n" + 
6505
			"Type mismatch: cannot convert from HashMap<String,Class> to Map<String,Class<? extends Object>>\n" + 
6506
			"----------\n" + 
6507
			"2. WARNING in X.java (at line 8)\n" + 
6508
			"	= new HashMap<String, Class>();\n" + 
6509
			"	                      ^^^^^\n" + 
6510
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
6511
			"----------\n" + 
6512
			"3. WARNING in X.java (at line 17)\n" + 
6513
			"	MX<Class> mx2 = new MX<Class>();\n" + 
6514
			"	   ^^^^^\n" + 
6515
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
6516
			"----------\n" + 
6517
			"4. WARNING in X.java (at line 17)\n" + 
6518
			"	MX<Class> mx2 = new MX<Class>();\n" + 
6519
			"	                       ^^^^^\n" + 
6520
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
6521
			"----------\n" + 
6522
			"5. WARNING in X.java (at line 18)\n" + 
6523
			"	mx1.foo(mx2.get());\n" + 
6524
			"	        ^^^^^^^^^\n" + 
6525
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<? extends Object>\n" + 
6526
			"----------\n",
6527
			null,
6528
			true,
6529
			customOptions);
6530
	}
6531
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=68998 variation
6532
	public void test0224() { 
6533
		this.runNegativeTest(
6534
			new String[] {
6535
				"test/cheetah/NG.java",
6536
				"package test.cheetah;\n" +
6537
				"public class NG extends G {\n" +
6538
				"		public static void main(String[] args) {\n" + 
6539
				"			System.out.println(\"SUCCESS\");	\n" + 
6540
				"		}\n" + 
6541
				"    public boolean test() {\n" +
6542
				"        return o == null;\n" +
6543
				"    }\n" +
6544
				"}\n",
6545
				"test/cheetah/G.java",
6546
				"package test.cheetah;\n" +
6547
				"public class G<E> {\n" +
6548
				"    protected final Object o;\n" +
6549
				"}\n",
6550
			},
6551
			"----------\n" + 
6552
			"1. WARNING in test\\cheetah\\NG.java (at line 2)\n" + 
6553
			"	public class NG extends G {\n" + 
6554
			"	                        ^\n" + 
6555
			"G is a raw type. References to generic type G<E> should be parameterized\n" + 
6556
			"----------\n" + 
6557
			"----------\n" + 
6558
			"1. ERROR in test\\cheetah\\G.java (at line 2)\n" + 
6559
			"	public class G<E> {\n" + 
6560
			"	             ^\n" + 
6561
			"The blank final field o may not have been initialized\n" + 
6562
			"----------\n");
6563
	}	
6564
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69353 - prevent using type parameter in catch block
6565
	public void test0225() {
6566
		this.runNegativeTest(
6567
			new String[] {
6568
				"X.java",
6569
				"public class X <T extends Exception> {\n" + 
6570
				"    String foo() throws T {\n" + 
6571
				"        return \"SUCCESS\";\n" + 
6572
				"    }\n" + 
6573
				"    public static void main(String[] args) {\n" + 
6574
				"        new X<EX>().baz(new EX());\n" + 
6575
				"    }\n" + 
6576
				"    void baz(final T t) {\n" + 
6577
				"        new Object() {\n" + 
6578
				"            void print() {\n" + 
6579
				"                try {\n" + 
6580
				"	                System.out.println(foo());\n" + 
6581
				"                } catch (T t) {\n" + 
6582
				"                }\n" + 
6583
				"            }\n" + 
6584
				"        }.print();\n" + 
6585
				"    }\n" + 
6586
				"}\n" + 
6587
				"class EX extends Exception {\n" + 
6588
				"}\n",
6589
			},
6590
			"----------\n" + 
6591
			"1. ERROR in X.java (at line 13)\n" + 
6592
			"	} catch (T t) {\n" + 
6593
			"	           ^\n" + 
6594
			"Cannot use the type parameter T in a catch block\n" + 
6595
			"----------\n" + 
6596
			"2. WARNING in X.java (at line 13)\n" + 
6597
			"	} catch (T t) {\n" + 
6598
			"	           ^\n" + 
6599
			"The parameter t is hiding another local variable defined in an enclosing type scope\n" + 
6600
			"----------\n" + 
6601
			"3. WARNING in X.java (at line 19)\n" + 
6602
			"	class EX extends Exception {\n" + 
6603
			"	      ^^\n" + 
6604
			"The serializable class EX does not declare a static final serialVersionUID field of type long\n" + 
6605
			"----------\n");
6606
	}
6607
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69170 - invalid generic array creation
6608
	public void test0226() {
6609
		this.runNegativeTest(
6610
			new String[] {
6611
				"X.java",
6612
				"public class X<T>{\n" + 
6613
				"	 Object x1= new T[0];\n" + 
6614
				"	 Object x2= new X<String>[0];	 \n" + 
6615
				"	 Object x3= new X<T>[0];	 \n" + 
6616
				"	 Object x4= new X[0];	 \n" + 
6617
				"}\n",
6618
			},
6619
			"----------\n" + 
6620
			"1. ERROR in X.java (at line 2)\n" + 
6621
			"	Object x1= new T[0];\n" + 
6622
			"	           ^^^^^^^^\n" + 
6623
			"Cannot create a generic array of T\n" + 
6624
			"----------\n" + 
6625
			"2. ERROR in X.java (at line 3)\n" + 
6626
			"	Object x2= new X<String>[0];	 \n" + 
6627
			"	           ^^^^^^^^^^^^^^^^\n" + 
6628
			"Cannot create a generic array of X<String>\n" + 
6629
			"----------\n" + 
6630
			"3. ERROR in X.java (at line 4)\n" + 
6631
			"	Object x3= new X<T>[0];	 \n" + 
6632
			"	           ^^^^^^^^^^^\n" + 
6633
			"Cannot create a generic array of X<T>\n" + 
6634
			"----------\n");
6635
	}
6636
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69359 - unsafe cast diagnosis
6637
	public void test0227() {
6638
		this.runNegativeTest(
6639
			new String[] {
6640
				"X.java",
6641
				" import java.util.*;\n" + 
6642
				" public class X {\n" + 
6643
				"  List list() { return null; }\n" + 
6644
				"  void m() { List<X> l = (List<X>)list(); } // unsafe cast\n" + 
6645
				"  void m0() { List<X> l = list(); } // unsafe conversion\n" + 
6646
				"  void m1() { for (X a : list()); } // type mismatch\n" + 
6647
				"  void m2() { for (Iterator<X> i = list().iterator(); i.hasNext();); }  // unsafe conversion\n" + 
6648
				"  void m3() { Collection c = null; List l = (List<X>)c; } // unsafe cast\n" + 
6649
				"  void m4() { Collection c = null; List l = (List<?>)c; } // ok\n" + 
6650
				"  void m5() { List c = null; List l = (Collection<X>)c; } // type mismatch\n" + 
6651
				"  void m6() { List c = null; List l = (Collection<?>)c; } // type mismatch\n" + 
6652
				"}\n"	,
6653
			},
6654
			"----------\n" + 
6655
			"1. WARNING in X.java (at line 3)\n" + 
6656
			"	List list() { return null; }\n" + 
6657
			"	^^^^\n" + 
6658
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6659
			"----------\n" + 
6660
			"2. WARNING in X.java (at line 4)\n" + 
6661
			"	void m() { List<X> l = (List<X>)list(); } // unsafe cast\n" + 
6662
			"	                       ^^^^^^^^^^^^^^^\n" + 
6663
			"Type safety: Unchecked cast from List to List<X>\n" + 
6664
			"----------\n" + 
6665
			"3. WARNING in X.java (at line 4)\n" + 
6666
			"	void m() { List<X> l = (List<X>)list(); } // unsafe cast\n" + 
6667
			"	                       ^^^^^^^^^^^^^^^\n" + 
6668
			"Unnecessary cast from List to List<X>\n" + 
6669
			"----------\n" + 
6670
			"4. WARNING in X.java (at line 5)\n" + 
6671
			"	void m0() { List<X> l = list(); } // unsafe conversion\n" + 
6672
			"	                        ^^^^^^\n" + 
6673
			"Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + 
6674
			"----------\n" + 
6675
			"5. ERROR in X.java (at line 6)\n" + 
6676
			"	void m1() { for (X a : list()); } // type mismatch\n" + 
6677
			"	                       ^^^^^^\n" + 
6678
			"Type mismatch: cannot convert from element type Object to X\n" + 
6679
			"----------\n" + 
6680
			"6. WARNING in X.java (at line 7)\n" + 
6681
			"	void m2() { for (Iterator<X> i = list().iterator(); i.hasNext();); }  // unsafe conversion\n" + 
6682
			"	                                 ^^^^^^^^^^^^^^^^^\n" + 
6683
			"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<X>\n" + 
6684
			"----------\n" + 
6685
			"7. WARNING in X.java (at line 8)\n" + 
6686
			"	void m3() { Collection c = null; List l = (List<X>)c; } // unsafe cast\n" + 
6687
			"	            ^^^^^^^^^^\n" + 
6688
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
6689
			"----------\n" + 
6690
			"8. WARNING in X.java (at line 8)\n" + 
6691
			"	void m3() { Collection c = null; List l = (List<X>)c; } // unsafe cast\n" + 
6692
			"	                                 ^^^^\n" + 
6693
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6694
			"----------\n" + 
6695
			"9. WARNING in X.java (at line 8)\n" + 
6696
			"	void m3() { Collection c = null; List l = (List<X>)c; } // unsafe cast\n" + 
6697
			"	                                          ^^^^^^^^^^\n" + 
6698
			"Type safety: Unchecked cast from Collection to List<X>\n" + 
6699
			"----------\n" + 
6700
			"10. WARNING in X.java (at line 9)\n" + 
6701
			"	void m4() { Collection c = null; List l = (List<?>)c; } // ok\n" + 
6702
			"	            ^^^^^^^^^^\n" + 
6703
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
6704
			"----------\n" + 
6705
			"11. WARNING in X.java (at line 9)\n" + 
6706
			"	void m4() { Collection c = null; List l = (List<?>)c; } // ok\n" + 
6707
			"	                                 ^^^^\n" + 
6708
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6709
			"----------\n" + 
6710
			"12. WARNING in X.java (at line 10)\n" + 
6711
			"	void m5() { List c = null; List l = (Collection<X>)c; } // type mismatch\n" + 
6712
			"	            ^^^^\n" + 
6713
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6714
			"----------\n" + 
6715
			"13. WARNING in X.java (at line 10)\n" + 
6716
			"	void m5() { List c = null; List l = (Collection<X>)c; } // type mismatch\n" + 
6717
			"	                           ^^^^\n" + 
6718
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6719
			"----------\n" + 
6720
			"14. WARNING in X.java (at line 10)\n" + 
6721
			"	void m5() { List c = null; List l = (Collection<X>)c; } // type mismatch\n" + 
6722
			"	                                    ^^^^^^^^^^^^^^^^\n" + 
6723
			"Type safety: Unchecked cast from List to Collection<X>\n" + 
6724
			"----------\n" + 
6725
			"15. ERROR in X.java (at line 10)\n" + 
6726
			"	void m5() { List c = null; List l = (Collection<X>)c; } // type mismatch\n" + 
6727
			"	                                    ^^^^^^^^^^^^^^^^\n" + 
6728
			"Type mismatch: cannot convert from Collection<X> to List\n" + 
6729
			"----------\n" + 
6730
			"16. WARNING in X.java (at line 11)\n" + 
6731
			"	void m6() { List c = null; List l = (Collection<?>)c; } // type mismatch\n" + 
6732
			"	            ^^^^\n" + 
6733
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6734
			"----------\n" + 
6735
			"17. WARNING in X.java (at line 11)\n" + 
6736
			"	void m6() { List c = null; List l = (Collection<?>)c; } // type mismatch\n" + 
6737
			"	                           ^^^^\n" + 
6738
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
6739
			"----------\n" + 
6740
			"18. ERROR in X.java (at line 11)\n" + 
6741
			"	void m6() { List c = null; List l = (Collection<?>)c; } // type mismatch\n" + 
6742
			"	                                    ^^^^^^^^^^^^^^^^\n" + 
6743
			"Type mismatch: cannot convert from Collection<capture#2-of ?> to List\n" + 
6744
			"----------\n");
6745
	}	
6746
	// conversion from raw to X<?> is safe (no unsafe warning)
6747
	public void test0228() {
6748
		this.runConformTest(
6749
			new String[] {
6750
				"X.java",
6751
				" import java.util.*;\n" + 
6752
				" public class X {\n" + 
6753
				" 	List<?> list = new ArrayList();\n" + 
6754
				" }\n",
6755
			},
6756
			"");
6757
	}
6758
	// can resolve member through type variable
6759
	public void test0229() {
6760
		this.runConformTest(
6761
			new String[] {
6762
				"X.java",
6763
				" public class X <T extends XC> {\n" + 
6764
				" 	T.MXC f;\n" + 
6765
				" 	public static void main(String[] args) {\n" + 
6766
				"		System.out.println(\"SUCCESS\");\n" + 
6767
				"	}\n" + 
6768
				" }\n" + 
6769
				" class XC {\n" + 
6770
				" 	class MXC {}\n" + 
6771
				" }\n",
6772
			},
6773
			"SUCCESS");
6774
	}
6775
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69375 - equivalence of wildcards
6776
	public void test0230() {
6777
		this.runNegativeTest(
6778
			new String[] {
6779
				"X.java",
6780
				"import java.util.List;\n" + 
6781
				"\n" + 
6782
				"public class X {\n" + 
6783
				"	void foo() {\n" + 
6784
				"		List<? extends Integer> li= null;\n" + 
6785
				"		List<? extends Number> ln= null;\n" + 
6786
				"		ln = li;\n" + 
6787
				"		li= ln;\n" + 
6788
				"	}\n" + 
6789
				"}\n",
6790
			},
6791
			"----------\n" + 
6792
			"1. ERROR in X.java (at line 8)\n" + 
6793
			"	li= ln;\n" + 
6794
			"	    ^^\n" + 
6795
			"Type mismatch: cannot convert from List<capture#4-of ? extends Number> to List<? extends Integer>\n" + 
6796
			"----------\n");
6797
	}
6798
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69170 - variation
6799
	public void test0231() {
6800
		this.runNegativeTest(
6801
			new String[] {
6802
				"X.java",
6803
				"public class X<T>{\n" + 
6804
				"	 Object x1= new X<?>[0];	 \n" + 
6805
				"	 Object x2= new X<? super String>[0];	 \n" + 
6806
				"	 Object x3= new X<? extends Thread>[0];	 \n" + 
6807
				"}\n",
6808
			},
6809
			"----------\n" + 
6810
			"1. ERROR in X.java (at line 3)\n" + 
6811
			"	Object x2= new X<? super String>[0];	 \n" + 
6812
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
6813
			"Cannot create a generic array of X<? super String>\n" + 
6814
			"----------\n" + 
6815
			"2. ERROR in X.java (at line 4)\n" + 
6816
			"	Object x3= new X<? extends Thread>[0];	 \n" + 
6817
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
6818
			"Cannot create a generic array of X<? extends Thread>\n" + 
6819
			"----------\n");
6820
	}	
6821
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - generic cast should be less strict
6822
	public void test0232() {
6823
		this.runConformTest(
6824
			new String[] {
6825
				"X.java",
6826
				"public class X {\n" + 
6827
				" 	static class Container<T>{\n" + 
6828
				"	    private T val;\n" + 
6829
				"	    public T getVal() {\n" + 
6830
				"	        return val;\n" + 
6831
				"	    }\n" + 
6832
				"	    public void setVal(T val) {\n" + 
6833
				"	        this.val = val;\n" + 
6834
				"	    }\n" + 
6835
				"	}\n" + 
6836
				"	public static void badMethod(Container<?> param){\n" + 
6837
				"	    Container x=param;\n" + 
6838
				"	    x.setVal(\"BAD\");\n" + 
6839
				"	}\n" + 
6840
				"	public static void main(String[] args) {\n" + 
6841
				"	    Container<Integer> cont=new Container<Integer>();\n" + 
6842
				"	    cont.setVal(new Integer(0));\n" + 
6843
				"	    badMethod(cont);\n" + 
6844
				"	    Object someVal = cont.getVal(); // no cast \n" + 
6845
				"	    System.out.println(cont.getVal()); // no cast \n" + 
6846
				"	}\n" + 
6847
				"}\n",
6848
			},
6849
			"BAD");
6850
	}	
6851
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
6852
	public void test0233() {
6853
		this.runConformTest(
6854
			new String[] {
6855
				"X.java",
6856
				"public class X {\n" + 
6857
				" 	static class Container<T>{\n" + 
6858
				"	    private T val;\n" + 
6859
				"	    public T getVal() {\n" + 
6860
				"	        return val;\n" + 
6861
				"	    }\n" + 
6862
				"	    public void setVal(T val) {\n" + 
6863
				"	        this.val = val;\n" + 
6864
				"	    }\n" + 
6865
				"	}\n" + 
6866
				"	public static void badMethod(Container<?> param){\n" + 
6867
				"	    Container x=param;\n" + 
6868
				"	    x.setVal(new Long(0));\n" + 
6869
				"	}\n" + 
6870
				"	public static void main(String[] args) {\n" + 
6871
				"	    Container<Integer> cont=new Container<Integer>();\n" + 
6872
				"	    cont.setVal(new Integer(0));\n" + 
6873
				"	    badMethod(cont);\n" + 
6874
				"	    Number someVal = cont.getVal();// only cast to Number \n" + 
6875
				"	    System.out.println(\"SUCCESS\"); \n" + 
6876
				"	}\n" + 
6877
				"}\n",
6878
			},
6879
			"SUCCESS");
6880
	}
6881
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
6882
	public void test0234() {
6883
		this.runConformTest(
6884
			new String[] {
6885
				"X.java",
6886
				"public class X {\n" + 
6887
				" 	static class Container<T>{\n" + 
6888
				"	    public T val;\n" + 
6889
				"	    public T getVal() {\n" + 
6890
				"	        return val;\n" + 
6891
				"	    }\n" + 
6892
				"	    public void setVal(T val) {\n" + 
6893
				"	        this.val = val;\n" + 
6894
				"	    }\n" + 
6895
				"	}\n" + 
6896
				"	public static void badMethod(Container<?> param){\n" + 
6897
				"	    Container x=param;\n" + 
6898
				"	    x.setVal(\"BAD\");\n" + 
6899
				"	}\n" + 
6900
				"	public static void main(String[] args) {\n" + 
6901
				"	    Container<Integer> cont=new Container<Integer>();\n" + 
6902
				"	    cont.setVal(new Integer(0));\n" + 
6903
				"	    badMethod(cont);\n" + 
6904
				"	    Object someVal = cont.val; // no cast \n" + 
6905
				"	    System.out.println(cont.val); // no cast \n" + 
6906
				"	}\n" + 
6907
				"}\n",
6908
			},
6909
			"BAD");
6910
	}		
6911
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
6912
	public void test0235() {
6913
		this.runConformTest(
6914
			new String[] {
6915
				"X.java",
6916
				"public class X {\n" + 
6917
				" 	static class Container<T>{\n" + 
6918
				"	    public T val;\n" + 
6919
				"	    public T getVal() {\n" + 
6920
				"	        return val;\n" + 
6921
				"	    }\n" + 
6922
				"	    public void setVal(T val) {\n" + 
6923
				"	        this.val = val;\n" + 
6924
				"	    }\n" + 
6925
				"	}\n" + 
6926
				"	public static void badMethod(Container<?> param){\n" + 
6927
				"	    Container x=param;\n" + 
6928
				"	    x.setVal(new Long(0));\n" + 
6929
				"	}\n" + 
6930
				"	public static void main(String[] args) {\n" + 
6931
				"	    Container<Integer> cont=new Container<Integer>();\n" + 
6932
				"	    cont.setVal(new Integer(0));\n" + 
6933
				"	    badMethod(cont);\n" + 
6934
				"	    Number someVal = cont.val;// only cast to Number \n" + 
6935
				"	    System.out.println(\"SUCCESS\"); \n" + 
6936
				"	}\n" + 
6937
				"}\n",
6938
			},
6939
			"SUCCESS");
6940
	}		
6941
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
6942
	public void test0236() {
6943
		this.runConformTest(
6944
			new String[] {
6945
				"X.java",
6946
				"public class X {\n" + 
6947
				" 	static class Container<T>{\n" + 
6948
				"	    public T val;\n" + 
6949
				"	    public T getVal() {\n" + 
6950
				"	        return val;\n" + 
6951
				"	    }\n" + 
6952
				"	    public void setVal(T val) {\n" + 
6953
				"	        this.val = val;\n" + 
6954
				"	    }\n" + 
6955
				"	}\n" + 
6956
				"	public static void badMethod(Container<?> param){\n" + 
6957
				"	    Container x=param;\n" + 
6958
				"	    x.setVal(\"BAD\");\n" + 
6959
				"	}\n" + 
6960
				"	public static void main(String[] args) {\n" + 
6961
				"	    Container<Integer> cont=new Container<Integer>();\n" + 
6962
				"	    cont.setVal(new Integer(0));\n" + 
6963
				"	    badMethod(cont);\n" + 
6964
				"	    Object someVal = (cont).val; // no cast \n" + 
6965
				"	    System.out.println((cont).val); // no cast \n" + 
6966
				"	}\n" + 
6967
				"}\n",
6968
			},
6969
			"BAD");
6970
	}		
6971
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
6972
	public void test0237() {
6973
		this.runConformTest(
6974
			new String[] {
6975
				"X.java",
6976
				"public class X {\n" + 
6977
				" 	static class Container<T>{\n" + 
6978
				"	    public T val;\n" + 
6979
				"	    public T getVal() {\n" + 
6980
				"	        return val;\n" + 
6981
				"	    }\n" + 
6982
				"	    public void setVal(T val) {\n" + 
6983
				"	        this.val = val;\n" + 
6984
				"	    }\n" + 
6985
				"	}\n" + 
6986
				"	public static void badMethod(Container<?> param){\n" + 
6987
				"	    Container x=param;\n" + 
6988
				"	    x.setVal(new Long(0));\n" + 
6989
				"	}\n" + 
6990
				"	public static void main(String[] args) {\n" + 
6991
				"	    Container<Integer> cont=new Container<Integer>();\n" + 
6992
				"	    cont.setVal(new Integer(0));\n" + 
6993
				"	    badMethod(cont);\n" + 
6994
				"	    Number someVal = (cont).val;// only cast to Number \n" + 
6995
				"	    System.out.println(\"SUCCESS\"); \n" + 
6996
				"	}\n" + 
6997
				"}\n",
6998
			},
6999
			"SUCCESS");
7000
	}			
7001
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
7002
	public void test0238() {
7003
		this.runConformTest(
7004
			new String[] {
7005
				"X.java",
7006
				"public class X {\n" + 
7007
				" 	static class Container<T>{\n" + 
7008
				"	    public T val;\n" + 
7009
				"		Container<T> next;\n" +
7010
				"	    public T getVal() {\n" + 
7011
				"	        return val;\n" + 
7012
				"	    }\n" + 
7013
				"	    public void setVal(T val) {\n" + 
7014
				"	        this.val = val;\n" + 
7015
				"	    }\n" + 
7016
				"	}\n" + 
7017
				"	public static void badMethod(Container<?> param){\n" + 
7018
				"	    Container x=param;\n" + 
7019
				"	    x.setVal(\"BAD\");\n" + 
7020
				"	}\n" + 
7021
				"	public static void main(String[] args) {\n" + 
7022
				"	    Container<Integer> cont = new Container<Integer>();\n" + 
7023
				"		cont.next = new Container<Integer>();\n" + 
7024
				"	    cont.next.setVal(new Integer(0));\n" + 
7025
				"	    badMethod(cont.next);\n" + 
7026
				"	    Object someVal = cont.next.val; // no cast \n" + 
7027
				"	    System.out.println(cont.next.val); // no cast \n" + 
7028
				"	}\n" + 
7029
				"}\n",
7030
			},
7031
			"BAD");
7032
	}		
7033
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69542 - variation
7034
	public void test0239() {
7035
		this.runConformTest(
7036
			new String[] {
7037
				"X.java",
7038
				"public class X {\n" + 
7039
				" 	static class Container<T>{\n" + 
7040
				"	    public T val;\n" + 
7041
				"		Container<T> next;\n" +
7042
				"	    public T getVal() {\n" + 
7043
				"	        return val;\n" + 
7044
				"	    }\n" + 
7045
				"	    public void setVal(T val) {\n" + 
7046
				"	        this.val = val;\n" + 
7047
				"	    }\n" + 
7048
				"	}\n" + 
7049
				"	public static void badMethod(Container<?> param){\n" + 
7050
				"	    Container x=param;\n" + 
7051
				"	    x.setVal(new Long(0));\n" + 
7052
				"	}\n" + 
7053
				"	public static void main(String[] args) {\n" + 
7054
				"	    Container<Integer> cont = new Container<Integer>();\n" + 
7055
				"		cont.next = new Container<Integer>();\n" + 
7056
				"	    cont.next.setVal(new Integer(0));\n" + 
7057
				"	    badMethod(cont.next);\n" + 
7058
				"	    Number someVal = cont.next.val;// only cast to Number \n" + 
7059
				"	    System.out.println(\"SUCCESS\"); \n" + 
7060
				"	}\n" + 
7061
				"}\n",
7062
			},
7063
			"SUCCESS");
7064
	}	
7065
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69713 NPE due to length pseudo field
7066
	public void test0240() {
7067
		this.runNegativeTest(
7068
			new String[] {
7069
				"X.java",
7070
			"public class X {\n" + 
7071
			"    String[] elements = null;\n" + 
7072
			"	\n" + 
7073
			"    public X() {\n" + 
7074
			"        String s = \"a, b, c, d\";\n" + 
7075
			"        elements = s.split(\",\");\n" + 
7076
			"        if(elements.length = 3) {\n" + 
7077
			"        }\n" + 
7078
			"    }\n" + 
7079
			"}\n"	
7080
			},
7081
			"----------\n" + 
7082
			"1. ERROR in X.java (at line 7)\n" + 
7083
			"	if(elements.length = 3) {\n" + 
7084
			"	   ^^^^^^^^^^^^^^^^^^^\n" + 
7085
			"Type mismatch: cannot convert from int to boolean\n" + 
7086
			"----------\n");
7087
	}	
7088
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69776 - missing checkcast on cast operation
7089
	public void test0241() {
7090
		this.runConformTest(
7091
			new String[] {
7092
				"X.java",
7093
				"import java.util.HashMap;\n" + 
7094
				"import java.util.Map;\n" + 
7095
				"public class X {\n" + 
7096
				"    private static final Map<String, Class> classes = new HashMap<String, Class>();\n" + 
7097
				"    public static void main(String[] args) throws Exception {\n" + 
7098
				"    	classes.put(\"test\", X.class);\n" + 
7099
				"        final Class<? extends Object> clazz = (Class<? extends Object>) classes.get(\"test\");\n" + 
7100
				"        Object o = clazz.newInstance();\n" + 
7101
				"        System.out.println(\"SUCCESS\");\n" + 
7102
				"    }\n" + 
7103
				"}\n",
7104
			},
7105
			"SUCCESS");
7106
	}		
7107
	// 69776 - variation
7108
	public void test0242() {
7109
		this.runNegativeTest(
7110
			new String[] {
7111
				"X.java",
7112
				"import java.util.HashMap;\n" + 
7113
				"import java.util.Map;\n" + 
7114
				"public class X {\n" + 
7115
				"    @SuppressWarnings(\"unchecked\")\n" +
7116
				"    private static final Map<String, Class> classes = new HashMap<String, Class>();\n" + 
7117
				"    public static void main(String[] args) throws Exception {\n" + 
7118
				"    	classes.put(\"test\", X.class);\n" + 
7119
				"        final Class<? extends Object> clazz = (Class<? extends Object>) classes.get(\"test\");\n" + 
7120
				"        final Class<? extends String> clazz2 = (Class<? extends String>) classes.get(\"test\");\n" + 
7121
				"        final Class<String> clazz3 = (Class<String>) classes.get(\"test\");\n" + 
7122
				"        Object o = clazz.newInstance();\n" + 
7123
				"    }\n" + 
7124
				"}", // =================
7125
			},
7126
			"----------\n" + 
7127
			"1. WARNING in X.java (at line 8)\n" + 
7128
			"	final Class<? extends Object> clazz = (Class<? extends Object>) classes.get(\"test\");\n" + 
7129
			"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7130
			"Type safety: Unchecked cast from Class to Class<? extends Object>\n" + 
7131
			"----------\n" + 
7132
			"2. WARNING in X.java (at line 8)\n" + 
7133
			"	final Class<? extends Object> clazz = (Class<? extends Object>) classes.get(\"test\");\n" + 
7134
			"	                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7135
			"Unnecessary cast from Class to Class<? extends Object>\n" + 
7136
			"----------\n" + 
7137
			"3. WARNING in X.java (at line 9)\n" + 
7138
			"	final Class<? extends String> clazz2 = (Class<? extends String>) classes.get(\"test\");\n" + 
7139
			"	                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7140
			"Type safety: Unchecked cast from Class to Class<? extends String>\n" + 
7141
			"----------\n" + 
7142
			"4. WARNING in X.java (at line 9)\n" + 
7143
			"	final Class<? extends String> clazz2 = (Class<? extends String>) classes.get(\"test\");\n" + 
7144
			"	                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7145
			"Unnecessary cast from Class to Class<? extends String>\n" + 
7146
			"----------\n" + 
7147
			"5. WARNING in X.java (at line 10)\n" + 
7148
			"	final Class<String> clazz3 = (Class<String>) classes.get(\"test\");\n" + 
7149
			"	                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7150
			"Type safety: Unchecked cast from Class to Class<String>\n" + 
7151
			"----------\n" + 
7152
			"6. WARNING in X.java (at line 10)\n" + 
7153
			"	final Class<String> clazz3 = (Class<String>) classes.get(\"test\");\n" + 
7154
			"	                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7155
			"Unnecessary cast from Class to Class<String>\n" + 
7156
			"----------\n");
7157
	}		
7158
	public void test0243() {
7159
		this.runConformTest(
7160
			new String[] {
7161
				"X.java",
7162
				"public class X {\n" +
7163
				"    public X foo() {\n" +
7164
				"        System.out.println(\"Did NOT add bridge method\");\n" +
7165
				"        return this;\n" +
7166
				"    }\n" +
7167
				"    public static void main(String[] args) throws Exception {\n" +
7168
				"        X x = new A();\n" +
7169
				"        x.foo();\n" +
7170
				"        System.out.print(\" + \");\n" +
7171
				"        I i = new A();\n" +
7172
				"        i.foo();\n" +
7173
				"    }\n" +
7174
				"}\n" +
7175
				"interface I {\n" +
7176
				"    public I foo();\n" +
7177
				"}\n" +
7178
				"class A extends X implements I {\n" +
7179
				"    public A foo() {\n" +
7180
				"        System.out.print(\"Added bridge method\");\n" +
7181
				"        return this;\n" +
7182
				"    }\n" +
7183
				"}\n"
7184
			},
7185
			"Added bridge method + Added bridge method");
7186
		this.runNegativeTest(
7187
			new String[] {
7188
				"X.java",
7189
				"public class X {\n" +
7190
				"    public X foo() { return this; }\n" +
7191
				"    public static void main(String[] args) throws Exception {\n" +
7192
				"        System.out.println(\"SUCCESS\");\n" +
7193
				"    }\n" +
7194
				"}\n",
7195
				"SubTypes.java",
7196
				"class A extends X {\n" +
7197
				"    @Override public A foo() { return this; }\n" +
7198
				"}\n" +
7199
				"class B extends X {\n" +
7200
				"    @Override public X foo() { return new X(); }\n" +
7201
				"    @Override public B foo() { return this; }\n" +
7202
				"}\n" +
7203
				"class C extends A {\n" +
7204
				"    @Override public X foo() { return new X(); }\n" +
7205
				"}\n"
7206
			},
7207
			"----------\n" + 
7208
			"1. ERROR in SubTypes.java (at line 5)\n" + 
7209
			"	@Override public X foo() { return new X(); }\n" + 
7210
			"	                   ^^^^^\n" + 
7211
			"Duplicate method foo() in type B\n" + 
7212
			"----------\n" + 
7213
			"2. ERROR in SubTypes.java (at line 6)\n" + 
7214
			"	@Override public B foo() { return this; }\n" + 
7215
			"	                   ^^^^^\n" + 
7216
			"Duplicate method foo() in type B\n" + 
7217
			"----------\n" + 
7218
			"3. ERROR in SubTypes.java (at line 9)\n" + 
7219
			"	@Override public X foo() { return new X(); }\n" + 
7220
			"	                 ^\n" + 
7221
			"The return type is incompatible with A.foo()\n" + 
7222
			"----------\n");
7223
	}
7224
	// generic method of raw type
7225
	public void test0244() {
7226
		this.runNegativeTest(
7227
			new String[] {
7228
				"X.java",
7229
				"public class X <T> { \n" + 
7230
				"	<G> T foo(G g) {\n" + 
7231
				"		return null;\n" + 
7232
				"	}\n" + 
7233
				"	\n" + 
7234
				"	public static void main(String[] args) {\n" + 
7235
				"		X rx = new X();\n" + 
7236
				"		rx.foo(\"hello\");\n" + 
7237
				"	}\n" + 
7238
				"}\n"
7239
			},
7240
			"----------\n" + 
7241
			"1. WARNING in X.java (at line 7)\n" + 
7242
			"	X rx = new X();\n" + 
7243
			"	^\n" + 
7244
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
7245
			"----------\n" + 
7246
			"2. WARNING in X.java (at line 7)\n" + 
7247
			"	X rx = new X();\n" + 
7248
			"	           ^\n" + 
7249
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
7250
			"----------\n" + 
7251
			"3. WARNING in X.java (at line 8)\n" + 
7252
			"	rx.foo(\"hello\");\n" + 
7253
			"	^^^^^^^^^^^^^^^\n" + 
7254
			"Type safety: The method foo(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
7255
			"----------\n");
7256
	}
7257
	// generic method of raw type
7258
	// **
7259
	public void test0245() {
7260
		this.runNegativeTest(
7261
			new String[] {
7262
				"X.java",
7263
				"public class X <T> { \n" + 
7264
				"	<G> T foo(G g) {\n" + 
7265
				"		return null;\n" + 
7266
				"	}\n" + 
7267
				"	\n" + 
7268
				"	public static void main(String[] args) {\n" + 
7269
				"		X rx = new X();\n" + 
7270
				"		rx.<String>foo(\"hello\");\n" + 
7271
				"	}\n" + 
7272
				"}\n"
7273
			},
7274
			"----------\n" + 
7275
			"1. WARNING in X.java (at line 7)\n" + 
7276
			"	X rx = new X();\n" + 
7277
			"	^\n" + 
7278
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
7279
			"----------\n" + 
7280
			"2. WARNING in X.java (at line 7)\n" + 
7281
			"	X rx = new X();\n" + 
7282
			"	           ^\n" + 
7283
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
7284
			"----------\n" + 
7285
			"3. ERROR in X.java (at line 8)\n" + 
7286
			"	rx.<String>foo(\"hello\");\n" + 
7287
			"	           ^^^\n" + 
7288
			"The method foo(Object) of raw type X is no longer generic; it cannot be parameterized with arguments <String>\n" + 
7289
			"----------\n");
7290
	}		
7291
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69320 parameterized type compatibility
7292
	public void test0246() {
7293
		this.runNegativeTest(
7294
			new String[] {
7295
				"X.java",
7296
				"public class X { \n" + 
7297
				"    class MX<E> {\n" + 
7298
				"    }\n" + 
7299
				"    void foo() {\n" + 
7300
				"      MX<Class<? extends Object>> mx2 = new MX<Class>();\n" + 
7301
				"    }\n" + 
7302
				"}\n"
7303
			},
7304
			"----------\n" + 
7305
			"1. ERROR in X.java (at line 5)\n" + 
7306
			"	MX<Class<? extends Object>> mx2 = new MX<Class>();\n" + 
7307
			"	                                  ^^^^^^^^^^^^^^^\n" + 
7308
			"Type mismatch: cannot convert from X.MX<Class> to X.MX<Class<? extends Object>>\n" + 
7309
			"----------\n" + 
7310
			"2. WARNING in X.java (at line 5)\n" + 
7311
			"	MX<Class<? extends Object>> mx2 = new MX<Class>();\n" + 
7312
			"	                                         ^^^^^\n" + 
7313
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7314
			"----------\n");
7315
	}		
7316
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69320 variation
7317
	public void test0247() {
7318
		this.runNegativeTest(
7319
			new String[] {
7320
				"X.java",
7321
				"public class X { \n" + 
7322
				"    void foo() {\n" + 
7323
				"      MX<Class<? extends Object>> mx2 = new MX<Class>(); // wrong\n" + 
7324
				"      MX<Class<? extends Object>> mx3 = new MX<Class<? extends String>>(); // wrong\n" + 
7325
				"      MX<Class<? extends Object>> mx4 = new MX<Class<String>>(); // wrong\n" + 
7326
				"      MX<? extends Class> mx5 = new MX<Class>(); // ok\n" + 
7327
				"      MX<? super Class> mx6 = new MX<Class>(); // ok\n" + 
7328
				"      MX<Class<? extends Class>> mx7 = new MX<Class<Class>>(); // wrong\n" + 
7329
				"      MX<MX<? extends Class>> mx8 = new MX<MX<Class>>(); // wrong\n" + 
7330
				"    }\n" + 
7331
				"}\n" + 
7332
				"\n" + 
7333
				"class MX<E> {\n" + 
7334
				"}\n"
7335
			},
7336
			"----------\n" + 
7337
			"1. ERROR in X.java (at line 3)\n" + 
7338
			"	MX<Class<? extends Object>> mx2 = new MX<Class>(); // wrong\n" + 
7339
			"	                                  ^^^^^^^^^^^^^^^\n" + 
7340
			"Type mismatch: cannot convert from MX<Class> to MX<Class<? extends Object>>\n" + 
7341
			"----------\n" + 
7342
			"2. WARNING in X.java (at line 3)\n" + 
7343
			"	MX<Class<? extends Object>> mx2 = new MX<Class>(); // wrong\n" + 
7344
			"	                                         ^^^^^\n" + 
7345
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7346
			"----------\n" + 
7347
			"3. ERROR in X.java (at line 4)\n" + 
7348
			"	MX<Class<? extends Object>> mx3 = new MX<Class<? extends String>>(); // wrong\n" + 
7349
			"	                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7350
			"Type mismatch: cannot convert from MX<Class<? extends String>> to MX<Class<? extends Object>>\n" + 
7351
			"----------\n" + 
7352
			"4. ERROR in X.java (at line 5)\n" + 
7353
			"	MX<Class<? extends Object>> mx4 = new MX<Class<String>>(); // wrong\n" + 
7354
			"	                                  ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7355
			"Type mismatch: cannot convert from MX<Class<String>> to MX<Class<? extends Object>>\n" + 
7356
			"----------\n" + 
7357
			"5. WARNING in X.java (at line 6)\n" + 
7358
			"	MX<? extends Class> mx5 = new MX<Class>(); // ok\n" + 
7359
			"	             ^^^^^\n" + 
7360
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7361
			"----------\n" + 
7362
			"6. WARNING in X.java (at line 6)\n" + 
7363
			"	MX<? extends Class> mx5 = new MX<Class>(); // ok\n" + 
7364
			"	                                 ^^^^^\n" + 
7365
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7366
			"----------\n" + 
7367
			"7. WARNING in X.java (at line 7)\n" + 
7368
			"	MX<? super Class> mx6 = new MX<Class>(); // ok\n" + 
7369
			"	           ^^^^^\n" + 
7370
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7371
			"----------\n" + 
7372
			"8. WARNING in X.java (at line 7)\n" + 
7373
			"	MX<? super Class> mx6 = new MX<Class>(); // ok\n" + 
7374
			"	                               ^^^^^\n" + 
7375
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7376
			"----------\n" + 
7377
			"9. WARNING in X.java (at line 8)\n" + 
7378
			"	MX<Class<? extends Class>> mx7 = new MX<Class<Class>>(); // wrong\n" + 
7379
			"	                   ^^^^^\n" + 
7380
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7381
			"----------\n" + 
7382
			"10. ERROR in X.java (at line 8)\n" + 
7383
			"	MX<Class<? extends Class>> mx7 = new MX<Class<Class>>(); // wrong\n" + 
7384
			"	                                 ^^^^^^^^^^^^^^^^^^^^^^\n" + 
7385
			"Type mismatch: cannot convert from MX<Class<Class>> to MX<Class<? extends Class>>\n" + 
7386
			"----------\n" + 
7387
			"11. WARNING in X.java (at line 8)\n" + 
7388
			"	MX<Class<? extends Class>> mx7 = new MX<Class<Class>>(); // wrong\n" + 
7389
			"	                                              ^^^^^\n" + 
7390
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7391
			"----------\n" + 
7392
			"12. WARNING in X.java (at line 9)\n" + 
7393
			"	MX<MX<? extends Class>> mx8 = new MX<MX<Class>>(); // wrong\n" + 
7394
			"	                ^^^^^\n" + 
7395
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7396
			"----------\n" + 
7397
			"13. ERROR in X.java (at line 9)\n" + 
7398
			"	MX<MX<? extends Class>> mx8 = new MX<MX<Class>>(); // wrong\n" + 
7399
			"	                              ^^^^^^^^^^^^^^^^^^^\n" + 
7400
			"Type mismatch: cannot convert from MX<MX<Class>> to MX<MX<? extends Class>>\n" + 
7401
			"----------\n" + 
7402
			"14. WARNING in X.java (at line 9)\n" + 
7403
			"	MX<MX<? extends Class>> mx8 = new MX<MX<Class>>(); // wrong\n" + 
7404
			"	                                        ^^^^^\n" + 
7405
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
7406
			"----------\n");
7407
	}			
7408
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70247 check type variable is bound during super type resolution
7409
	public void test0248() {
7410
		this.runNegativeTest(
7411
			new String[] {
7412
				"X.java",
7413
				"import java.util.*;\n" + 
7414
				"public class X<T> extends Vector<? super X<int[]>>{}\n"			},
7415
			"----------\n" + 
7416
			"1. ERROR in X.java (at line 2)\n" + 
7417
			"	public class X<T> extends Vector<? super X<int[]>>{}\n" + 
7418
			"	                          ^^^^^^\n" + 
7419
			"The type X cannot extend or implement Vector<? super X<int[]>>. A supertype may not specify any wildcard\n" + 
7420
			"----------\n");
7421
	}			
7422
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70247 variation
7423
	public void test0249() {
7424
		this.runNegativeTest(
7425
			new String[] {
7426
				"X.java",
7427
				"import java.util.*;\n" + 
7428
				"public class X<T> implements List<? super X<int[]>>{}\n"			
7429
			},
7430
			"----------\n" + 
7431
			"1. ERROR in X.java (at line 2)\n" + 
7432
			"	public class X<T> implements List<? super X<int[]>>{}\n" + 
7433
			"	                             ^^^^\n" + 
7434
			"The type X cannot extend or implement List<? super X<int[]>>. A supertype may not specify any wildcard\n" + 
7435
			"----------\n");
7436
	}			
7437
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70295 Class<? extends Object> is compatible with Class<?>
7438
	public void test0250() {
7439
		this.runConformTest(
7440
			new String[] {
7441
				"X.java",
7442
				"public class X {\n" + 
7443
				"    void test(Object o) {\n" + 
7444
				"        X.class.isAssignableFrom(o.getClass());\n" + 
7445
				"    }\n" + 
7446
				"}\n"
7447
			},
7448
			"");
7449
	}			
7450
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69800 '? extends Object' is not compatible with A
7451
	public void test0251() {
7452
		this.runNegativeTest(
7453
			new String[] {
7454
				"X.java",
7455
				"public class X { \n" + 
7456
				"    static class A {\n" + 
7457
				"    }\n" + 
7458
				"    A test() throws Exception {\n" + 
7459
				"        Class<? extends Object> clazz = null;\n" + 
7460
				"        return clazz.newInstance(); // ? extends Object\n" + 
7461
				"    }\n" + 
7462
				"}\n"	
7463
			},
7464
			"----------\n" + 
7465
			"1. ERROR in X.java (at line 6)\n" + 
7466
			"	return clazz.newInstance(); // ? extends Object\n" + 
7467
			"	       ^^^^^^^^^^^^^^^^^^^\n" + 
7468
			"Type mismatch: cannot convert from capture#1-of ? extends Object to X.A\n" + 
7469
			"----------\n");
7470
	}
7471
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69799 NPE in foreach checkcast
7472
	// effective result may change depending upon 
7473
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=148241
7474
	// **
7475
	public void test0252() {
7476
		this.runNegativeTest(
7477
			new String[] {
7478
				"X.java",
7479
				"import java.util.*;\n" + 
7480
				"public class X {\n" + 
7481
				"	public static void main(String[] args) {\n" + 
7482
				"		Set<X> channel = channels.get(0);\n" + 
7483
				"	    for (Iterator<X> iter = channel.iterator(); iter.hasNext();) {\n" + 
7484
				"	        Set<X> element;\n" + 
7485
				"	        element = (Set<X>) iter.next();\n" + 
7486
				"		}\n" + 
7487
				"	}\n" + 
7488
				"}\n"
7489
			},
7490
			"----------\n" + 
7491
			"1. ERROR in X.java (at line 4)\n" + 
7492
			"	Set<X> channel = channels.get(0);\n" + 
7493
			"	                 ^^^^^^^^\n" + 
7494
			"channels cannot be resolved\n" + 
7495
			"----------\n" + 
7496
			"2. WARNING in X.java (at line 7)\n" + 
7497
			"	element = (Set<X>) iter.next();\n" + 
7498
			"	          ^^^^^^^^^^^^^^^^^^^^\n" + 
7499
			"Type safety: Unchecked cast from X to Set<X>\n" + 
7500
			"----------\n");
7501
	}			
7502
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70243 unsafe cast when wildcards
7503
	public void test0253() {
7504
		this.runNegativeTest(
7505
			new String[] {
7506
				"X.java",
7507
				"import java.util.*;\n" + 
7508
				"public class X {\n" + 
7509
				"    public static void main(String[] args) {\n" + 
7510
				"        List<Integer> li= new ArrayList<Integer>();\n" + 
7511
				"        List<? extends Number> ls= li;       \n" + 
7512
				"        List<Number> x2= (List<Number>)ls;//unsafe\n" + 
7513
				"        x2.add(new Float(1.0));\n" + 
7514
				"        \n" + 
7515
				"        Integer i= li.get(0);//ClassCastException!\n" + 
7516
				"        \n" + 
7517
				"        List<Number> ls2 = (List<? extends Number>)ls;\n" + 
7518
				"        List<? extends Number> ls3 = (List<? extends Number>) li;\n" + 
7519
				"    }\n" + 
7520
				"}\n"
7521
			},
7522
			"----------\n" + 
7523
			"1. WARNING in X.java (at line 6)\n" + 
7524
			"	List<Number> x2= (List<Number>)ls;//unsafe\n" + 
7525
			"	                 ^^^^^^^^^^^^^^^^\n" + 
7526
			"Type safety: Unchecked cast from List<capture#1-of ? extends Number> to List<Number>\n" + 
7527
			"----------\n" + 
7528
			"2. ERROR in X.java (at line 11)\n" + 
7529
			"	List<Number> ls2 = (List<? extends Number>)ls;\n" + 
7530
			"	                   ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7531
			"Type mismatch: cannot convert from List<capture#3-of ? extends Number> to List<Number>\n" + 
7532
			"----------\n" + 
7533
			"3. WARNING in X.java (at line 12)\n" + 
7534
			"	List<? extends Number> ls3 = (List<? extends Number>) li;\n" + 
7535
			"	                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7536
			"Unnecessary cast from List<Integer> to List<? extends Number>\n" + 
7537
			"----------\n");
7538
	}
7539
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70053 missing checkcast in string concatenation
7540
	public void test0254() {
7541
		this.runConformTest(
7542
			new String[] {
7543
				"X.java",
7544
				"import java.util.*;\n" + 
7545
				"public class X {\n" + 
7546
				" public static void main(String[] args) {\n" + 
7547
				"  X x = new X();\n" + 
7548
				"  System.out.print(\"S\" + x.a() + \"U\" + x.b().get(0) + \"C\" + x.a() + \"C\");\n" + 
7549
				"  System.out.println(new StringBuilder(\"E\").append(x.a()).append(\"S\").append(x.b().get(0)).append(\"S\").append(x.a()).append(\"!\"));  \n" + 
7550
				" }\n" + 
7551
				" String a() { return \"\"; }\n" + 
7552
				" List<String> b() { \n" + 
7553
				"  ArrayList<String> als = new ArrayList<String>(1);\n" + 
7554
				"  als.add(a());\n" + 
7555
				"  return als;\n" + 
7556
				" }\n" + 
7557
				"}\n"
7558
			},
7559
			"SUCCESS!");		
7560
	}
7561
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69351 generic type cannot extend Throwable
7562
	public void test0255() {
7563
		this.runNegativeTest(
7564
			new String[] {
7565
				"X.java",
7566
				"public class X<T, U> extends Throwable {\n" + 
7567
				"}\n"
7568
			},
7569
			"----------\n" + 
7570
			"1. WARNING in X.java (at line 1)\n" + 
7571
			"	public class X<T, U> extends Throwable {\n" + 
7572
			"	             ^\n" + 
7573
			"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
7574
			"----------\n" + 
7575
			"2. ERROR in X.java (at line 1)\n" + 
7576
			"	public class X<T, U> extends Throwable {\n" + 
7577
			"	                             ^^^^^^^^^\n" + 
7578
			"The generic class X<T,U> may not subclass java.lang.Throwable\n" + 
7579
			"----------\n");		
7580
	}
7581
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70616 - reference to binary Enum
7582
	public void test0256() {
7583
		this.runNegativeTest(
7584
			new String[] {
7585
				"X.java",
7586
				"public class X {\n" + 
7587
				"	\n" + 
7588
				"	public static void main(String[] args) {\n" + 
7589
				"\n" + 
7590
				"		Enum<X> ex = null;\n" + 
7591
				"		String s = ex.name();\n" + 
7592
				"	}\n" + 
7593
				"}\n"
7594
			},
7595
			"----------\n" + 
7596
			"1. ERROR in X.java (at line 5)\n" + 
7597
			"	Enum<X> ex = null;\n" + 
7598
			"	     ^\n" + 
7599
			"Bound mismatch: The type X is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type Enum<E>\n" + 
7600
			"----------\n");		
7601
	}
7602
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70618 - reference to variable allowed in parameterized super type
7603
	public void test0257() {
7604
		this.runNegativeTest(
7605
			new String[] {
7606
				"X.java",
7607
				"public class X<T> {\n" + 
7608
				"    public abstract class M extends java.util.AbstractList<T> {}\n" + 
7609
				"}\n" +
7610
				"class Y<T> extends T {}\n" + 
7611
				"class Z<T> {\n" + 
7612
				"    class M extends T {}\n" + 
7613
				"}\n"
7614
			},
7615
			"----------\n" + 
7616
			"1. ERROR in X.java (at line 4)\n" + 
7617
			"	class Y<T> extends T {}\n" + 
7618
			"	                   ^\n" + 
7619
			"Cannot refer to the type parameter T as a supertype\n" + 
7620
			"----------\n" + 
7621
			"2. ERROR in X.java (at line 6)\n" + 
7622
			"	class M extends T {}\n" + 
7623
			"	                ^\n" + 
7624
			"Cannot refer to the type parameter T as a supertype\n" + 
7625
			"----------\n");
7626
	}
7627
	public void test0258() {
7628
		this.runConformTest(
7629
			new String[] {
7630
				"X.java",
7631
				"abstract class X<K,V> implements java.util.Map<K,V> {\n" + 
7632
				"    static abstract class M<K,V> implements Entry<K,V> {}\n" + 
7633
				"}\n"
7634
			},
7635
			"");
7636
	}
7637
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70767 - NPE compiling code with explicit constructor invocation
7638
	public void test0259() {
7639
		this.runConformTest(
7640
			new String[] {
7641
				"X.java",
7642
				"public class X<E> {\n" + 
7643
				"	\n" + 
7644
				"	<E> X(E e) {\n" + 
7645
				"		<E> this();\n" + 
7646
				"	}\n" + 
7647
				"	\n" + 
7648
				"	<E> X() {\n" + 
7649
				"	}\n" + 
7650
				"}\n"
7651
			},
7652
			"");
7653
	}
7654
	public void test0260() {
7655
		this.runConformTest(
7656
			new String[] {
7657
				"X.java",
7658
				"public class X <E> {\n" + 
7659
				"	class MX <F> {\n" + 
7660
				"	}\n" + 
7661
				"}\n" + 
7662
				"\n" + 
7663
				"class XC<G> extends X<G> {\n" + 
7664
				"	class MXC<H> extends MX<H> {\n" + 
7665
				"	}\n" + 
7666
				"}\n"
7667
			},
7668
			"");
7669
	}	
7670
	public void test0261() {
7671
		this.runNegativeTest(
7672
			new String[] {
7673
				"X.java",
7674
				"public class X <E> {\n" + 
7675
				"	void foo(){\n" + 
7676
				"		X<Integer> xi = (X<Integer>) new X<String>();\n" + 
7677
				"	}\n" + 
7678
				"}\n"
7679
			},
7680
			"----------\n" + 
7681
			"1. ERROR in X.java (at line 3)\n" + 
7682
			"	X<Integer> xi = (X<Integer>) new X<String>();\n" + 
7683
			"	                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7684
			"Cannot cast from X<String> to X<Integer>\n" + 
7685
			"----------\n");
7686
	}		
7687
	public void test0262() {
7688
		this.runNegativeTest(
7689
			new String[] {
7690
				"X.java",
7691
				"public class X <E,F> {\n" + 
7692
				"	void foo(){\n" + 
7693
				"		X<E,String> xe = (X<E,String>) new X<String,String>();\n" + 
7694
				"	}\n" + 
7695
				"}\n"
7696
			},
7697
			"----------\n" + 
7698
			"1. WARNING in X.java (at line 3)\n" + 
7699
			"	X<E,String> xe = (X<E,String>) new X<String,String>();\n" + 
7700
			"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7701
			"Type safety: Unchecked cast from X<String,String> to X<E,String>\n" + 
7702
			"----------\n");
7703
	}			
7704
	public void test0263() {
7705
		this.runNegativeTest(
7706
			new String[] {
7707
				"X.java",
7708
				"public class X <E,F> {\n" + 
7709
				"	void foo(){\n" + 
7710
				"		XC<E,String> xe = (XC<E,String>) new X<String,String>();\n" + 
7711
				"	}\n" + 
7712
				"}\n" + 
7713
				"class XC<G,H> extends X<G,H> {\n" + 
7714
				"}\n"
7715
			},
7716
			"----------\n" + 
7717
			"1. WARNING in X.java (at line 3)\n" + 
7718
			"	XC<E,String> xe = (XC<E,String>) new X<String,String>();\n" + 
7719
			"	                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7720
			"Type safety: Unchecked cast from X<String,String> to XC<E,String>\n" + 
7721
			"----------\n");
7722
	}
7723
	public void test0264() {
7724
		this.runNegativeTest(
7725
			new String[] {
7726
				"X.java",
7727
				"public class X <E,F> {\n" + 
7728
				"	void foo(){\n" + 
7729
				"		XC<E,String> xe = (XC<E,String>) new X<String,Integer>();\n" + 
7730
				"	}\n" + 
7731
				"}\n" + 
7732
				"class XC<G,H> extends X<G,H> {\n" + 
7733
				"}\n"
7734
			},
7735
			"----------\n" + 
7736
			"1. ERROR in X.java (at line 3)\n" + 
7737
			"	XC<E,String> xe = (XC<E,String>) new X<String,Integer>();\n" + 
7738
			"	                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7739
			"Cannot cast from X<String,Integer> to XC<E,String>\n" + 
7740
			"----------\n");
7741
	}		
7742
	public void test0265() {
7743
		this.runNegativeTest(
7744
			new String[] {
7745
				"X.java",
7746
				"public class X <E> {\n" + 
7747
				"	<U> void foo(){\n" + 
7748
				"			XC<U> xcu = (XC<U>) new X<E>();\n" + 
7749
				"			XC<U> xcu1 = (XC<?>) new X<E>();			\n" + 
7750
				"			XC<?> xcu2 = (XC<? extends X>) new X<E>();						\n" + 
7751
				"	}\n" + 
7752
				"}\n" + 
7753
				"class XC<G> extends X<G> {\n" + 
7754
				"}\n"
7755
			},
7756
			"----------\n" + 
7757
			"1. WARNING in X.java (at line 3)\n" + 
7758
			"	XC<U> xcu = (XC<U>) new X<E>();\n" + 
7759
			"	            ^^^^^^^^^^^^^^^^^^\n" + 
7760
			"Type safety: Unchecked cast from X<E> to XC<U>\n" + 
7761
			"----------\n" + 
7762
			"2. ERROR in X.java (at line 4)\n" + 
7763
			"	XC<U> xcu1 = (XC<?>) new X<E>();			\n" + 
7764
			"	             ^^^^^^^^^^^^^^^^^^\n" + 
7765
			"Type mismatch: cannot convert from XC<capture#1-of ?> to XC<U>\n" + 
7766
			"----------\n" + 
7767
			"3. WARNING in X.java (at line 5)\n" + 
7768
			"	XC<?> xcu2 = (XC<? extends X>) new X<E>();						\n" + 
7769
			"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7770
			"Type safety: Unchecked cast from X<E> to XC<? extends X>\n" + 
7771
			"----------\n" + 
7772
			"4. WARNING in X.java (at line 5)\n" + 
7773
			"	XC<?> xcu2 = (XC<? extends X>) new X<E>();						\n" + 
7774
			"	                           ^\n" + 
7775
			"X is a raw type. References to generic type X<E> should be parameterized\n" + 
7776
			"----------\n");
7777
	}		
7778
	public void test0266() {
7779
		this.runConformTest(
7780
			new String[] {
7781
				"X.java",
7782
				"public class X <E> {\n" + 
7783
				"	void bar() {\n" + 
7784
				"		X<? extends E> xe = new X<E>();\n" + 
7785
				"	}\n" + 
7786
				"}\n"
7787
			},
7788
			"");
7789
	}		
7790
	public void test0267() {
7791
		this.runConformTest(
7792
			new String[] {
7793
				"X.java",
7794
				"public class X <T> {\n" + 
7795
				"	static void foo(X<?> xany) { \n" + 
7796
				"		System.out.println(\"SUCCESS\");\n" + 
7797
				"	}\n" + 
7798
				"	public static void main(String[] args) {\n" + 
7799
				"		foo(new X<Object[]>());\n" + 
7800
				"	}\n" + 
7801
				"}\n"	
7802
			},
7803
			"SUCCESS");
7804
	}		
7805
	public void test0268() {
7806
		this.runNegativeTest(
7807
			new String[] {
7808
				"X.java",
7809
				"import java.util.ArrayList;\n" + 
7810
				"public class X <T> {\n" + 
7811
				"	X[] foo() {\n" + 
7812
				"		ArrayList<X> list = new ArrayList();\n" + 
7813
				"		return list.toArray(new X[list.size()]);\n" + 
7814
				"	}\n" + 
7815
				"	public static void main(String[] args) {\n" + 
7816
				"	}\n" + 
7817
				"}\n"
7818
			},
7819
			"----------\n" + 
7820
			"1. WARNING in X.java (at line 3)\n" + 
7821
			"	X[] foo() {\n" + 
7822
			"	^\n" + 
7823
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
7824
			"----------\n" + 
7825
			"2. WARNING in X.java (at line 4)\n" + 
7826
			"	ArrayList<X> list = new ArrayList();\n" + 
7827
			"	          ^\n" + 
7828
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
7829
			"----------\n" + 
7830
			"3. WARNING in X.java (at line 4)\n" + 
7831
			"	ArrayList<X> list = new ArrayList();\n" + 
7832
			"	                    ^^^^^^^^^^^^^^^\n" + 
7833
			"Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<X>\n" + 
7834
			"----------\n" + 
7835
			"4. WARNING in X.java (at line 4)\n" + 
7836
			"	ArrayList<X> list = new ArrayList();\n" + 
7837
			"	                        ^^^^^^^^^\n" + 
7838
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
7839
			"----------\n");
7840
	}
7841
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70975 - test compilation against binary generic method
7842
	public void test0269() {
7843
		this.runConformTest(
7844
			new String[] {
7845
				"X.java",
7846
				"public class X<T> {\n" + 
7847
				"\n" + 
7848
				"	<U> U[] bar(U[] u)  { \n" +
7849
				"		System.out.println(\"SUCCESS\");\n" + 
7850
				"		return null; }\n" + 
7851
				"\n" + 
7852
				"	static String[] foo() {\n" + 
7853
				"		X<String> xs = new X<String>();\n" + 
7854
				"		return xs.bar(new String[0]);\n" + 
7855
				"	}\n" + 
7856
				"	public static void main(String[] args) {\n" + 
7857
				"		foo();\n" + 
7858
				"	}\n" + 
7859
				"}\n",
7860
			},
7861
			"SUCCESS");
7862
7863
		this.runConformTest(
7864
			new String[] {
7865
				"Y.java",
7866
				"public class Y {\n" +
7867
				"    public static void main(String [] args) {\n" + 
7868
				"		X<String> xs = new X<String>();\n" + 
7869
				"		String[] s = xs.bar(new String[0]);\n" + 
7870
				"    }\n" + 
7871
				"}\n",
7872
			},
7873
			"SUCCESS",
7874
			null,
7875
			false, // do not flush output
7876
			null);		
7877
	}
7878
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=70969 - lub(List<String>, List<Object>) --> List<? extends Object>
7879
	public void test0270() {
7880
		this.runNegativeTest(
7881
			new String[] {
7882
				"X.java",
7883
				"import java.util.ArrayList;\n" + 
7884
				"\n" + 
7885
				"public class X {\n" + 
7886
				"    public void test(boolean param) {\n" + 
7887
				"        ArrayList<?> ls = (param) \n" + 
7888
				"        		? new ArrayList<String>()\n" + 
7889
				"        		: new ArrayList<Object>();\n" + 
7890
				"        		\n" + 
7891
				"        X x = param ? new XY() : new XZ();\n" + 
7892
				"        XY y = (XY) new XZ();\n" + 
7893
				"    }\n" + 
7894
				"}\n" + 
7895
				"class XY extends X {}\n" + 
7896
				"class XZ extends X {}\n"
7897
			},
7898
7899
			"----------\n" + 
7900
			"1. ERROR in X.java (at line 10)\n" + 
7901
			"	XY y = (XY) new XZ();\n" + 
7902
			"	       ^^^^^^^^^^^^^\n" + 
7903
			"Cannot cast from XZ to XY\n" + 
7904
			"----------\n");
7905
	}
7906
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71080 - parameter bound <T extends Enum<T>> should be allowed
7907
	public void test0271() {
7908
		this.runConformTest(
7909
			new String[] {
7910
				"X.java",
7911
				"public class X<T extends Enum<T>> {\n" + 
7912
				"}\n" 
7913
			},
7914
			"");
7915
	}	
7916
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71080 - variation
7917
	public void test0272() {
7918
		this.runConformTest(
7919
			new String[] {
7920
				"X.java",
7921
				"public class X<T extends XY<T>> {\n" + 
7922
				"}\n" + 
7923
				"\n" + 
7924
				"class XY<U extends Cloneable> implements Cloneable {\n" + 
7925
				"}\n"
7926
			},
7927
			"");
7928
	}		
7929
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71080 - variation
7930
	public void test0273() {
7931
		this.runConformTest(
7932
			new String[] {
7933
				"X.java",
7934
				"public class X<T extends XY<T> & Cloneable> {\n" + 
7935
				"}\n" + 
7936
				"\n" + 
7937
				"class XY<U extends Cloneable> {\n" + 
7938
				"}\n"
7939
			},
7940
			"");
7941
	}
7942
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71241
7943
	public void test0274() {
7944
		this.runNegativeTest(
7945
			new String[] {
7946
				"X.java",
7947
				"import java.util.List;\n" +
7948
				"public class X {\n" + 
7949
				"    public List useList(List l) {\n" + 
7950
				"        l.add(\"asdf\");\n" + 
7951
				"        return l;\n" + 
7952
				"    }\n" + 
7953
				"}\n" + 
7954
				"class Y extends X {\n" + 
7955
				"    public List<String> useList(List<String> l) {\n" + 
7956
				"        l.add(\"asdf\");\n" + 
7957
				"        return l;\n" + 
7958
				"    }\n" + 
7959
				"}\n"
7960
			},
7961
			"----------\n" + 
7962
			"1. WARNING in X.java (at line 3)\n" + 
7963
			"	public List useList(List l) {\n" + 
7964
			"	       ^^^^\n" + 
7965
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
7966
			"----------\n" + 
7967
			"2. WARNING in X.java (at line 3)\n" + 
7968
			"	public List useList(List l) {\n" + 
7969
			"	                    ^^^^\n" + 
7970
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
7971
			"----------\n" + 
7972
			"3. WARNING in X.java (at line 4)\n" + 
7973
			"	l.add(\"asdf\");\n" + 
7974
			"	^^^^^^^^^^^^^\n" + 
7975
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
7976
			"----------\n" + 
7977
			"4. ERROR in X.java (at line 9)\n" + 
7978
			"	public List<String> useList(List<String> l) {\n" + 
7979
			"	                    ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
7980
			"Name clash: The method useList(List<String>) of type Y has the same erasure as useList(List) of type X but does not override it\n" + 
7981
			"----------\n");
7982
	}
7983
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71241 - variation
7984
	public void test0275() {
7985
		this.runNegativeTest(
7986
			new String[] {
7987
				"X.java",
7988
				"import java.util.List;\n" +
7989
				"public class X {\n" + 
7990
				"    public List<String> useList(List<String> l) {\n" + 
7991
				"        l.add(\"asdf\");\n" + 
7992
				"        return l;\n" + 
7993
				"    }\n" + 
7994
				"}\n" + 
7995
				"class Y extends X {\n" + 
7996
				"    public List useList(List l) {\n" + 
7997
				"        l.add(\"asdf\");\n" + 
7998
				"        return l;\n" + 
7999
				"    }\n" + 
8000
				"}\n"
8001
			},
8002
			"----------\n" + 
8003
			"1. WARNING in X.java (at line 9)\n" + 
8004
			"	public List useList(List l) {\n" + 
8005
			"	       ^^^^\n" + 
8006
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
8007
			"----------\n" + 
8008
			"2. WARNING in X.java (at line 9)\n" + 
8009
			"	public List useList(List l) {\n" + 
8010
			"	       ^^^^\n" + 
8011
			"Type safety: The return type List for useList(List) from the type Y needs unchecked conversion to conform to List<String> from the type X\n" + 
8012
			"----------\n" + 
8013
			"3. WARNING in X.java (at line 9)\n" + 
8014
			"	public List useList(List l) {\n" + 
8015
			"	            ^^^^^^^^^^^^^^^\n" + 
8016
			"The method useList(List) of type Y should be tagged with @Override since it actually overrides a superclass method\n" + 
8017
			"----------\n" + 
8018
			"4. WARNING in X.java (at line 9)\n" + 
8019
			"	public List useList(List l) {\n" + 
8020
			"	                    ^^^^\n" + 
8021
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
8022
			"----------\n" + 
8023
			"5. WARNING in X.java (at line 10)\n" + 
8024
			"	l.add(\"asdf\");\n" + 
8025
			"	^^^^^^^^^^^^^\n" + 
8026
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
8027
			"----------\n");
8028
	}
8029
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71241 - variation
8030
	public void test0276() {
8031
		this.runNegativeTest(
8032
			new String[] {
8033
				"X.java",
8034
				"import java.util.List;\n" +
8035
				"public class X {\n" + 
8036
				"    public void useList(List l) {}\n" + 
8037
				"}\n" + 
8038
				"class Y extends X {\n" + 
8039
				"    public void useList(List<String> l) {\n" + 
8040
				"		super.useList(l);\n" + 
8041
				"	}\n" + 
8042
				"}\n"
8043
			},
8044
			"----------\n" + 
8045
			"1. WARNING in X.java (at line 3)\n" + 
8046
			"	public void useList(List l) {}\n" + 
8047
			"	                    ^^^^\n" + 
8048
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
8049
			"----------\n" + 
8050
			"2. ERROR in X.java (at line 6)\n" + 
8051
			"	public void useList(List<String> l) {\n" + 
8052
			"	            ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
8053
			"Name clash: The method useList(List<String>) of type Y has the same erasure as useList(List) of type X but does not override it\n" + 
8054
			"----------\n");
8055
	}
8056
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71241 - variation
8057
	public void test0277() {
8058
		this.runNegativeTest(
8059
			new String[] {
8060
				"X.java",
8061
				"import java.util.List;\n" +
8062
				"public class X {\n" + 
8063
				"    public void useList(List<String> l) {}\n" + 
8064
				"}\n" + 
8065
				"class Y extends X {\n" + 
8066
				"    public void useList(List l) {\n" + 
8067
				"		super.useList(l);\n" + 
8068
				"	}\n" + 
8069
				"}\n"
8070
			},
8071
			"----------\n" + 
8072
			"1. WARNING in X.java (at line 6)\n" + 
8073
			"	public void useList(List l) {\n" + 
8074
			"	            ^^^^^^^^^^^^^^^\n" + 
8075
			"The method useList(List) of type Y should be tagged with @Override since it actually overrides a superclass method\n" + 
8076
			"----------\n" + 
8077
			"2. WARNING in X.java (at line 6)\n" + 
8078
			"	public void useList(List l) {\n" + 
8079
			"	                    ^^^^\n" + 
8080
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
8081
			"----------\n" + 
8082
			"3. WARNING in X.java (at line 7)\n" + 
8083
			"	super.useList(l);\n" + 
8084
			"	              ^\n" + 
8085
			"Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" + 
8086
			"----------\n");
8087
	}
8088
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71241 - variation
8089
	public void test0278() {
8090
		this.runConformTest(
8091
			new String[] {
8092
				"X.java",
8093
				"public class X<T> implements I {\n" + 
8094
				"    public Class<T> getDeclaringClass() { return null; }\n" + 
8095
				"}\n" +
8096
				"class Y implements I {\n" + 
8097
				"    public Class<?> getDeclaringClass() { return null; }\n" + 
8098
				"}\n" +
8099
				"interface I {\n" + 
8100
				"	public Class getDeclaringClass();\n" + 
8101
				"}\n"
8102
			},
8103
			"");
8104
	}
8105
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=69901
8106
	public void test0279() {
8107
		this.runNegativeTest(
8108
			new String[] {
8109
				"X.java",
8110
				"public class X implements ISomething {\n" + 
8111
				"    public Class getSomething() { return null; }\n" + 
8112
				"}\n" + 
8113
				"class Y {}\n" + 
8114
				"interface ISomething {\n" + 
8115
				"    public Class<? extends Y> getSomething();\n" + 
8116
				"}\n"
8117
			},
8118
			"----------\n" + 
8119
			"1. WARNING in X.java (at line 2)\n" + 
8120
			"	public Class getSomething() { return null; }\n" + 
8121
			"	       ^^^^^\n" + 
8122
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
8123
			"----------\n" + 
8124
			"2. WARNING in X.java (at line 2)\n" + 
8125
			"	public Class getSomething() { return null; }\n" + 
8126
			"	       ^^^^^\n" + 
8127
			"Type safety: The return type Class for getSomething() from the type X needs unchecked conversion to conform to Class<? extends Y> from the type ISomething\n" + 
8128
			"----------\n");
8129
	}
8130
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=62822
8131
	public void test0280() {
8132
		this.runConformTest(
8133
			new String[] {
8134
				"X.java",
8135
				"interface X<T1 extends Y<T2>, T2 extends Z> {}\n" +
8136
				"interface Y<T3 extends Z> {}\n" +
8137
				"interface Z {}\n"
8138
			},
8139
			"");
8140
	}	
8141
	public void test0281() {
8142
		this.runNegativeTest(
8143
			new String[] {
8144
				"X.java",
8145
				"interface X<T1 extends Y<T2>, T2 extends Z> {}\n" +
8146
				"interface Y<T3 extends Comparable> {}\n" +
8147
				"interface Z {}\n"
8148
			},
8149
			"----------\n" + 
8150
			"1. ERROR in X.java (at line 1)\n" + 
8151
			"	interface X<T1 extends Y<T2>, T2 extends Z> {}\n" + 
8152
			"	                         ^^\n" + 
8153
			"Bound mismatch: The type T2 is not a valid substitute for the bounded parameter <T3 extends Comparable> of the type Y<T3>\n" + 
8154
			"----------\n" + 
8155
			"2. WARNING in X.java (at line 2)\n" + 
8156
			"	interface Y<T3 extends Comparable> {}\n" + 
8157
			"	                       ^^^^^^^^^^\n" + 
8158
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
8159
			"----------\n");
8160
	}	
8161
	public void test0282() {
8162
		this.runConformTest(
8163
			new String[] {
8164
				"X.java",
8165
				"public class X extends Y.Member<String> {}\n" +
8166
				"class Y { static class Member<T> {} }\n"
8167
			},
8168
			"");
8169
		this.runConformTest(
8170
			new String[] {
8171
				"p1/X.java",
8172
				"package p1;\n" +
8173
				"public class X extends p1.Y.Member<String> {}\n" +
8174
				"class Y { static class Member<T> {} }\n"
8175
			},
8176
			"");
8177
	}	
8178
	public void test0283() {
8179
		this.runNegativeTest(
8180
			new String[] {
8181
				"X.java",
8182
				"public class X extends Y.Missing<String> {}\n" +
8183
				"class Y { static class Member<T> {} }\n"
8184
			},
8185
			"----------\n" + 
8186
			"1. ERROR in X.java (at line 1)\n" + 
8187
			"	public class X extends Y.Missing<String> {}\n" + 
8188
			"	                       ^^^^^^^^^\n" + 
8189
			"Y.Missing cannot be resolved to a type\n" + 
8190
			"----------\n");
8191
		this.runNegativeTest(
8192
			new String[] {
8193
				"p1/X.java",
8194
				"package p1;\n" +
8195
				"public class X extends Y.Missing<String> {}\n" +
8196
				"class Y { static class Member<T> {} }\n"
8197
			},
8198
			"----------\n" + 
8199
			"1. ERROR in p1\\X.java (at line 2)\n" + 
8200
			"	public class X extends Y.Missing<String> {}\n" + 
8201
			"	                       ^^^^^^^^^\n" + 
8202
			"Y.Missing cannot be resolved to a type\n" + 
8203
			"----------\n");
8204
	}
8205
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=72083
8206
	public void test0284() {
8207
		this.runConformTest(
8208
			new String[] {
8209
				"p1/A.java",
8210
				"package p1;\n" +
8211
				"public class A <T1 extends A<T1, T2>, T2 extends B<T1, T2>> {\n" +
8212
				"    public static void main(String [] args) {\n" + 
8213
				"		System.out.println(\"SUCCESS\");\n" + 
8214
				"    }\n" + 
8215
				"}\n",
8216
				"p1/B.java",
8217
				"package p1;\n" +
8218
				"public class B <T3 extends A<T3, T4>, T4 extends B<T3, T4>> {}\n"
8219
			},
8220
			"SUCCESS");
8221
		this.runConformTest(
8222
			new String[] {
8223
				"p1/A.java",
8224
				"package p1;\n" +
8225
				"public class A <T1 extends B<T1, T2>, T2 extends A<T1, T2>> {\n" +
8226
				"    public static void main(String [] args) {\n" + 
8227
				"		System.out.println(\"SUCCESS\");\n" + 
8228
				"    }\n" + 
8229
				"}\n",
8230
				"p1/B.java",
8231
				"package p1;\n" +
8232
				"public class B <T3 extends B<T3, T4>, T4 extends A<T3, T4>> {}\n"
8233
			},
8234
			"SUCCESS");
8235
	}
8236
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=73530
8237
	public void test0285() {
8238
		this.runConformTest(
8239
			new String[] {
8240
				"X.java",
8241
				"import java.util.Vector;\n" + 
8242
				"public class X {\n" + 
8243
				"  public static void main(String[] args){\n" + 
8244
				"    Vector<Integer[]> v = new Vector<Integer[]>();\n" + 
8245
				"    Integer[] array1 = new Integer[5];\n" + 
8246
				"    array1[0] = new Integer(17);\n" + 
8247
				"    array1[1] = new Integer(42);\n" + 
8248
				"    v.add(array1);\n" + 
8249
				"    Integer twentyfour = v.get(0)[1];  // responsible for the crash\n" + 
8250
				"    System.out.println(twentyfour);\n" + 
8251
				"  }\n" + 
8252
				"}"
8253
			},
8254
			"42");
8255
	}
8256
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=72644
8257
	// TODO (philippe) we need a way to test these 2 methods & find them 'equivalent'... right isEquivalentTo return false
8258
	public void test0286() {
8259
		this.runConformTest(
8260
			new String[] {
8261
				"X.java",
8262
				"public class X {\n" + 
8263
				"	<T extends Object> T foo(Class<T> c) {return null;}\n" + 
8264
				"}\n" + 
8265
				"class Y extends X {\n" + 
8266
				"	<T extends Object> T foo(Class<T> c) {return null;}\n" + 
8267
				"}"
8268
			},
8269
			"");
8270
	}	
8271
	public void test0287() {
8272
		this.runNegativeTest(
8273
			new String[] {
8274
				"X.java",
8275
				"public class X<T> {\n" + 
8276
				"\n" + 
8277
				"	public class A <U> {\n" + 
8278
				"		\n" + 
8279
				"		public class B <V> {\n" + 
8280
				"			\n" + 
8281
				"		}\n" + 
8282
				"	}\n" + 
8283
				"	public static void main(String[] args) {\n" + 
8284
				"		\n" + 
8285
				"		X.A.B<String> bs;\n" + 
8286
				"	}\n" + 
8287
				"}\n" 
8288
			},
8289
			"----------\n" + 
8290
			"1. ERROR in X.java (at line 11)\n" + 
8291
			"	X.A.B<String> bs;\n" + 
8292
			"	^^^^^\n" + 
8293
			"The member type X.A.B<String> must be qualified with a parameterized type, since it is not static\n" + 
8294
			"----------\n");
8295
	}	
8296
	public void test0288() {
8297
		this.runConformTest(
8298
			new String[] {
8299
				"X.java",
8300
				"public class X<T> {\n" + 
8301
				"\n" + 
8302
				"	public static class A <U> {\n" + 
8303
				"		\n" + 
8304
				"		public static class B <V> {\n" + 
8305
				"			\n" + 
8306
				"		}\n" + 
8307
				"	}\n" + 
8308
				"	public static void main(String[] args) {\n" + 
8309
				"		\n" + 
8310
				"		X.A.B<String> bs;\n" + 
8311
				"	}\n" + 
8312
				"}\n" 
8313
			},
8314
			"");
8315
	}		
8316
	public void test0289() {
8317
		this.runNegativeTest(
8318
			new String[] {
8319
				"X.java",
8320
				"public class X<T> {\n" + 
8321
				"\n" + 
8322
				"	public class A <U> {\n" + 
8323
				"		\n" + 
8324
				"		public class B <V> {\n" + 
8325
				"			\n" + 
8326
				"		}\n" + 
8327
				"	}\n" + 
8328
				"	public static void main(String[] args) {\n" + 
8329
				"		\n" + 
8330
				"		X<String>.A.B<String> bs;\n" + 
8331
				"	}\n" + 
8332
				"}\n" 
8333
			},
8334
			"----------\n" + 
8335
			"1. ERROR in X.java (at line 11)\n" + 
8336
			"	X<String>.A.B<String> bs;\n" + 
8337
			"	^^^^^^^^^^^^^\n" + 
8338
			"The member type X<String>.A must be parameterized, since it is qualified with a parameterized type\n" + 
8339
			"----------\n");
8340
	}	
8341
	public void test0290() {
8342
		this.runNegativeTest(
8343
			new String[] {
8344
				"X.java",
8345
				"public class X<T> {\n" + 
8346
				"\n" + 
8347
				"	public static class A <U> {\n" + 
8348
				"		\n" + 
8349
				"		public class B <V> {\n" + 
8350
				"			\n" + 
8351
				"		}\n" + 
8352
				"	}\n" + 
8353
				"	public static void main(String[] args) {\n" + 
8354
				"		\n" + 
8355
				"		X<String>.A.B<String> bs;\n" + 
8356
				"	}\n" + 
8357
				"}\n" 
8358
			},
8359
			"----------\n" + 
8360
			"1. ERROR in X.java (at line 11)\n" + 
8361
			"	X<String>.A.B<String> bs;\n" + 
8362
			"	^^^^^^^^^^^^^\n" + 
8363
			"The member type X<String>.A cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X<String>\n" + 
8364
			"----------\n");
8365
	}		
8366
	// ensure bound check deals with supertype (and their enclosing type)
8367
	public void test0291() {
8368
		this.runNegativeTest(
8369
			new String[] {
8370
				"X.java",
8371
				"public class X <T extends Iterable>{\n" + 
8372
				"	class MX<U extends Iterable> {\n" + 
8373
				"	}\n" + 
8374
				"}\n" + 
8375
				"class SX extends X<Thread>.MX<Object> {\n" + 
8376
				"	SX(X x){\n" + 
8377
				"		x.super();\n" + 
8378
				"	}\n" + 
8379
				"}\n"
8380
			},
8381
			"----------\n" + 
8382
			"1. WARNING in X.java (at line 1)\n" + 
8383
			"	public class X <T extends Iterable>{\n" + 
8384
			"	                          ^^^^^^^^\n" + 
8385
			"Iterable is a raw type. References to generic type Iterable<T> should be parameterized\n" + 
8386
			"----------\n" + 
8387
			"2. WARNING in X.java (at line 2)\n" + 
8388
			"	class MX<U extends Iterable> {\n" + 
8389
			"	                   ^^^^^^^^\n" + 
8390
			"Iterable is a raw type. References to generic type Iterable<T> should be parameterized\n" + 
8391
			"----------\n" + 
8392
			"3. ERROR in X.java (at line 5)\n" + 
8393
			"	class SX extends X<Thread>.MX<Object> {\n" + 
8394
			"	                   ^^^^^^\n" + 
8395
			"Bound mismatch: The type Thread is not a valid substitute for the bounded parameter <T extends Iterable> of the type X<T>\n" + 
8396
			"----------\n" + 
8397
			"4. ERROR in X.java (at line 5)\n" + 
8398
			"	class SX extends X<Thread>.MX<Object> {\n" + 
8399
			"	                              ^^^^^^\n" + 
8400
			"Bound mismatch: The type Object is not a valid substitute for the bounded parameter <U extends Iterable> of the type X<T>.MX<U>\n" + 
8401
			"----------\n" + 
8402
			"5. WARNING in X.java (at line 6)\n" + 
8403
			"	SX(X x){\n" + 
8404
			"	   ^\n" + 
8405
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
8406
			"----------\n");
8407
	}		
8408
	public void test0292() {
8409
		this.runConformTest(
8410
			new String[] {
8411
				"X.java",
8412
				"public class X <T> {\n" + 
8413
				"	class Y {\n" + 
8414
				"		class Z<U> {\n" + 
8415
				"		}\n" + 
8416
				"	}\n" + 
8417
				"    public static void main(String[] args) {\n" + 
8418
				"		X<Object>.Y.Z<Object> zo;\n" + 
8419
				"	}\n" + 
8420
				"}\n"	
8421
			},
8422
			"");
8423
	}
8424
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=73837
8425
	public void test0293() {
8426
		this.runConformTest(
8427
			new String[] {
8428
				"B.java", //---------------------------
8429
				"public class B<X>{\n"+
8430
				"    public B(X str,D dValue){}\n"+
8431
				"    public static void main(String [] args) {\n" + 
8432
				"        System.out.println(\"SUCCESS\");\n" + 
8433
				"    }\n" + 
8434
				"}\n"	,
8435
				"D.java", //---------------------------
8436
				"public class D<Y>{}\n",
8437
			},
8438
			"SUCCESS");
8439
8440
		this.runConformTest(
8441
			new String[] {
8442
				"C.java", //---------------------------
8443
				"public class C<Z,Y> {\n" + 
8444
				"    public B<Z> test(Z zValue,D<Y> yValue){ return new B<Z>(zValue,yValue); }\n" + 
8445
				"    public static void main(String [] args) {\n" + 
8446
				"        System.out.println(\"SUCCESS\");\n" + 
8447
				"    }\n" + 
8448
				"}\n",
8449
			},
8450
			"SUCCESS",
8451
			null,
8452
			false, // do not flush output
8453
			null);		
8454
	}
8455
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=73837 variation
8456
	public void test0294() {
8457
		this.runConformTest(
8458
			new String[] {
8459
				"B.java", //---------------------------
8460
				"public class B<X>{\n"+
8461
				"    public B(X str, B<D> dValue){}\n"+
8462
				"    public static void main(String [] args) {\n" + 
8463
				"        System.out.println(\"SUCCESS\");\n" + 
8464
				"    }\n" + 
8465
				"}\n"	,
8466
				"D.java", //---------------------------
8467
				"public class D<Y>{}\n",
8468
			},
8469
			"SUCCESS");
8470
8471
		this.runNegativeTest(
8472
			new String[] {
8473
				"C.java", //---------------------------
8474
				"public class C<Z,Y> {\n" + 
8475
				"    public B<Z> test(Z zValue,B<D<Y>> yValue){ return new B<Z>(zValue,yValue); }\n" + 
8476
				"}\n",
8477
			},
8478
			"----------\n" + 
8479
			"1. ERROR in C.java (at line 2)\n" + 
8480
			"	public B<Z> test(Z zValue,B<D<Y>> yValue){ return new B<Z>(zValue,yValue); }\n" + 
8481
			"	                                                  ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
8482
			"The constructor B<Z>(Z, B<D<Y>>) is undefined\n" + 
8483
			"----------\n",
8484
			null,
8485
			false, // do not flush output
8486
			null);		
8487
	}
8488
	// non-static method #start() gets its type substituted when accessed through raw type
8489
	public void test0295() {
8490
		this.runNegativeTest(
8491
			new String[] {
8492
				"C.java", //---------------------------
8493
				"public class C<U> {\n" + 
8494
				"\n" + 
8495
				"	void bar() {\n" + 
8496
				"		new B().start().get(new B().start()).get(new B().start());\n" + 
8497
				"	}\n" + 
8498
				"}\n",
8499
				"B.java", //---------------------------
8500
				"public class B<X>{\n" + 
8501
				"	X get(B<X> bx) { return null; }\n" + 
8502
				"	B<B<D>> start() { return null; }\n" + 
8503
				"}",
8504
				"D.java", //---------------------------
8505
				"public class D<Y>{}\n",
8506
			},
8507
			"----------\n" + 
8508
			"1. WARNING in C.java (at line 4)\n" + 
8509
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8510
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
8511
			"Type safety: The method get(B) belongs to the raw type B. References to generic type B<X> should be parameterized\n" + 
8512
			"----------\n" + 
8513
			"2. WARNING in C.java (at line 4)\n" + 
8514
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8515
			"	    ^\n" + 
8516
			"B is a raw type. References to generic type B<X> should be parameterized\n" + 
8517
			"----------\n" + 
8518
			"3. WARNING in C.java (at line 4)\n" + 
8519
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8520
			"	                        ^\n" + 
8521
			"B is a raw type. References to generic type B<X> should be parameterized\n" + 
8522
			"----------\n" + 
8523
			"4. ERROR in C.java (at line 4)\n" + 
8524
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8525
			"	                                     ^^^\n" + 
8526
			"The method get(B) is undefined for the type Object\n" + 
8527
			"----------\n" + 
8528
			"5. WARNING in C.java (at line 4)\n" + 
8529
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8530
			"	                                             ^\n" + 
8531
			"B is a raw type. References to generic type B<X> should be parameterized\n" + 
8532
			"----------\n" + 
8533
			"----------\n" + 
8534
			"1. WARNING in B.java (at line 3)\n" + 
8535
			"	B<B<D>> start() { return null; }\n" + 
8536
			"	    ^\n" + 
8537
			"D is a raw type. References to generic type D<Y> should be parameterized\n" + 
8538
			"----------\n");
8539
	}
8540
	// static method #start() gets its type does not get substituted when accessed through raw type
8541
	public void test0296() {
8542
		this.runNegativeTest(
8543
			new String[] {
8544
				"C.java", //---------------------------
8545
				"public class C<U> {\n" + 
8546
				"\n" + 
8547
				"	void bar() {\n" + 
8548
				"		new B().start().get(new B().start()).get(new B().start());\n" + 
8549
				"	}\n" + 
8550
				"}\n",
8551
				"B.java", //---------------------------
8552
				"public class B<X>{\n" + 
8553
				"	X get(B<X> bx) { return null; }\n" + 
8554
				"	static B<B<D>> start() { return null; }\n" + 
8555
				"}",
8556
				"D.java", //---------------------------
8557
				"public class D<Y>{}\n",
8558
			},
8559
			"----------\n" + 
8560
			"1. WARNING in C.java (at line 4)\n" + 
8561
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8562
			"	^^^^^^^^^^^^^^^\n" + 
8563
			"The static method start() from the type B should be accessed in a static way\n" + 
8564
			"----------\n" + 
8565
			"2. WARNING in C.java (at line 4)\n" + 
8566
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8567
			"	    ^\n" + 
8568
			"B is a raw type. References to generic type B<X> should be parameterized\n" + 
8569
			"----------\n" + 
8570
			"3. WARNING in C.java (at line 4)\n" + 
8571
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8572
			"	                    ^^^^^^^^^^^^^^^\n" + 
8573
			"The static method start() from the type B should be accessed in a static way\n" + 
8574
			"----------\n" + 
8575
			"4. WARNING in C.java (at line 4)\n" + 
8576
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8577
			"	                        ^\n" + 
8578
			"B is a raw type. References to generic type B<X> should be parameterized\n" + 
8579
			"----------\n" + 
8580
			"5. ERROR in C.java (at line 4)\n" + 
8581
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8582
			"	                                     ^^^\n" + 
8583
			"The method get(B<D>) in the type B<D> is not applicable for the arguments (B<B<D>>)\n" + 
8584
			"----------\n" + 
8585
			"6. WARNING in C.java (at line 4)\n" + 
8586
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8587
			"	                                         ^^^^^^^^^^^^^^^\n" + 
8588
			"The static method start() from the type B should be accessed in a static way\n" + 
8589
			"----------\n" + 
8590
			"7. WARNING in C.java (at line 4)\n" + 
8591
			"	new B().start().get(new B().start()).get(new B().start());\n" + 
8592
			"	                                             ^\n" + 
8593
			"B is a raw type. References to generic type B<X> should be parameterized\n" + 
8594
			"----------\n" + 
8595
			"----------\n" + 
8596
			"1. WARNING in B.java (at line 3)\n" + 
8597
			"	static B<B<D>> start() { return null; }\n" + 
8598
			"	           ^\n" + 
8599
			"D is a raw type. References to generic type D<Y> should be parameterized\n" + 
8600
			"----------\n");
8601
	}
8602
	public void test0297() {
8603
		this.runConformTest(
8604
			new String[] {
8605
				"X.java", //---------------------------
8606
				"import java.util.HashMap;\n" + 
8607
				"import java.util.Iterator;\n" + 
8608
				"import java.util.Map;\n" + 
8609
				"\n" + 
8610
				"public class X {\n" + 
8611
				"		 public static void main(String[] args) {\n" + 
8612
				"		 		 Map<String, String> map = new HashMap<String, String>();\n" + 
8613
				"		 		 \n" + 
8614
				"		 		 map.put(\"foo\", \"bar\");\n" + 
8615
				"		 		 \n" + 
8616
				"		 		 // Error reported on the following line\n" + 
8617
				"		 		 Iterator<Map.Entry<String,String>> i = map.entrySet().iterator();\n" + 
8618
				"		 		 while (i.hasNext()) {\n" + 
8619
				"		 		 		 Map.Entry<String, String> entry = i.next();\n" + 
8620
				"		 		 		 System.out.println(entry.getKey() + \", \" + entry.getValue());\n" + 
8621
				"		 		 }\n" + 
8622
				"		 }\n" + 
8623
				"}\n",
8624
			},
8625
			"foo, bar");	
8626
	}
8627
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=72644
8628
	public void test0298() {
8629
		this.runNegativeTest(
8630
			new String[] {
8631
				"X.java", //---------------------------
8632
				"import java.util.Collection;\n" + 
8633
				"import java.util.Map;\n" + 
8634
				"import java.util.Set;\n" + 
8635
				"\n" + 
8636
				"public class X<V> implements Map<String, V> {\n" + 
8637
				"   private Map<String, V> backingMap;\n" + 
8638
				"   public int size() { return 0; }\n" + 
8639
				"   public boolean isEmpty() { return false; }\n" + 
8640
				"   public boolean containsKey(Object key) { return false; }\n" + 
8641
				"   public boolean containsValue(Object value) { return false; }\n" + 
8642
				"   public V get(Object key) { return null; }\n" + 
8643
				"   public V put(String key, V value) { return null; }\n" + 
8644
				"   public V remove(Object key) { return null; }\n" + 
8645
				"   public void clear() { }\n" + 
8646
				"   public Set<String> keySet() { return null; }\n" + 
8647
				"   public Collection<V> values() { return null; }\n" + 
8648
				"   public void putAll(Map<String, ? extends V> t) { }\n" + 
8649
				"   public Set<Map.Entry<String, V>> entrySet() {\n" + 
8650
				"      return this.backingMap.entrySet();\n" + 
8651
				"   }\n" + 
8652
				"}\n",
8653
			},
8654
			"----------\n" + 
8655
			"1. ERROR in X.java (at line 5)\n" + 
8656
			"	public class X<V> implements Map<String, V> {\n" + 
8657
			"	             ^\n" + 
8658
			"The type X<V> must implement the inherited abstract method Map<String,V>.putAll(Map<? extends String,? extends V>)\n" + 
8659
			"----------\n" + 
8660
			"2. ERROR in X.java (at line 17)\n" + 
8661
			"	public void putAll(Map<String, ? extends V> t) { }\n" + 
8662
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
8663
			"Name clash: The method putAll(Map<String,? extends V>) of type X<V> has the same erasure as putAll(Map<? extends K,? extends V>) of type Map<K,V> but does not override it\n" + 
8664
			"----------\n");
8665
		this.runConformTest(
8666
			new String[] {
8667
				"X.java", //---------------------------
8668
				"public abstract class X<S, V> implements java.util.Map<Object, Object> {\n" + 
8669
				"   public void putAll(java.util.Map<?, ?> t) { }\n" + 
8670
				"}\n",
8671
			},
8672
			"");
8673
		this.runNegativeTest(
8674
			new String[] {
8675
				"X.java", //---------------------------
8676
				"public abstract class X<S, V> implements java.util.Map<S, V> {\n" + 
8677
				"   public void putAll(java.util.Map<? extends String, ? extends V> t) { }\n" + 
8678
				"}\n",
8679
			},
8680
			"----------\n" + 
8681
			"1. ERROR in X.java (at line 2)\n" + 
8682
			"	public void putAll(java.util.Map<? extends String, ? extends V> t) { }\n" + 
8683
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
8684
			"Name clash: The method putAll(Map<? extends String,? extends V>) of type X<S,V> has the same erasure as putAll(Map<? extends K,? extends V>) of type Map<K,V> but does not override it\n" + 
8685
			"----------\n");
8686
	}
8687
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74244
8688
	public void test0299() {
8689
		this.runConformTest(
8690
			new String[] {
8691
				"X.java", //---------------------------
8692
				"public class X {\n" + 
8693
				" public static void main(String argv[]) {\n" + 
8694
				" 	System.out.println(Boolean.class == boolean.class ? \"FAILED\" : \"SUCCESS\");\n" + 
8695
				" }\n" + 
8696
				"}\n",
8697
			},
8698
			"SUCCESS");	
8699
	}	
8700
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74119
8701
	public void test0300() {
8702
		this.runConformTest(
8703
			new String[] {
8704
				"X.java", //---------------------------
8705
				"public class X {\n" + 
8706
				"    static interface I extends Visitible<I> {\n" + 
8707
				"    }\n" + 
8708
				"    static interface Visitible<T> {\n" + 
8709
				"        void acceptVisitor(Visitor<? super T> visitor);\n" + 
8710
				"    }\n" + 
8711
				"    static interface Visitor<T> {\n" + 
8712
				"        void visit(T t);\n" + 
8713
				"    }\n" + 
8714
				"    static class C implements I {\n" + 
8715
				"        public void acceptVisitor(Visitor<? super I> visitor) {\n" + 
8716
				"            visitor.visit(this); // should be ok\n" + 
8717
				"            visitor.visit((I) this); // (2) This is a workaround\n" + 
8718
				"        }\n" + 
8719
				"    }\n" + 
8720
				"    public static void main(String [] args) {\n" + 
8721
				"        System.out.println(\"SUCCESS\");\n" + 
8722
				"    }\n" + 
8723
				"}\n",
8724
			},
8725
			"SUCCESS");	
8726
	}
8727
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74320: check no complaint for unused private method
8728
	public void test0301() {
8729
		this.runNegativeTest(
8730
			new String[] {
8731
				"X.java", //---------------------------
8732
				"import java.util.List;\n" + 
8733
				"public class X {\n" + 
8734
				"	public static void reverse(List<?> list) { \n" + 
8735
				"		rev(list);\n" + 
8736
				"	}\n" + 
8737
				"	private static <T> void rev(List<T> list) {\n" + 
8738
				"	}\n" + 
8739
				"	Zork foo() {\n" + 
8740
				"	}\n" + 				
8741
				"}\n",
8742
			},
8743
			"----------\n" + 
8744
			"1. ERROR in X.java (at line 8)\n" + 
8745
			"	Zork foo() {\n" + 
8746
			"	^^^^\n" + 
8747
			"Zork cannot be resolved to a type\n" + 
8748
			"----------\n");	
8749
	}		
8750
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74514
8751
	public void test0302() {
8752
		this.runNegativeTest(
8753
			new String[] {
8754
				"X.java", //---------------------------
8755
				"import java.util.ArrayList;\n" + 
8756
				"import java.util.Enumeration;\n" + 
8757
				"import java.util.Iterator;\n" + 
8758
				"import java.util.List;\n" + 
8759
				"public class X {\n" + 
8760
				"	public void test02() {\n" + 
8761
				"		List<String> l= new ArrayList<String>();\n" + 
8762
				"		for (Iterator<String> i= l.iterator(); i.next(); ) {\n" + 
8763
				"		}\n" + 
8764
				"	}\n" + 
8765
				"}\n",
8766
			},
8767
			"----------\n" + 
8768
			"1. ERROR in X.java (at line 8)\n" + 
8769
			"	for (Iterator<String> i= l.iterator(); i.next(); ) {\n" + 
8770
			"	                                       ^^^^^^^^\n" + 
8771
			"Type mismatch: cannot convert from String to boolean\n" + 
8772
			"----------\n");	
8773
	}		
8774
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74544
8775
	public void test0303() {
8776
		this.runConformTest(
8777
			new String[] {
8778
				"X.java", //---------------------------
8779
				"public  class X {\n" + 
8780
				"  	public static void main(String[] args) {\n" + 
8781
				"  		Y<String> ys = new Y<String>();\n" + 
8782
				"	    Y<String>.Member m = ys.new Member();\n" + 
8783
				"	    m.foo();\n" + 
8784
				"  	}    \n" + 
8785
				"  }\n" + 
8786
				"  class Y<T> {\n" + 
8787
				"    class Member {\n" + 
8788
				"    	void foo(){\n" + 
8789
				"    		System.out.println(\"SUCCESS\");\n" + 
8790
				"    	}\n" + 
8791
				"    }\n" + 
8792
				"  }\n" + 
8793
				"\n",
8794
			},
8795
			"SUCCESS");	
8796
	}
8797
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74592
8798
	public void test0304() {
8799
		this.runConformTest(
8800
			new String[] {
8801
				"X.java", //---------------------------
8802
				"public class X<T extends Y> {}\n" + 
8803
				"class Y extends X {}"
8804
			},
8805
			"");	
8806
	}
8807
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74420
8808
	public void test0305() {
8809
		this.runConformTest(
8810
			new String[] {
8811
				"X.java", //---------------------------
8812
				"public class X<T> {\n" + 
8813
				"  	T x;\n" + 
8814
				"  	<U extends T> T foo(U u) { return u; }\n" + 
8815
				"}\n"
8816
			},
8817
			"");
8818
	}
8819
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74096
8820
	public void test0306() {
8821
		this.runNegativeTest(
8822
			new String[] {
8823
				"X.java", //---------------------------
8824
				"public class X<T extends X<T>> {\n" + 
8825
				"  	static int CONSTANT = 1;\n" + 
8826
				"  	private int i = 1;\n" + 
8827
				"  	private int i() {return i;}\n" + 
8828
				"  	private static class M { private static int j = 2; }\n" + 
8829
				"  	public int foo(T t) { return t.i + t.i() + T.M.j; }\n" + 
8830
				"  	public int foo2(T t) { return T.CONSTANT; }\n" + // why is this allowed?
8831
				"}\n" +
8832
				"class Y extends Zork {\n" +
8833
				"}\n"
8834
			},
8835
			"----------\n" + 
8836
			"1. WARNING in X.java (at line 6)\n" + 
8837
			"	public int foo(T t) { return t.i + t.i() + T.M.j; }\n" + 
8838
			"	                                           ^^^^^\n" + 
8839
			"Read access to enclosing field X<T>.M.j is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
8840
			"----------\n" + 
8841
			"2. ERROR in X.java (at line 9)\n" + 
8842
			"	class Y extends Zork {\n" + 
8843
			"	                ^^^^\n" + 
8844
			"Zork cannot be resolved to a type\n" + 
8845
			"----------\n"
8846
			// 5: operator + cannot be applied to int,<any>.j
8847
			// 5: incompatible type, found : <nulltype>, required: int
8848
		);
8849
	}
8850
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=72583
8851
	public void test0307() {
8852
		this.runConformTest(
8853
			new String[] {
8854
				"X.java", //---------------------------
8855
				"public class X {\n" + 
8856
				"	static <T> T foo(T t1, T t2){ return t1; }\n" + 
8857
				"	public static void main(String[] args) {\n" + 
8858
				"		IX s = null;\n" + 
8859
				"		 foo(new Object(), s);\n" + 
8860
				"	}\n" + 
8861
				"}\n" +
8862
				"interface IX {}\n"
8863
			},
8864
			"");	
8865
	}	
8866
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=73696
8867
	public void test0308() {
8868
		this.runConformTest(
8869
			new String[] {
8870
				"p/X.java",
8871
				"package p;\n" + 
8872
					"public class X<T> {\n" + 
8873
					"	class Member {}\n" + 
8874
					"}\n",
8875
				"p/Y.java",
8876
				"package p;\n" + 
8877
					"public class Y {\n" + 
8878
					"	p.X.Member m;\n" + 
8879
					"	p.X<String>.Member ms = m;\n" + 
8880
					"}\n"
8881
			});	
8882
	}	
8883
	public void test0309() {
8884
		this.runConformTest(
8885
			new String[] {
8886
				"p/X.java",
8887
				"package p;\n" + 
8888
					"public class X<T> {\n" + 
8889
					"	class Member {\n" + 
8890
					"		class Sub {}\n" + 
8891
					"	}\n" + 
8892
					"}\n",
8893
				"p/Y.java",
8894
				"package p;\n" + 
8895
					"public class Y {\n" + 
8896
					"	p.X.Member.Sub s;\n" + 
8897
					"	p.X<Exception>.Member.Sub es = s;\n" + 
8898
					"}\n"
8899
			});	
8900
	}	
8901
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75156 - should report name clash
8902
	public void test0310() {
8903
		this.runNegativeTest(
8904
			new String[] {
8905
				"X.java",
8906
				"import java.util.List;\n" + 
8907
				"public class X extends X2 {\n" + 
8908
				"	void foo(List<X> lx) { }\n" + 
8909
				"}\n" + 
8910
				"\n" + 
8911
				"abstract class X2 {\n" + 
8912
				"	void foo(List<Object> lo) { }\n" + 
8913
				"}"
8914
			},
8915
			"----------\n" + 
8916
			"1. ERROR in X.java (at line 3)\n" + 
8917
			"	void foo(List<X> lx) { }\n" + 
8918
			"	     ^^^^^^^^^^^^^^^\n" + 
8919
			"Name clash: The method foo(List<X>) of type X has the same erasure as foo(List<Object>) of type X2 but does not override it\n" + 
8920
			"----------\n");	
8921
	}
8922
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75156 variation - should report name clash and ambiguity
8923
	public void test0311() {
8924
		this.runNegativeTest(
8925
			new String[] {
8926
				"X.java",
8927
				"import java.util.List;\n" + 
8928
				"public class X extends X2 {\n" + 
8929
				"	void foo(List<X> lx) { }\n" + 
8930
				"	void bar(){\n" + 
8931
				"		this.foo((List)null);\n" + 
8932
				"	}\n" + 
8933
				"}\n" + 
8934
				"\n" + 
8935
				"abstract class X2 {\n" + 
8936
				"	void foo(List<Object> lo) { }\n" + 
8937
				"}"
8938
			},
8939
			"----------\n" + 
8940
			"1. ERROR in X.java (at line 3)\n" + 
8941
			"	void foo(List<X> lx) { }\n" + 
8942
			"	     ^^^^^^^^^^^^^^^\n" + 
8943
			"Name clash: The method foo(List<X>) of type X has the same erasure as foo(List<Object>) of type X2 but does not override it\n" + 
8944
			"----------\n" + 
8945
			"2. ERROR in X.java (at line 5)\n" + 
8946
			"	this.foo((List)null);\n" + 
8947
			"	     ^^^\n" + 
8948
			"The method foo(List<X>) is ambiguous for the type X\n" + 
8949
			"----------\n" + 
8950
			"3. WARNING in X.java (at line 5)\n" + 
8951
			"	this.foo((List)null);\n" + 
8952
			"	          ^^^^\n" + 
8953
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
8954
			"----------\n");	
8955
	}		
8956
	// 75156 variation - should report name clash instead of final method override
8957
	public void test0312() {
8958
		this.runNegativeTest(
8959
			new String[] {
8960
				"X.java",
8961
				"import java.util.List;\n" + 
8962
				"public class X extends X2 {\n" + 
8963
				"	void foo(List<X> lx) { }\n" + 
8964
				"}\n" + 
8965
				"\n" + 
8966
				"abstract class X2 {\n" + 
8967
				"	final void foo(List<Object> lo) { }\n" + 
8968
				"}"	
8969
			},
8970
			"----------\n" + 
8971
			"1. ERROR in X.java (at line 3)\n" + 
8972
			"	void foo(List<X> lx) { }\n" + 
8973
			"	     ^^^^^^^^^^^^^^^\n" + 
8974
			"Name clash: The method foo(List<X>) of type X has the same erasure as foo(List<Object>) of type X2 but does not override it\n" + 
8975
			"----------\n");	
8976
	}
8977
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=73963 
8978
	public void test0313() {
8979
		this.runConformTest(
8980
			new String[] {
8981
				"X.java",
8982
				"import java.net.Inet6Address;\n" + 
8983
				"import java.net.InetAddress;\n" + 
8984
				"import java.util.AbstractList;\n" + 
8985
				"import java.util.ArrayList;\n" + 
8986
				"import java.util.List;\n" + 
8987
				"\n" + 
8988
				"public class X {\n" + 
8989
				"void takeAbstract(AbstractList<? extends InetAddress> arg) { }\n" + 
8990
				"\n" + 
8991
				"void takeList(List<? extends InetAddress> arg) { }\n" + 
8992
				"\n" + 
8993
				"void construct() {\n" + 
8994
				"	AbstractList<InetAddress> a= new ArrayList<InetAddress>();\n" + 
8995
				"	takeAbstract(a);\n" + 
8996
				"	takeAbstract(new ArrayList<InetAddress>()); // a inlined: error 1:\n" + 
8997
				"//The method takeAbstract(AbstractList<? extends InetAddress>) in the type A\n" + 
8998
				"// is not applicable for the arguments (ArrayList<InetAddress>)\n" + 
8999
				"	\n" + 
9000
				"	List<InetAddress> l= new ArrayList<InetAddress>();\n" + 
9001
				"	takeList(l);\n" + 
9002
				"	takeList(new ArrayList<InetAddress>()); // l inlined: ok\n" + 
9003
				"	\n" + 
9004
				"	ArrayList<? extends InetAddress> aw= new ArrayList<InetAddress>();\n" + 
9005
				"	takeAbstract(aw);\n" + 
9006
				"	takeAbstract(new ArrayList<Inet6Address>()); // aw inlined: error 2:\n" + 
9007
				"//The method takeAbstract(AbstractList<? extends InetAddress>) in the type A\n" + 
9008
				"// is not applicable for the arguments (ArrayList<Inet6Address>)\n" + 
9009
				"\n" + 
9010
				"	takeList(aw);\n" + 
9011
				"	takeList(new ArrayList<Inet6Address>()); //aw inlined: ok\n" + 
9012
				"}\n" + 
9013
				"}"
9014
			},
9015
			"");	
9016
	}
9017
	public void test0314() {
9018
		this.runConformTest(
9019
			new String[] {
9020
				"X.java",	
9021
				"public class X <E> {\n" + 
9022
				"	static class XMember<F> {}\n" + 
9023
				"\n" + 
9024
				"	// with toplevel element type\n" + 
9025
				"	void foo() {\n" + 
9026
				"		XIter<XElement<E>> iter = fooSet().iterator();\n" + 
9027
				"	}\n" + 
9028
				"	XSet<XElement<E>> fooSet()	 { return null; }\n" + 
9029
				"\n" + 
9030
				"	// with member element type\n" + 
9031
				"	void bar() {\n" + 
9032
				"		XIter<XMember<E>> iter = barSet().iterator();\n" + 
9033
				"	}\n" + 
9034
				"	XSet<XMember<E>> barSet()	 { return null; }\n" + 
9035
				"\n" + 
9036
				"	\n" + 
9037
				"}\n" + 
9038
				"\n" + 
9039
				"class XSet<G> {\n" + 
9040
				"	XIter<G> iterator() { return null; }\n" + 
9041
				"}\n" + 
9042
				"class XIter<H> {\n" + 
9043
				"}\n" + 
9044
				"class XElement<I> {\n" + 
9045
				"}\n"				
9046
			},
9047
			"");
9048
	}
9049
	public void test0315() {
9050
		this.runConformTest(
9051
			new String[] {
9052
				"X.java",	
9053
				"public class X <E> {\n" + 
9054
				"	static class XMember<F> {}\n" + 
9055
				"\n" + 
9056
				"	// with member element type\n" + 
9057
				"	void bar() {\n" + 
9058
				"		XIter<X.XMember<E>> iter = barSet().iterator();\n" + 
9059
				"	}\n" + 
9060
				"	XSet<XMember<E>> barSet()	 { return null; }\n" + 
9061
				"\n" + 
9062
				"	\n" + 
9063
				"}\n" + 
9064
				"\n" + 
9065
				"class XSet<G> {\n" + 
9066
				"	XIter<G> iterator() { return null; }\n" + 
9067
				"}\n" + 
9068
				"class XIter<H> {\n" + 
9069
				"}\n" + 
9070
				"class XElement<I> {\n" + 
9071
				"}\n"			
9072
			},
9073
			"");
9074
	}
9075
	public void test0316() {
9076
		this.runNegativeTest(
9077
			new String[] {
9078
				"X.java",	
9079
				"import java.util.List;\n" + 
9080
				"\n" + 
9081
				"public class X <E extends List & Runnable> {\n" + 
9082
				"	\n" + 
9083
				"	E element() { return null; }\n" + 
9084
				"	\n" + 
9085
				"	void bar(X<E> xe) {\n" + 
9086
				"		xe.element().add(this);\n" + 
9087
				"		xe.element().run();\n" + 
9088
				"	}\n" + 
9089
				"	void foo(X<?> xe) {\n" + 
9090
				"		xe.element().add(this);\n" + 
9091
				"		xe.element().run();\n" + 
9092
				"	}\n" + 
9093
				"	void baz(X<? extends XM> xe) {\n" + 
9094
				"		xe.element().add(this);\n" + 
9095
				"		xe.element().run();\n" + 
9096
				"	}\n" + 
9097
				"	abstract class XM implements List, Runnable {}\n" + 
9098
				"  Zork z;\n" +
9099
				"}\n"		
9100
			},
9101
			"----------\n" + 
9102
			"1. WARNING in X.java (at line 3)\n" + 
9103
			"	public class X <E extends List & Runnable> {\n" + 
9104
			"	                          ^^^^\n" + 
9105
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
9106
			"----------\n" + 
9107
			"2. WARNING in X.java (at line 8)\n" + 
9108
			"	xe.element().add(this);\n" + 
9109
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
9110
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
9111
			"----------\n" + 
9112
			"3. WARNING in X.java (at line 12)\n" + 
9113
			"	xe.element().add(this);\n" + 
9114
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
9115
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
9116
			"----------\n" + 
9117
			"4. WARNING in X.java (at line 16)\n" + 
9118
			"	xe.element().add(this);\n" + 
9119
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
9120
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
9121
			"----------\n" + 
9122
			"5. WARNING in X.java (at line 19)\n" + 
9123
			"	abstract class XM implements List, Runnable {}\n" + 
9124
			"	                             ^^^^\n" + 
9125
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
9126
			"----------\n" + 
9127
			"6. ERROR in X.java (at line 20)\n" + 
9128
			"	Zork z;\n" + 
9129
			"	^^^^\n" + 
9130
			"Zork cannot be resolved to a type\n" + 
9131
			"----------\n");
9132
	}	
9133
	public void test0317() {
9134
		this.runNegativeTest(
9135
			new String[] {
9136
				"X.java",	
9137
				"import java.util.List;\n" + 
9138
				"\n" + 
9139
				"public class X <E extends List & Runnable> {\n" + 
9140
				"	\n" + 
9141
				"	E element() { return null; }\n" + 
9142
				"	\n" + 
9143
				"	void foo(X<? extends XI> xe) {\n" + 
9144
				"		xe.element().add(this);\n" + 
9145
				"		xe.element().run();\n" + 
9146
				"	}\n" + 
9147
				"	void baz(X<? extends XM> xe) {\n" + 
9148
				"		xe.element().add(this);\n" + 
9149
				"		xe.element().run();\n" + 
9150
				"	}\n" + 
9151
				"	interface XI extends Runnable {}\n" + 
9152
				"	\n" + 
9153
				"	class XM {\n" + 
9154
				"		void foo() {}\n" + 
9155
				"	}\n" + 
9156
				"  Zork z;\n" +
9157
				"}\n"
9158
			},
9159
			"----------\n" + 
9160
			"1. WARNING in X.java (at line 3)\n" + 
9161
			"	public class X <E extends List & Runnable> {\n" + 
9162
			"	                          ^^^^\n" + 
9163
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
9164
			"----------\n" + 
9165
			"2. WARNING in X.java (at line 8)\n" + 
9166
			"	xe.element().add(this);\n" + 
9167
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
9168
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
9169
			"----------\n" + 
9170
			"3. WARNING in X.java (at line 12)\n" + 
9171
			"	xe.element().add(this);\n" + 
9172
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
9173
			"Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E> should be parameterized\n" + 
9174
			"----------\n" + 
9175
			"4. ERROR in X.java (at line 20)\n" + 
9176
			"	Zork z;\n" + 
9177
			"	^^^^\n" + 
9178
			"Zork cannot be resolved to a type\n" + 
9179
			"----------\n");
9180
	}	
9181
	
9182
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75548
9183
	public void test0318() {
9184
		this.runConformTest(
9185
			new String[] {
9186
				"MyCache.java",	
9187
				"class Cache<K, V> {\n" + 
9188
				"}\n" + 
9189
				"\n" + 
9190
				"class Index<K, V> {\n" + 
9191
				"  public Index(Cache<?, V> parentCache) {\n" + 
9192
				"  }\n" + 
9193
				"}\n" + 
9194
				"\n" + 
9195
				"public class MyCache extends Cache<Integer, String> {\n" + 
9196
				"  class AnIndex extends Index<String, String> {\n" + 
9197
				"    public AnIndex() {\n" + 
9198
				"      super(MyCache.this); // <-- Eclipse cannot find the constructor!\n" + 
9199
				"    }\n" + 
9200
				"  }\n" + 
9201
				"}\n"	
9202
			},
9203
			"");
9204
	}
9205
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76729
9206
	public void test0319() {
9207
		this.runConformTest(
9208
			new String[] {
9209
				"test/Test1.java",
9210
				"package test;\n" + 
9211
				"\n" + 
9212
				"class A<BB extends B>\n" + 
9213
				"{}\n" + 
9214
				"\n" + 
9215
				"class B<AA extends A>\n" + 
9216
				"{}\n" + 
9217
				"\n" + 
9218
				"public interface Test1<C extends B<?>, D extends A<?>>\n" + 
9219
				"{}\n" + 
9220
				"\n" + 
9221
				"class AbstractA extends A<AbstractB> {};\n" + 
9222
				"class AbstractB extends B<AbstractA> {};\n" + 
9223
				"\n" + 
9224
				"class Test2<E extends AbstractB, F extends AbstractA> implements Test1<E, F>\n" + 
9225
				"{}"
9226
			},
9227
			"");	
9228
	}				
9229
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74032
9230
	public void test0320() {
9231
		this.runConformTest(
9232
			new String[] {
9233
				"X.java",
9234
				"import java.util.ArrayList;\n" + 
9235
				"import java.util.List;\n" + 
9236
				"class TestElement extends ArrayList implements Runnable {\n" + 
9237
				"  public void run() {\n" + 
9238
				"  }\n" + 
9239
				"}\n" + 
9240
				"public class X <E extends List & Runnable> {\n" + 
9241
				"  public X(E element) {\n" + 
9242
				"    element.run();\n" + 
9243
				"  }\n" + 
9244
				"  public static void main(String[] args) {\n" + 
9245
				"    new X<TestElement>(new TestElement());\n" + 
9246
				"    System.out.println(\"SUCCESS\");\n" + 
9247
				"  }\n" + 
9248
				"}\n"
9249
			},
9250
			"SUCCESS");	
9251
	}			
9252
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74032 - variation with wildcard
9253
	public void test0321() {
9254
		this.runConformTest(
9255
			new String[] {
9256
				"X.java",
9257
				"import java.util.ArrayList;\n" + 
9258
				"import java.util.List;\n" + 
9259
				"class TestElement extends ArrayList implements Runnable {\n" + 
9260
				"  static final long serialVersionUID = 1l;\n" + 
9261
				"  public void run() {\n" + 
9262
				"  	// empty\n" + 
9263
				"  }\n" + 
9264
				"}\n" + 
9265
				"public class X <E extends List & Runnable> {\n" + 
9266
				"	E element;\n" + 
9267
				"  public X(E element) {\n" + 
9268
				"  	this.element = element;\n" + 
9269
				"    element.run();\n" + 
9270
				"  }\n" + 
9271
				"  public X(X<?> x) {\n" + 
9272
				"    x.element.run();\n" + // should be able to bind to #run()
9273
				"  }\n" + 
9274
				"  public static void main(String[] args) {\n" + 
9275
				"    new X<TestElement>(new TestElement());\n" + 
9276
				"    System.out.println(\"SUCCESS\");\n" + 
9277
				"  }\n" + 
9278
				"}\n"
9279
			},
9280
			"SUCCESS");	
9281
	}			
9282
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75134
9283
	public void test0322() {
9284
		this.runConformTest(
9285
			new String[] {
9286
				"X.java",
9287
				"import java.util.*;\n" + 
9288
				"public class X<A> {\n" + 
9289
				"\n" + 
9290
				"  A v2;\n" + 
9291
				"  X(A a) { v2 = a; }\n" + 
9292
				"  \n" + 
9293
				"  void func() {\n" + 
9294
				"    List<B<A>> l = new ArrayList<B<A>>();\n" + 
9295
				"  }\n" + 
9296
				"\n" + 
9297
				"  class B<T> {\n" + 
9298
				"    T v1;\n" + 
9299
				"    B(T b) {  v1 = b; }\n" + 
9300
				"  }\n" + 
9301
				"  \n" + 
9302
				"}\n"
9303
			},
9304
			"");	
9305
	}		
9306
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76359 - also check warnings for raw conversion
9307
	public void test0323() {
9308
		this.runNegativeTest(
9309
			new String[] {
9310
				"X.java",
9311
				"class G<T> {\n" + 
9312
				"	class Member {}\n" + 
9313
				"}\n" + 
9314
				"public class X {\n" + 
9315
				"	G<String> g = new G();\n" + 
9316
				"	G<String>.Member gsm = g.new Member();\n" + 
9317
				"	G.Member gm = null;\n" + 
9318
				"	G<Thread>.Member gtm = gm;\n" + 
9319
				"	Zork z;\n" +
9320
				"}\n"		
9321
			},
9322
			"----------\n" + 
9323
			"1. WARNING in X.java (at line 5)\n" + 
9324
			"	G<String> g = new G();\n" + 
9325
			"	              ^^^^^^^\n" + 
9326
			"Type safety: The expression of type G needs unchecked conversion to conform to G<String>\n" + 
9327
			"----------\n" + 
9328
			"2. WARNING in X.java (at line 5)\n" + 
9329
			"	G<String> g = new G();\n" + 
9330
			"	                  ^\n" + 
9331
			"G is a raw type. References to generic type G<T> should be parameterized\n" + 
9332
			"----------\n" + 
9333
			"3. WARNING in X.java (at line 7)\n" + 
9334
			"	G.Member gm = null;\n" + 
9335
			"	^^^^^^^^\n" + 
9336
			"G.Member is a raw type. References to generic type G<T>.Member should be parameterized\n" + 
9337
			"----------\n" + 
9338
			"4. WARNING in X.java (at line 8)\n" + 
9339
			"	G<Thread>.Member gtm = gm;\n" + 
9340
			"	                       ^^\n" + 
9341
			"Type safety: The expression of type G.Member needs unchecked conversion to conform to G<Thread>.Member\n" + 
9342
			"----------\n" + 
9343
			"5. ERROR in X.java (at line 9)\n" + 
9344
			"	Zork z;\n" + 
9345
			"	^^^^\n" + 
9346
			"Zork cannot be resolved to a type\n" + 
9347
			"----------\n");	
9348
	}			
9349
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=72998
9350
	public void test0324() {
9351
		this.runConformTest(
9352
			new String[] {
9353
				"X.java",
9354
				"import java.util.Iterator;\n" + 
9355
				"import java.util.Set;\n" + 
9356
				"\n" + 
9357
				"public class X<E> {\n" + 
9358
				"   private TreeNode<E> root;\n" + 
9359
				"\n" + 
9360
				"   public void doSomething() {\n" + 
9361
				"      for (TreeNode<E> child : root.children()) {\n" + 
9362
				"         // root.children() should work??\n" + 
9363
				"      }\n" + 
9364
				"   }\n" + 
9365
				"\n" + 
9366
				"   public void doSomethingElse() {\n" + 
9367
				"      for (Iterator<TreeNode<E>> it = root.children().iterator(); it.hasNext();) {\n" + 
9368
				"         // this also should work\n" + 
9369
				"      }\n" + 
9370
				"   }\n" + 
9371
				"}\n" + 
9372
				"\n" + 
9373
				"class TreeNode<E> {\n" + 
9374
				"   private Set<TreeNode<E>> children;\n" + 
9375
				"   \n" + 
9376
				"   public Set<TreeNode<E>> children() {\n" + 
9377
				"      return children;\n" + 
9378
				"   }\n" + 
9379
				"}\n"
9380
			},
9381
			"");	
9382
	}
9383
	public void test0325() {
9384
		this.runNegativeTest(
9385
			new String[] {
9386
				"X.java",
9387
				"public class X <T> {\n" + 
9388
				"	void foo1() {\n" + 
9389
				"		X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + 
9390
				"	}\n" + 
9391
				"	void foo2() {\n" + 
9392
				"		X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + // allowed per grammar
9393
				"	}\n" + 
9394
				"	void foo3() {\n" + 
9395
				"		X.Item k = new X.Item();\n" + 
9396
				"	}\n" + 
9397
				"	static void foo4() {\n" + 
9398
				"		X.Item k = new X.Item();\n" + 
9399
				"	}\n" + 
9400
				"	class Item <E> {}\n" + 
9401
				"}\n"
9402
			},
9403
			"----------\n" + 
9404
			"1. ERROR in X.java (at line 3)\n" + 
9405
			"	X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + 
9406
			"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
9407
			"Type mismatch: cannot convert from X<Exception>.Item<Thread> to X<String>.Item<Thread>\n" + 
9408
			"----------\n" + 
9409
			"2. ERROR in X.java (at line 6)\n" + 
9410
			"	X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + 
9411
			"	                                  ^^^^^^^^^^^^^^^^^\n" + 
9412
			"Cannot allocate the member type X<Exception>.Item<Thread> using a parameterized compound name; use its simple name and an enclosing instance of type X<Exception>\n" + 
9413
			"----------\n" + 
9414
			"3. WARNING in X.java (at line 9)\n" + 
9415
			"	X.Item k = new X.Item();\n" + 
9416
			"	^^^^^^\n" + 
9417
			"X.Item is a raw type. References to generic type X<T>.Item<E> should be parameterized\n" + 
9418
			"----------\n" + 
9419
			"4. WARNING in X.java (at line 9)\n" + 
9420
			"	X.Item k = new X.Item();\n" + 
9421
			"	               ^^^^^^\n" + 
9422
			"X.Item is a raw type. References to generic type X<T>.Item<E> should be parameterized\n" + 
9423
			"----------\n" + 
9424
			"5. WARNING in X.java (at line 12)\n" + 
9425
			"	X.Item k = new X.Item();\n" + 
9426
			"	^^^^^^\n" + 
9427
			"X.Item is a raw type. References to generic type X<T>.Item<E> should be parameterized\n" + 
9428
			"----------\n" + 
9429
			"6. ERROR in X.java (at line 12)\n" + 
9430
			"	X.Item k = new X.Item();\n" + 
9431
			"	           ^^^^^^^^^^^^\n" + 
9432
			"No enclosing instance of type X<T> is accessible. Must qualify the allocation with an enclosing instance of type X<T> (e.g. x.new A() where x is an instance of X<T>).\n" + 
9433
			"----------\n" + 
9434
			"7. WARNING in X.java (at line 12)\n" + 
9435
			"	X.Item k = new X.Item();\n" + 
9436
			"	               ^^^^^^\n" + 
9437
			"X.Item is a raw type. References to generic type X<T>.Item<E> should be parameterized\n" + 
9438
			"----------\n");
9439
	}
9440
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75400
9441
	public void test0326() {
9442
		this.runConformTest(
9443
			new String[] {
9444
				"X.java",
9445
				"public class X<T> implements I<T> {\n" + 
9446
				"    public I.A foo() {\n" + 
9447
				"        return a;\n" + 
9448
				"    }\n" + 
9449
				"}    \n" + 
9450
				"interface I<T> {\n" + 
9451
				"    A a = new A();\n" + 
9452
				"    class A {\n" + 
9453
				"    }\n" + 
9454
				"}\n" + 
9455
				"\n" + 
9456
				"class XM<T> {\n" + 
9457
				"    A a = new A();\n" + 
9458
				"    class A {\n" + 
9459
				"    }\n" + 
9460
				"}	\n" + 
9461
				"\n" + 
9462
				"class XMSub<T> extends XM<T> {\n" + 
9463
				"    public XM.A foo() {\n" + 
9464
				"        return a;\n" + 
9465
				"    }\n" + 
9466
				"}    \n" + 
9467
				"\n"
9468
			},
9469
			"");
9470
	}
9471
	// wildcard captures bound and variable superinterfaces
9472
	public void test0327() {
9473
		this.runConformTest(
9474
			new String[] {
9475
				"X.java",
9476
				"public class X<T extends IFoo> {\n" + 
9477
				"	\n" + 
9478
				"	T element() { return null; }\n" + 
9479
				"	void baz(X<? extends IBar> x) {\n" + 
9480
				"		x.element().foo();\n" + 
9481
				"		x.element().bar();\n" + 
9482
				"	}\n" + 
9483
				"}\n" + 
9484
				"interface IFoo {\n" + 
9485
				"	void foo();\n" + 
9486
				"}\n" + 
9487
				"interface IBar {\n" + 
9488
				"	void bar();\n" + 
9489
				"}\n"
9490
			},
9491
			"");
9492
	}
9493
	// wildcard captures bound and variable superinterfaces
9494
	public void test0328() {
9495
		this.runNegativeTest(
9496
			new String[] {
9497
				"X.java",
9498
				"public class X<T extends IFoo> {\n" + 
9499
				"	T element;\n" + 
9500
				"	X(T element) { \n" + 
9501
				"		this.element = element; \n" + 
9502
				"	}\n" + 
9503
				"	static void baz(X<? extends IBar> x) {\n" + 
9504
				"		x.element.foo();\n" + 
9505
				"		x.element.bar();\n" + 
9506
				"	}\n" + 
9507
				"	public static void main(String[] args) {\n" + 
9508
				"		X<Foo> x1 = new X<Foo>(new Foo());\n" + 
9509
				"		baz(x1);\n" + 
9510
				"		X<Bar> x2 = new X<Bar>(new Bar());\n" + 
9511
				"		baz(x2);\n" + 
9512
				"		X<FooBar> x3 = new X<FooBar>(new FooBar());\n" + 
9513
				"		baz(x3);\n" + 
9514
				"	}\n" + 
9515
				"}\n" + 
9516
				"interface IFoo {\n" + 
9517
				"	void foo();\n" + 
9518
				"}\n" + 
9519
				"interface IBar {\n" + 
9520
				"	void bar();\n" + 
9521
				"}\n" + 
9522
				"class Foo implements IFoo {\n" + 
9523
				"	public void foo() {\n" + 
9524
				"		System.out.print(\"FOO\");\n" + 
9525
				"	}\n" + 
9526
				"}\n" + 
9527
				"class Bar implements IBar {\n" + 
9528
				"	public void bar() {\n" + 
9529
				"		System.out.print(\"BAR\");\n" + 
9530
				"	}\n" + 
9531
				"}\n" + 
9532
				"class FooBar extends Foo implements IBar {\n" + 
9533
				"	public void bar() {\n" + 
9534
				"		System.out.print(\"BAR\");\n" + 
9535
				"	}\n" + 
9536
				"}\n"
9537
			},
9538
			"----------\n" + 
9539
			"1. ERROR in X.java (at line 12)\n" + 
9540
			"	baz(x1);\n" + 
9541
			"	^^^\n" + 
9542
			"The method baz(X<? extends IBar>) in the type X<T> is not applicable for the arguments (X<Foo>)\n" + 
9543
			"----------\n" + 
9544
			"2. ERROR in X.java (at line 13)\n" + 
9545
			"	X<Bar> x2 = new X<Bar>(new Bar());\n" + 
9546
			"	  ^^^\n" + 
9547
			"Bound mismatch: The type Bar is not a valid substitute for the bounded parameter <T extends IFoo> of the type X<T>\n" + 
9548
			"----------\n" + 
9549
			"3. ERROR in X.java (at line 13)\n" + 
9550
			"	X<Bar> x2 = new X<Bar>(new Bar());\n" + 
9551
			"	                  ^^^\n" + 
9552
			"Bound mismatch: The type Bar is not a valid substitute for the bounded parameter <T extends IFoo> of the type X<T>\n" + 
9553
			"----------\n");
9554
	}	
9555
	// wildcard captures bound and variable superinterfaces
9556
	public void test0329() {
9557
		this.runConformTest(
9558
			new String[] {
9559
				"X.java",
9560
				"public class X<T extends IFoo> {\n" + 
9561
				"	T element;\n" + 
9562
				"	X(T element) { \n" + 
9563
				"		this.element = element; \n" + 
9564
				"	}\n" + 
9565
				"	static void baz(X<? extends IBar> x) {\n" + 
9566
				"		x.element.foo();\n" + 
9567
				"		x.element.bar();\n" + 
9568
				"	}\n" + 
9569
				"	public static void main(String[] args) {\n" + 
9570
				"		X<FooBar> x3 = new X<FooBar>(new FooBar());\n" + 
9571
				"		baz(x3);\n" + 
9572
				"	}\n" + 
9573
				"}\n" + 
9574
				"interface IFoo {\n" + 
9575
				"	void foo();\n" + 
9576
				"}\n" + 
9577
				"interface IBar {\n" + 
9578
				"	void bar();\n" + 
9579
				"}\n" + 
9580
				"class FooBar implements IFoo, IBar {\n" + 
9581
				"	public void foo() {\n" + 
9582
				"		System.out.print(\"FOO\");\n" + 
9583
				"	}\n" + 
9584
				"	public void bar() {\n" + 
9585
				"		System.out.print(\"BAR\");\n" + 
9586
				"	}\n" + 
9587
				"}\n",
9588
			},
9589
			"FOOBAR");
9590
	}	
9591
	// wildcard captures bound superclass and variable superclass
9592
	public void test0330() {
9593
		this.runConformTest(
9594
			new String[] {
9595
				"X.java",
9596
				"public class X<T extends Foo> {\n" + 
9597
				"	T element;\n" + 
9598
				"	X(T element) { \n" + 
9599
				"		this.element = element; \n" + 
9600
				"	}\n" + 
9601
				"	static void baz(X<? extends FooBar> x) {\n" + 
9602
				"		x.element.foo();\n" + 
9603
				"		x.element.bar();\n" + 
9604
				"	}\n" + 
9605
				"	public static void main(String[] args) {\n" + 
9606
				"		X<FooBar> x3 = new X<FooBar>(new FooBar());\n" + 
9607
				"		baz(x3);\n" + 
9608
				"	}\n" + 
9609
				"}\n" + 
9610
				"interface IBar {\n" + 
9611
				"	void bar();\n" + 
9612
				"}\n" + 
9613
				"class Foo {\n" + 
9614
				"	public void foo() {\n" + 
9615
				"		System.out.print(\"FOO\");\n" + 
9616
				"	}\n" + 
9617
				"}\n" + 
9618
				"class FooBar extends Foo implements IBar {\n" + 
9619
				"	public void bar() {\n" + 
9620
				"		System.out.print(\"BAR\");\n" + 
9621
				"	}\n" + 
9622
				"}\n",
9623
			},
9624
			"FOOBAR");
9625
	}		
9626
	// wildcard captures bound superclass and variable superclass
9627
	public void test0331() {
9628
		this.runConformTest(
9629
			new String[] {
9630
				"X.java",
9631
				"public class X<T extends Foo> {\n" + 
9632
				"	T element;\n" + 
9633
				"	X(T element) { \n" + 
9634
				"		this.element = element; \n" + 
9635
				"	}\n" + 
9636
				"	static void baz(X<? extends IBar> x) {\n" + 
9637
				"		x.element.foo();\n" + 
9638
				"		x.element.bar();\n" + 
9639
				"	}\n" + 
9640
				"	public static void main(String[] args) {\n" + 
9641
				"		X<FooBar> x3 = new X<FooBar>(new FooBar());\n" + 
9642
				"		baz(x3);\n" + 
9643
				"	}\n" + 
9644
				"}\n" + 
9645
				"interface IBar {\n" + 
9646
				"	void bar();\n" + 
9647
				"}\n" + 
9648
				"class Foo {\n" + 
9649
				"	public void foo() {\n" + 
9650
				"		System.out.print(\"FOO\");\n" + 
9651
				"	}\n" + 
9652
				"}\n" + 
9653
				"class FooBar extends Foo implements IBar {\n" + 
9654
				"	public void bar() {\n" + 
9655
				"		System.out.print(\"BAR\");\n" + 
9656
				"	}\n" + 
9657
				"}\n",
9658
			},
9659
			"FOOBAR");
9660
	}		
9661
	// wildcard considers bound superclass or variable superclass
9662
	public void test0332() {
9663
		this.runNegativeTest(
9664
			new String[] {
9665
				"X.java",
9666
				"public class X<T extends Foo> {\n" + 
9667
				"	T element;\n" + 
9668
				"	X(T element) { \n" + 
9669
				"		this.element = element; \n" + 
9670
				"	}\n" + 
9671
				"	static void baz(X<? extends IBar> x) {\n" + // captures Foo & IBar
9672
				"		x.element.foo();\n" + 
9673
				"		x.element.bar();\n" + 
9674
				"	}\n" + 
9675
				"	public static void main(String[] args) {\n" + 
9676
				"		baz(new X<FooBar>(new FooBar()));\n" + 
9677
				"		baz(new X<Bar>(new Bar()));\n" + 
9678
				"	}\n" + 
9679
				"}\n" + 
9680
				"interface IBar {\n" + 
9681
				"	void bar();\n" + 
9682
				"}\n" + 
9683
				"\n" + 
9684
				"class Bar implements IBar {\n" + 
9685
				"	public void bar() {\n" + 
9686
				"		System.out.print(\"BAR\");\n" + 
9687
				"	}\n" + 
9688
				"}\n" + 
9689
				"\n" + 
9690
				"class Foo {\n" + 
9691
				"	public void foo() {\n" + 
9692
				"		System.out.print(\"FOO\");\n" + 
9693
				"	}\n" + 
9694
				"}\n" + 
9695
				"\n" + 
9696
				"class FooBar extends Foo implements IBar {\n" + 
9697
				"	public void bar() {\n" + 
9698
				"		System.out.print(\"BAR\");\n" + 
9699
				"	}\n" + 
9700
				"}\n"	,
9701
			},
9702
		"----------\n" + 
9703
		"1. ERROR in X.java (at line 12)\n" + 
9704
		"	baz(new X<Bar>(new Bar()));\n" + 
9705
		"	          ^^^\n" + 
9706
		"Bound mismatch: The type Bar is not a valid substitute for the bounded parameter <T extends Foo> of the type X<T>\n" + 
9707
		"----------\n");
9708
	}
9709
	// receveir generic cast matches receiver type (not declaring class)
9710
	public void test0333() {
9711
		this.runConformTest(
9712
			new String[] {
9713
				"X.java",
9714
				"public class X<T> {\n" + 
9715
				"	T element;\n" + 
9716
				"	X(T element) { this.element = element; }\n" + 
9717
				"	T element() { return this.element; }\n" + 
9718
				"	public static void main(String[] args) {\n" + 
9719
				"		new X<XB>(new XB()).element().afoo();\n" + 
9720
				"	}\n" + 
9721
				"}\n" + 
9722
				"\n" + 
9723
				"class XA {\n" + 
9724
				"	void afoo() {\n" + 
9725
				"		System.out.println(\"SUCCESS\");\n" + 
9726
				"   }\n" + 
9727
				"}\n" + 
9728
				"class XB extends XA {\n" + 
9729
				"	void bfoo() {}\n" + 
9730
				"}\n"	,
9731
			},
9732
		"SUCCESS");
9733
	}
9734
	// check cannot allocate type parameters
9735
	public void test0334() {
9736
		this.runNegativeTest(
9737
			new String[] {
9738
				"X.java",
9739
				"public class X <E> {\n" + 
9740
				"  public X() {\n" + 
9741
				"  	new E();\n" + 
9742
				"  	new E() {\n" + 
9743
				"  		void perform() {\n" + 
9744
				"  			run();\n" + 
9745
				"  		}\n" + 
9746
				"  	}.perform();\n" + 
9747
				"  }\n" + 
9748
				"}\n",
9749
			},
9750
			"----------\n" + 
9751
			"1. ERROR in X.java (at line 3)\n" + 
9752
			"	new E();\n" + 
9753
			"	    ^\n" + 
9754
			"Cannot instantiate the type E\n" + 
9755
			"----------\n" + 
9756
			"2. ERROR in X.java (at line 4)\n" + 
9757
			"	new E() {\n" + 
9758
			"  		void perform() {\n" + 
9759
			"  			run();\n" + 
9760
			"  		}\n" + 
9761
			"  	}.perform();\n" + 
9762
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
9763
			"Cannot refer to the type parameter E as a supertype\n" + 
9764
			"----------\n");
9765
	}	
9766
	// variation - check cannot allocate type parameters
9767
	public void test0335() {
9768
		this.runNegativeTest(
9769
			new String[] {
9770
				"X.java",
9771
				"public class X <E extends String> {\n" + // firstBound is class, still cannot be instantiated
9772
				"  public X() {\n" + 
9773
				"  	new E();\n" + 
9774
				"  	new E() {\n" + 
9775
				"  		void perform() {\n" + 
9776
				"  			run();\n" + 
9777
				"  		}\n" + 
9778
				"  	}.perform();\n" + 
9779
				"  }\n" + 
9780
				"}\n",
9781
			},
9782
			"----------\n" + 
9783
			"1. WARNING in X.java (at line 1)\n" + 
9784
			"	public class X <E extends String> {\n" + 
9785
			"	                          ^^^^^^\n" + 
9786
			"The type parameter E should not be bounded by the final type String. Final types cannot be further extended\n" + 
9787
			"----------\n" + 
9788
			"2. ERROR in X.java (at line 3)\n" + 
9789
			"	new E();\n" + 
9790
			"	    ^\n" + 
9791
			"Cannot instantiate the type E\n" + 
9792
			"----------\n" + 
9793
			"3. ERROR in X.java (at line 4)\n" + 
9794
			"	new E() {\n" + 
9795
			"  		void perform() {\n" + 
9796
			"  			run();\n" + 
9797
			"  		}\n" + 
9798
			"  	}.perform();\n" + 
9799
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
9800
			"Cannot refer to the type parameter E as a supertype\n" + 
9801
			"----------\n");
9802
	}
9803
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74669
9804
	public void test0336() {
9805
		this.runNegativeTest(
9806
			new String[] {
9807
				"X.java",
9808
				"interface IMyInterface {\n" + 
9809
				"}\n" + 
9810
				"class MyClass <Type> {\n" + 
9811
				"\n" + 
9812
				"	public <Type> Type myMethod(Object obj, Class type) {\n" + 
9813
				"		return null;\n" + 
9814
				"	}\n" + 
9815
				"	public static <Type> Type myStaticMethod(Object obj, Class type) {\n" + 
9816
				"		return null;\n" + 
9817
				"	}\n" + 
9818
				"}\n" + 
9819
				"public class X {\n" + 
9820
				"    public IMyInterface getThis() {\n" + 
9821
				"		if (true)\n" + 
9822
				"			return new MyClass().myMethod(this, IMyInterface.class);\n" + 
9823
				"		else\n" + 
9824
				"			return MyClass.myStaticMethod(this, IMyInterface.class);\n" + 
9825
				"    }\n" + 
9826
				"}\n",
9827
			},
9828
			"----------\n" + 
9829
			"1. WARNING in X.java (at line 5)\n" + 
9830
			"	public <Type> Type myMethod(Object obj, Class type) {\n" + 
9831
			"	        ^^^^\n" + 
9832
			"The type parameter Type is hiding the type Type\n" + 
9833
			"----------\n" + 
9834
			"2. WARNING in X.java (at line 5)\n" + 
9835
			"	public <Type> Type myMethod(Object obj, Class type) {\n" + 
9836
			"	                                        ^^^^^\n" + 
9837
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
9838
			"----------\n" + 
9839
			"3. WARNING in X.java (at line 8)\n" + 
9840
			"	public static <Type> Type myStaticMethod(Object obj, Class type) {\n" + 
9841
			"	                                                     ^^^^^\n" + 
9842
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
9843
			"----------\n" + 
9844
			"4. ERROR in X.java (at line 15)\n" + 
9845
			"	return new MyClass().myMethod(this, IMyInterface.class);\n" + 
9846
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
9847
			"Type mismatch: cannot convert from Object to IMyInterface\n" + 
9848
			"----------\n" + 
9849
			"5. WARNING in X.java (at line 15)\n" + 
9850
			"	return new MyClass().myMethod(this, IMyInterface.class);\n" + 
9851
			"	           ^^^^^^^\n" + 
9852
			"MyClass is a raw type. References to generic type MyClass<Type> should be parameterized\n" + 
9853
			"----------\n");
9854
	}
9855
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77078
9856
	public void test0337() {
9857
		this.runConformTest(
9858
			new String[] {
9859
				"X.java",
9860
				"import java.util.Vector;\n" + 
9861
				"public class X {\n" + 
9862
				"    public void foo() {\n" + 
9863
				"        Vector<Object> objectVector = new Vector<Object>() {\n" + 
9864
				"            protected void bar() {\n" + 
9865
				"                baz(this); /* ERROR */\n" + 
9866
				"            }\n" + 
9867
				"        };\n" + 
9868
				"        baz(objectVector);\n" + 
9869
				"        baz(new Vector<Object>());\n" + 
9870
				"    }\n" + 
9871
				"    public void baz(Vector<?> mysteryVector) { }\n" + 
9872
				"}\n",
9873
			},
9874
			"");
9875
	}	
9876
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77052
9877
	public void test0338() {
9878
		this.runConformTest(
9879
			new String[] {
9880
				"X.java",
9881
				"interface M<X> { }\n" + 
9882
				"\n" + 
9883
				"class N<C> { \n" + 
9884
				"  M<N<C>> pni = null;\n" + 
9885
				"}\n" + 
9886
				"\n" + 
9887
				"public class X<I> {\n" + 
9888
				"  N<I> var1 = null;\n" + 
9889
				"\n" + 
9890
				"  M<N<I>> var2 = var1.pni;\n" + 
9891
				"  // Above line reports as error in Eclipse. \n" + 
9892
				"  // \"var2\" is underlined and the error message is: \n" + 
9893
				"  // Type mismatch: cannot convert from M<N<C>> to M<N<I>>\n" + 
9894
				"}\n",
9895
			},
9896
			"");
9897
	}
9898
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77052 - variation
9899
	public void test0339() {
9900
		this.runConformTest(
9901
			new String[] {
9902
				"X.java",
9903
				"import java.util.Iterator;\n" + 
9904
				"import java.util.Set;\n" + 
9905
				"\n" + 
9906
				"class X <K, V> {\n" + 
9907
				"	static class Entry<K, V> {}\n" + 
9908
				"	void foo() {\n" + 
9909
				"		Iterator<Entry<K,V>> i = entrySet().iterator();\n" + 
9910
				"	}\n" + 
9911
				"	Set<Entry<K,V>> entrySet()	 { return null; }\n" + 
9912
				"}\n",
9913
			},
9914
			"");
9915
	}		
9916
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76313
9917
	public void test0340() {
9918
		this.runConformTest(
9919
			new String[] {
9920
				"X.java",
9921
				"public class X<T> {\n" + 
9922
				"	private T data;\n" + 
9923
				"	private X(T data){ this.data=data; }\n" + 
9924
				"	public static <S> X<S> createObject(S data){\n" + 
9925
				"		System.out.println(data);\n" + 
9926
				"		return new X<S>(data);\n" + 
9927
				"	}\n" + 
9928
				"	public static void main(String[] args) {\n" + 
9929
				"		X<String> res=X.createObject(\"Hallo\");\n" + 
9930
				"	}\n" + 
9931
				"}\n",
9932
			},
9933
			"Hallo");
9934
	}
9935
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77118
9936
	public void test0341() {
9937
		this.runConformTest(
9938
			new String[] {
9939
				"X.java",
9940
				"public class X {\n" + 
9941
				"	public Object getItem() { return null; }\n" + 
9942
				"}\n",
9943
				"Y.java",
9944
				"public class Y extends X {\n" + 
9945
				"	public String getItem() { return null; }\n" + 
9946
				"}\n",
9947
				"Z.java",
9948
				"public class Z extends X {\n" + 
9949
				"	public Comparable getItem() { return null; }\n" + 
9950
				"}\n",
9951
			},
9952
			"");
9953
	}
9954
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77142 - check no raw unsafe warning is issued when accessing generic method from raw type
9955
	public void test0342() {
9956
		this.runNegativeTest(
9957
			new String[] {
9958
				"Test.java",
9959
				"class MyClass<T> {\n" + 
9960
				"		 \n" + 
9961
				"		 private T thing;\n" + 
9962
				"       { Zork z; }\n" +
9963
				"		 \n" + 
9964
				"		 public\n" + 
9965
				"		 MyClass(T thing) {\n" + 
9966
				"		 		 this.thing = thing;\n" + 
9967
				"		 }\n" + 
9968
				"		 \n" + 
9969
				"		 public static <U> MyClass<U>\n" + 
9970
				"		 factoryMakeMyClass(U thing)		 {\n" + 
9971
				"		 		 return new MyClass<U>(thing);\n" + 
9972
				"		 }\n" + 
9973
				"}\n" + 
9974
				"\n" + 
9975
				"class External {\n" + 
9976
				"\n" + 
9977
				"		 public static <U> MyClass<U>\n" + 
9978
				"		 factoryMakeMyClass(U thing)		 {\n" + 
9979
				"		 		 return new MyClass<U>(thing);\n" + 
9980
				"		 }\n" + 
9981
				"}\n" + 
9982
				"\n" + 
9983
				"public class Test {\n" + 
9984
				"		 public static void\n" + 
9985
				"		 test()\n" + 
9986
				"		 {\n" + 
9987
				"		 		 // No problem with this line:\n" + 
9988
				"		 		 MyClass<String> foo = External.factoryMakeMyClass(\"hi\");\n" + 
9989
				"		 		 \n" + 
9990
				"		 		 // This line gives me an error:\n" + 
9991
				"		 		 // Type mismatch: cannot convert from MyClass<Object> to MyClass<String>\n" + 
9992
				"		 		 MyClass<String> bar = MyClass.factoryMakeMyClass(\"hi\");\n" + 
9993
				"		 		 MyClass<String> bar2 = MyClass.<String>factoryMakeMyClass(\"hi\");\n" + 
9994
				"		 }\n" + 
9995
				"}\n",
9996
			},
9997
			"----------\n" + 
9998
			"1. ERROR in Test.java (at line 4)\n" + 
9999
			"	{ Zork z; }\n" + 
10000
			"	  ^^^^\n" + 
10001
			"Zork cannot be resolved to a type\n" + 
10002
			"----------\n");
10003
	}
10004
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74588
10005
	public void test0343() {
10006
		this.runConformTest(
10007
			new String[] {
10008
				"X.java",
10009
				"public class X<T extends Number> {\n" + 
10010
				"    T m;\n" + 
10011
				"\n" + 
10012
				"    class Y<T> {\n" + 
10013
				"        void test() {\n" + 
10014
				"            new Y<Integer>() {\n" + 
10015
				"                void test() {\n" + 
10016
				"                    System.out.println(X.this.m);\n" + 
10017
				"                }\n" + 
10018
				"            }.test();\n" + 
10019
				"        }\n" + 
10020
				"    }\n" + 
10021
				"}\n" + 
10022
				"\n",
10023
			},
10024
			"");
10025
	}
10026
	// checking scenario where generic type and method share the same type parameter name
10027
	public void test0344() {
10028
		this.runNegativeTest(
10029
			new String[] {	
10030
				"X.java",
10031
				"import java.io.IOException;\n" + 
10032
				"\n" + 
10033
				"public abstract class X<T extends Runnable> {\n" + 
10034
				"	\n" + 
10035
				"	public abstract <T extends Exception> T bar(T t);\n" + 
10036
				"\n" + 
10037
				"	static void foo(X x) {\n" + 
10038
				"		x.<Exception>bar(null);\n" + 
10039
				"		\n" + 
10040
				"		class R implements Runnable {\n" + 
10041
				"			public void run() {\n" + 
10042
				"			}\n" + 
10043
				"		}\n" + 
10044
				"		X<R> xr = new X<R>(){  \n" + 
10045
				"			public <T> T bar(T t) { \n" + 
10046
				"				return t; \n" + 
10047
				"			}\n" + 
10048
				"		};\n" + 
10049
				"		IOException e = xr.bar(new IOException());\n" + 
10050
				"	}\n" + 
10051
				"}\n"		
10052
			},
10053
			"----------\n" + 
10054
			"1. WARNING in X.java (at line 5)\n" + 
10055
			"	public abstract <T extends Exception> T bar(T t);\n" + 
10056
			"	                 ^\n" + 
10057
			"The type parameter T is hiding the type T\n" + 
10058
			"----------\n" + 
10059
			"2. WARNING in X.java (at line 7)\n" + 
10060
			"	static void foo(X x) {\n" + 
10061
			"	                ^\n" + 
10062
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
10063
			"----------\n" + 
10064
			"3. ERROR in X.java (at line 8)\n" + 
10065
			"	x.<Exception>bar(null);\n" + 
10066
			"	             ^^^\n" + 
10067
			"The method bar(Exception) of raw type X is no longer generic; it cannot be parameterized with arguments <Exception>\n" + 
10068
			"----------\n" + 
10069
			"4. ERROR in X.java (at line 14)\n" + 
10070
			"	X<R> xr = new X<R>(){  \n" + 
10071
			"	              ^^^^^^\n" + 
10072
			"The type new X<R>(){} must implement the inherited abstract method X<R>.bar(T)\n" + 
10073
			"----------\n");
10074
	}
10075
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74594
10076
	public void test0345() {
10077
		this.runConformTest(
10078
			new String[] {
10079
				"X.java",
10080
				"public class X {\n" + 
10081
				"    public static void main(String argv[]) {\n" + 
10082
				"       X1<Integer> o1 = new X1<Integer>();\n" + 
10083
				"        ((J<Integer>)o1).get();\n" + 
10084
				"    }\n" + 
10085
				"}\n" + 
10086
				"\n" + 
10087
				"class X1<T> implements I<T> {\n" + 
10088
				"    public X1 get() {\n" + 
10089
				"    	System.out.println(\"SUCCESS\");\n" + 
10090
				"        return this;\n" + 
10091
				"    }\n" + 
10092
				"}\n" + 
10093
				"\n" + 
10094
				"interface I<T> extends J<T> {\n" + 
10095
				"    I get();\n" + 
10096
				"}\n" + 
10097
				"\n" + 
10098
				"interface J<T>  {\n" + 
10099
				"    J get();\n" + 
10100
				"}",
10101
			},
10102
			"SUCCESS");
10103
	}	
10104
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74594
10105
	public void test0346() {
10106
		this.runConformTest(
10107
			new String[] {
10108
				"X.java",
10109
				"public class X {\n" + 
10110
				"    public static void main(String argv[]) {\n" + 
10111
				"       X1<Integer> o1 = new X1<Integer>(new Integer(4));\n" + 
10112
				"        System.out.println(o1.get().t);\n" + 
10113
				"    }\n" + 
10114
				"}\n" + 
10115
				"\n" + 
10116
				"class X1<T> implements I<T> {\n" + 
10117
				"    T t;\n" + 
10118
				"    X1(T arg) {\n" + 
10119
				"        t = arg;\n" + 
10120
				"    }\n" + 
10121
				"    public X1 get() {\n" + 
10122
				"        return this;\n" + 
10123
				"    }\n" + 
10124
				"}\n" + 
10125
				"\n" + 
10126
				"interface I<T> extends J<T> {\n" + 
10127
				"    I get();\n" + 
10128
				"}\n" + 
10129
				"\n" + 
10130
				"interface J<T>  {\n" + 
10131
				"    J get();\n" + 
10132
				"}"
10133
	,
10134
			},
10135
			"4");
10136
	}	
10137
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74594
10138
	public void test0347() {
10139
		this.runConformTest(
10140
			new String[] {
10141
				"X.java",
10142
				"public class X {\n" + 
10143
				"    public static void main(String argv[]) {\n" + 
10144
				"        X1<Integer> o = new X1<Integer>(new Integer(4));\n" + 
10145
				"        System.out.println(o.get().t);\n" + 
10146
				"    }\n" + 
10147
				"}\n" + 
10148
				"\n" + 
10149
				"class X1<T> implements I<T> {\n" + 
10150
				"    T t;\n" + 
10151
				"    X1(T arg) {\n" + 
10152
				"        t = arg;\n" + 
10153
				"    }\n" + 
10154
				"    public X1 get() {\n" + 
10155
				"        return this;\n" + 
10156
				"    }\n" + 
10157
				"}    \n" + 
10158
				"\n" + 
10159
				"interface I<T> extends K<T>, L<T> {\n" + 
10160
				"    I get();\n" + 
10161
				"}\n" + 
10162
				"\n" + 
10163
				"interface J<T>  {\n" + 
10164
				"    J get();\n" + 
10165
				"}\n" + 
10166
				"\n" + 
10167
				"interface K<T> extends J<T> {\n" + 
10168
				"}\n" + 
10169
				"\n" + 
10170
				"interface L<T>  {\n" + 
10171
				"    K get();\n" + 
10172
				"}",
10173
			},
10174
			"4");
10175
	}	
10176
	// checking scenario where generic type and method share the same type parameter name
10177
	// **
10178
	public void test0348() {
10179
		this.runNegativeTest(
10180
			new String[] {	
10181
				"X.java",
10182
				"import java.io.IOException;\n" + 
10183
				"public abstract class X<T extends Runnable> {\n" + 
10184
				"	public abstract <T extends Exception> T bar(T t);\n" + 
10185
				"	static void foo(X x) {\n" + 
10186
				"		x.<Exception>bar(null);\n" + 
10187
				"		class R implements Runnable {\n" + 
10188
				"			public void run() {}\n" + 
10189
				"		}\n" + 
10190
				"		X<R> xr = new X<R>(){  \n" + 
10191
				"			public <T extends Exception> T bar(T t) { return t; }\n" + 
10192
				"		};\n" + 
10193
				"		IOException e = xr.bar(new IOException());\n" + 
10194
				"	}\n" + 
10195
				"}\n"		
10196
			},
10197
			"----------\n" + 
10198
			"1. WARNING in X.java (at line 3)\n" + 
10199
			"	public abstract <T extends Exception> T bar(T t);\n" + 
10200
			"	                 ^\n" + 
10201
			"The type parameter T is hiding the type T\n" + 
10202
			"----------\n" + 
10203
			"2. WARNING in X.java (at line 4)\n" + 
10204
			"	static void foo(X x) {\n" + 
10205
			"	                ^\n" + 
10206
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
10207
			"----------\n" + 
10208
			"3. ERROR in X.java (at line 5)\n" + 
10209
			"	x.<Exception>bar(null);\n" + 
10210
			"	             ^^^\n" + 
10211
			"The method bar(Exception) of raw type X is no longer generic; it cannot be parameterized with arguments <Exception>\n" + 
10212
			"----------\n" + 
10213
			"4. WARNING in X.java (at line 10)\n" + 
10214
			"	public <T extends Exception> T bar(T t) { return t; }\n" + 
10215
			"	                               ^^^^^^^^\n" + 
10216
			"The method bar(T) of type new X<R>(){} should be tagged with @Override since it actually overrides a superclass method\n" + 
10217
			"----------\n");
10218
	}	
10219
	// test wildcard compatibilities
10220
	public void test0349() {
10221
		this.runConformTest(
10222
			new String[] {
10223
				"X.java",
10224
				"public class X<T> {\n" + 
10225
				"	T element;\n" + 
10226
				"	static void foo(X<? super Exception> out, X1<? extends Exception> in) {\n" + 
10227
				"		out.element = in.element;\n" + 
10228
				"	}\n" + 
10229
				"	public static void main(String[] args) {\n" + 
10230
				"		System.out.println(\"SUCCESS\");\n" + 
10231
				"	}\n" + 				
10232
				"}\n" + 
10233
				"class X1<U>{\n" + 
10234
				"	U element;\n" + 
10235
				"}\n",
10236
			},
10237
			"SUCCESS");
10238
	}
10239
	// test wildcard compatibilities
10240
	public void test0350() {
10241
		this.runNegativeTest(
10242
			new String[] {
10243
				"X.java",
10244
				"public class X<T> {\n" + 
10245
				"	T element;\n" + 
10246
				"	static void foo(X<?> out, X1<?> in) {\n" + 
10247
				"		out.element = in.element;\n" + 
10248
				"	}\n" + 
10249
				"}\n" + 
10250
				"class X1<U>{\n" + 
10251
				"	U element;\n" + 
10252
				"}\n",
10253
			},
10254
			"----------\n" + 
10255
			"1. ERROR in X.java (at line 4)\n" + 
10256
			"	out.element = in.element;\n" + 
10257
			"	              ^^^^^^^^^^\n" + 
10258
			"Type mismatch: cannot convert from capture#2-of ? to capture#1-of ?\n" + 
10259
			"----------\n");
10260
	}
10261
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75328
10262
	public void test0351() {
10263
		this.runConformTest(
10264
			new String[] {
10265
				"X.java",
10266
				"interface Intf<D extends Comparable<D>, I extends Comparable<D>> { \n" + 
10267
				"  public void f(Intf<D,?> val);\n" + 
10268
				"}\n" + 
10269
				"\n" + 
10270
				"public class X <M extends Comparable<M>, P extends Comparable<M>>  implements Intf<M,P> {\n" + 
10271
				"\n" + 
10272
				"  public void f(Intf<M,?> val) { } \n" + 
10273
				"}\n",
10274
			},
10275
			"");
10276
	}	
10277
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77051
10278
	public void test0352() {
10279
		this.runConformTest(
10280
			new String[] {
10281
				"X.java",
10282
				"interface C<A> { }\n" + 
10283
				"interface PC<X> extends C<X> { } \n" + 
10284
				"interface PO<Y>  {  \n" + 
10285
				"	  C<Y> proc1();\n" + 
10286
				"	  C<? super Y> proc2();\n" + 
10287
				"	  C<? extends Y> proc3();\n" + 
10288
				"}\n" + 
10289
				"abstract class X<Z> implements PO<Z> {\n" + 
10290
				"	  public C<Z> proc1() { return result1; }\n" + 
10291
				"	  private final PC<Z> result1 = null;\n" + 
10292
				"	  public C<? super Z> proc2() { return result2; }\n" + 
10293
				"	  private final PC<? super Z> result2 = null;\n" + 
10294
				"	  public C<? extends Z> proc3() { return result3; }\n" + 
10295
				"	  private final PC<? extends Z> result3 = null;\n" + 
10296
				"}\n",
10297
			},
10298
			"");
10299
	}		
10300
	public void test0353() {
10301
		this.runConformTest(
10302
			new String[] {
10303
				"X.java",
10304
				"public class X extends Y {\n" + 
10305
				"	<T> T foo(Class<T> c) { return null; }\n" +
10306
				"}\n" + 
10307
				"class Y {\n" + 
10308
				"	<T> T foo(Class<T> c) { return null; }\n" +
10309
				"}"
10310
			},
10311
			"");	
10312
	}		
10313
	public void test0354() {
10314
		this.runConformTest(
10315
			new String[] {
10316
				"X.java",
10317
				"public class X extends Y {\n" + 
10318
				"	<T, S> S foo(Class<T> c) { return null; }\n" +
10319
				"}\n" + 
10320
				"class Y {\n" + 
10321
				"	<S, T> T foo(Class<S> c) { return null; }\n" +
10322
				"}"
10323
			},
10324
			"");
10325
	}		
10326
	public void test0355() {
10327
		this.runNegativeTest(
10328
			new String[] {
10329
				"X.java",
10330
				"public class X extends Y {\n" + 
10331
				"	<T, S> S foo(Class<S> c) { return null; }\n" +
10332
				"}\n" + 
10333
				"class Y {\n" + 
10334
				"	<S, T> S foo(Class<S> c) { return null; }\n" +
10335
				"}"
10336
			},
10337
			"----------\n" + 
10338
			"1. ERROR in X.java (at line 2)\n" + 
10339
			"	<T, S> S foo(Class<S> c) { return null; }\n" + 
10340
			"	         ^^^^^^^^^^^^^^^\n" + 
10341
			"Name clash: The method foo(Class<S>) of type X has the same erasure as foo(Class<S>) of type Y but does not override it\n" + 
10342
			"----------\n");
10343
	}		
10344
	public void test0356() {
10345
		this.runNegativeTest(
10346
			new String[] {
10347
				"X.java",
10348
				"public class X extends Y {\n" + 
10349
				"	<T, S> T foo(Class<T> c) { return null; }\n" +
10350
				"}\n" + 
10351
				"class Y {\n" + 
10352
				"	<T> T foo(Class<T> c) { return null; }\n" +
10353
				"}"
10354
			},
10355
			"----------\n" + 
10356
			"1. ERROR in X.java (at line 2)\n" + 
10357
			"	<T, S> T foo(Class<T> c) { return null; }\n" + 
10358
			"	         ^^^^^^^^^^^^^^^\n" + 
10359
			"Name clash: The method foo(Class<T>) of type X has the same erasure as foo(Class<T>) of type Y but does not override it\n" + 
10360
			"----------\n");
10361
	}		
10362
	public void test0357() {
10363
		this.runNegativeTest(
10364
			new String[] {
10365
				"X.java",
10366
				"public class X extends Y {\n" + 
10367
				"	<T> T foo(Class<T> c) { return null; }\n" +
10368
				"}\n" + 
10369
				"class Y {\n" + 
10370
				"	<T, S> T foo(Class<T> c) { return null; }\n" +
10371
				"}"
10372
			},
10373
			"----------\n" + 
10374
			"1. ERROR in X.java (at line 2)\n" + 
10375
			"	<T> T foo(Class<T> c) { return null; }\n" + 
10376
			"	      ^^^^^^^^^^^^^^^\n" + 
10377
			"Name clash: The method foo(Class<T>) of type X has the same erasure as foo(Class<T>) of type Y but does not override it\n" + 
10378
			"----------\n");
10379
	}
10380
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76720
10381
	public void test0358() {
10382
		this.runConformTest(
10383
			new String[] {
10384
				"MyClass.java",
10385
				"public class MyClass {}\n",
10386
				"A.java",
10387
				"public interface A<M extends MyClass> {}\n",
10388
				"B.java",
10389
				"public interface B<M extends MyClass> extends A<M> {}\n",
10390
				"C.java",
10391
				"public class C implements B<MyClass> {}\n", // compile against sources
10392
				"D.java",
10393
				"public class D implements A<MyClass>{}\n", // compile against sources
10394
			},
10395
			"");
10396
		// compile against generated binaries
10397
		this.runConformTest(
10398
			new String[] {
10399
				"C.java",
10400
				"public class C implements B<MyClass> {}\n",
10401
				"D.java",
10402
				"public class D implements A<MyClass>{}\n",
10403
			},
10404
			"",
10405
			null,
10406
			false,
10407
			null);
10408
	}
10409
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76790
10410
	public void test0359() {
10411
		this.runConformTest(
10412
			new String[] {
10413
				"X.java",
10414
				"import java.util.*;\n" + 
10415
					"public class X {\n" + 
10416
					"    class List1<E> extends LinkedList<E> {};\n" + 
10417
					"    public static void main (String[] args) {\n" + 
10418
					"        Map<String, List<Integer>> x = new HashMap<String, List<Integer>>();\n" + 
10419
					"        Map<String, List1<Integer>> m = new HashMap<String, List1<Integer>>();\n" + 
10420
					"    }\n" + 
10421
					"}"
10422
			}
10423
		);
10424
	}
10425
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76786
10426
	public void test0360() {
10427
		this.runConformTest(
10428
			new String[] {
10429
				"Test.java",
10430
				"import java.lang.Comparable;\n" + 
10431
					"public class Test {\n" + 
10432
					"    private static final class X<T1, T2> implements Comparable<X<T1, T2>> {\n" + 
10433
					"        public int compareTo(X<T1, T2> arg0) { return 0; }\n" + 
10434
					"    };\n" + 
10435
					"    private static class Y<T1, T2> {};\n" + 
10436
					"    private static final class Z<T1, T2> extends Y<T1, T2> implements Comparable<Z<T1, T2>> {\n" + 
10437
					"        public int compareTo(Z<T1, T2> arg0) { return 0; }\n" + 
10438
					"    };\n" + 
10439
					"    public static <T> void doSomething(Comparable<? super T> a, Comparable<? super T> b) {}\n" + 
10440
					"    public static <V1, V2> void doSomethingElse(Z<V1, V2> a, Z<V1, V2> b) {\n" + 
10441
					"        doSomething(a, b);\n" + 
10442
					"    }\n" + 
10443
					"    private static final class W { };\n" + 
10444
					"    public static void main(String[] args) {\n" + 
10445
					"        doSomething(new X<Integer, String>(), new X<Integer, String>());\n" + 
10446
					"        doSomething(new Z<Integer, String>(), new Z<Integer, String>());\n" + 
10447
					"        doSomethingElse(new Z<Integer, String>(), new Z<Integer, String>());\n" + 
10448
					"        doSomethingElse(new Z<W, String>(), new Z<W, String>());\n" + 
10449
					"        // The next line won\'t compile.  It\'s the generic<generic which seems\n" + 
10450
					"        // to be the problem\n" + 
10451
					"        doSomethingElse(new Z<X<W, W>, String>(), new Z<X<W, W>, String>());\n" + 
10452
					"    }\n" + 
10453
					"}"
10454
			}
10455
		);
10456
	}
10457
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=75525
10458
	public void test0361() {
10459
		this.runConformTest(
10460
			new String[] {
10461
				"Test.java",
10462
				"import java.util.AbstractSet;\n" + 
10463
					"import java.util.Iterator;\n" + 
10464
					"import java.util.Map.Entry;\n" + 
10465
					"public class Test extends AbstractSet<Entry<String,Integer>> {\n" + 
10466
					"	public Iterator<Entry<String, Integer>> iterator() {\n" + 
10467
					"		return new Iterator<Entry<String,Integer>>() {\n" + 
10468
					"			public boolean hasNext() {return false;}\n" + 
10469
					"			public Entry<String, Integer> next() {return null;}\n" + 
10470
					"			public void remove() {}	\n" + 
10471
					"		};\n" + 
10472
					"	}\n" + 
10473
					"	public int size() {return 0;}\n" + 
10474
					"}"
10475
			}
10476
		);
10477
	}
10478
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=72643
10479
	public void test0362() {
10480
		Map customOptions= getCompilerOptions();
10481
		customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10482
		this.runConformTest(
10483
			new String[] {
10484
				"Test.java",
10485
				"import java.util.ArrayList;\n" + 
10486
					"import java.util.List;\n" + 
10487
					"public class Test {\n" + 
10488
					"   public void a() {\n" + 
10489
					"      List<String> list1 = new ArrayList<String>();\n" + 
10490
					"      List<String> list2 = new ArrayList<String>();\n" + 
10491
					"      compare(list1, list2);\n" + 
10492
					"   }\n" + 
10493
					"   private <E> void compare(List<E> list1, List<E> list2) {\n" + 
10494
					"      // do some comparing logic...\n" + 
10495
					"   }\n" + 
10496
					"}\n" + 
10497
					"\n"
10498
			},
10499
		"",
10500
		null,
10501
		true,
10502
		null,
10503
		customOptions,
10504
		null/*no custom requestor*/);
10505
	}
10506
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76434
10507
	public void test0363() {
10508
		this.runNegativeTest(
10509
			new String[] {
10510
				"X.java",
10511
				"import java.util.Map;\n" + 
10512
				"import java.util.Set;\n" + 
10513
				"public class X {\n" + 
10514
				"  Set<Map.Entry<Integer, ?>> m_values;\n" + 
10515
				"  X(Map<Integer, ?> values) {\n" + 
10516
				"    m_values = values.entrySet();\n" + 
10517
				"  }\n" + 
10518
				"}\n"
10519
			},
10520
			"----------\n" + 
10521
			"1. ERROR in X.java (at line 6)\n" + 
10522
			"	m_values = values.entrySet();\n" + 
10523
			"	           ^^^^^^^^^^^^^^^^^\n" + 
10524
			"Type mismatch: cannot convert from Set<Map.Entry<Integer,capture#1-of ?>> to Set<Map.Entry<Integer,?>>\n" + 
10525
			"----------\n");
10526
	}	
10527
	// check param type equivalences
10528
	public void test0364() {
10529
		this.runNegativeTest(
10530
			new String[] {
10531
				"X.java",
10532
				"public class X { \n" + 
10533
				"	\n" + 
10534
				"	void bar1(MX<Class<? extends String>> mxcs, MX<Class<? extends Object>> mxco) {\n" + 
10535
				"		mxco = mxcs;\n" + // wrong
10536
				"	}\n" + 
10537
				"	void bar1(Class<? extends String> cs, Class<? extends Object> co) {\n" + 
10538
				"		co = cs;\n" + // ok
10539
				"	}\n" + 
10540
				"	\n" + 
10541
				"}\n" + 
10542
				"class MX<E> {\n" + 
10543
				"}\n"
10544
			},
10545
			"----------\n" + 
10546
			"1. ERROR in X.java (at line 4)\n" + 
10547
			"	mxco = mxcs;\n" + 
10548
			"	       ^^^^\n" + 
10549
			"Type mismatch: cannot convert from MX<Class<? extends String>> to MX<Class<? extends Object>>\n" + 
10550
			"----------\n");
10551
	}		
10552
	// check param type equivalences
10553
	public void test0365() {
10554
		this.runNegativeTest(
10555
			new String[] {
10556
				"X.java",
10557
				"public class X<T extends Runnable> {\n" + 
10558
				"	\n" + 
10559
				"	class MX <U> {\n" + 
10560
				"	}\n" + 
10561
				"	\n" + 
10562
				"	MX<T> createMX() { return new MX<T>(); }\n" + 
10563
				"\n" + 
10564
				"	void foo(X<?> x, MX<?> mx) {\n" + 
10565
				"		mx = x.createMX();\n" + 
10566
				"	}\n" + 
10567
				"}\n"
10568
			},
10569
			"----------\n" + 
10570
			"1. ERROR in X.java (at line 9)\n" + 
10571
			"	mx = x.createMX();\n" + 
10572
			"	     ^^^^^^^^^^^^\n" + 
10573
			"Type mismatch: cannot convert from X<capture#2-of ?>.MX<capture#2-of ?> to X<T>.MX<?>\n" + 
10574
			"----------\n");
10575
	}		
10576
	// check param type equivalences
10577
	public void test0366() {
10578
		this.runNegativeTest(
10579
			new String[] {
10580
				"X.java",
10581
				"public class X { \n" + 
10582
				"	\n" + 
10583
				"	void foo1(MX<Class<? extends Object>> target, MX<Class> value) {\n" + 
10584
				"		target= value; // foo1 - wrong\n" + 
10585
				"	}\n" + 
10586
				"	void foo2(MX<Class<? extends Object>> target, MX<Class<? extends String>> value) {\n" + 
10587
				"		target= value; // foo2 - wrong\n" + 
10588
				"	}\n" + 
10589
				"	void foo3(MX<Class<? extends Object>> target, MX<Class<? extends String>> value) {\n" + 
10590
				"		target= value; // foo3 - wrong\n" + 
10591
				"	}\n" + 
10592
				"	void foo4(MX<Class<? extends Object>> target, MX<Class<String>> value) {\n" + 
10593
				"		target= value; // foo4 - wrong\n" + 
10594
				"	}\n" + 
10595
				"	void foo5(MX<? extends Class> target, MX<Class> value) {\n" + 
10596
				"		target= value; // foo5\n" + 
10597
				"	}\n" + 
10598
				"	void foo6(MX<? super Class> target, MX<Class> value) {\n" + 
10599
				"		target= value; // foo6\n" + 
10600
				"	}\n" + 
10601
				"	void foo7(MX<Class<? extends Class>> target, MX<Class<Class>> value) {\n" + 
10602
				"		target= value; // foo7 - wrong\n" + 
10603
				"	}\n" + 
10604
				"	void foo8(MX<MX<? extends Class>> target, MX<MX<Class>> value) {\n" + 
10605
				"		target= value; // foo8 - wrong\n" + 
10606
				"	}\n" + 
10607
				"	void foo9(MX<? extends Object> target, MX<? extends String> value) {\n" + 
10608
				"		target= value; // foo9\n" + 
10609
				"	}\n" + 
10610
				"	void foo10(MX<? extends String> target, MX<? extends Object> value) {\n" + 
10611
				"		target= value; // foo10 - wrong\n" + 
10612
				"	}\n" + 
10613
				"	void foo11(MX<? super Object> target, MX<? super String> value) {\n" + 
10614
				"		target= value; // foo11 - wrong\n" + 
10615
				"	}\n" + 
10616
				"	void foo12(MX<? super String> target, MX<? super Object> value) {\n" + 
10617
				"		target= value; // foo12\n" + 
10618
				"	}\n" + 
10619
				"}\n" + 
10620
				"\n" + 
10621
				"class MX<E> {\n" + 
10622
				"}\n"
10623
			},
10624
			"----------\n" + 
10625
			"1. WARNING in X.java (at line 3)\n" + 
10626
			"	void foo1(MX<Class<? extends Object>> target, MX<Class> value) {\n" + 
10627
			"	                                                 ^^^^^\n" + 
10628
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10629
			"----------\n" + 
10630
			"2. ERROR in X.java (at line 4)\n" + 
10631
			"	target= value; // foo1 - wrong\n" + 
10632
			"	        ^^^^^\n" + 
10633
			"Type mismatch: cannot convert from MX<Class> to MX<Class<? extends Object>>\n" + 
10634
			"----------\n" + 
10635
			"3. ERROR in X.java (at line 7)\n" + 
10636
			"	target= value; // foo2 - wrong\n" + 
10637
			"	        ^^^^^\n" + 
10638
			"Type mismatch: cannot convert from MX<Class<? extends String>> to MX<Class<? extends Object>>\n" + 
10639
			"----------\n" + 
10640
			"4. ERROR in X.java (at line 10)\n" + 
10641
			"	target= value; // foo3 - wrong\n" + 
10642
			"	        ^^^^^\n" + 
10643
			"Type mismatch: cannot convert from MX<Class<? extends String>> to MX<Class<? extends Object>>\n" + 
10644
			"----------\n" + 
10645
			"5. ERROR in X.java (at line 13)\n" + 
10646
			"	target= value; // foo4 - wrong\n" + 
10647
			"	        ^^^^^\n" + 
10648
			"Type mismatch: cannot convert from MX<Class<String>> to MX<Class<? extends Object>>\n" + 
10649
			"----------\n" + 
10650
			"6. WARNING in X.java (at line 15)\n" + 
10651
			"	void foo5(MX<? extends Class> target, MX<Class> value) {\n" + 
10652
			"	                       ^^^^^\n" + 
10653
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10654
			"----------\n" + 
10655
			"7. WARNING in X.java (at line 15)\n" + 
10656
			"	void foo5(MX<? extends Class> target, MX<Class> value) {\n" + 
10657
			"	                                         ^^^^^\n" + 
10658
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10659
			"----------\n" + 
10660
			"8. WARNING in X.java (at line 18)\n" + 
10661
			"	void foo6(MX<? super Class> target, MX<Class> value) {\n" + 
10662
			"	                     ^^^^^\n" + 
10663
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10664
			"----------\n" + 
10665
			"9. WARNING in X.java (at line 18)\n" + 
10666
			"	void foo6(MX<? super Class> target, MX<Class> value) {\n" + 
10667
			"	                                       ^^^^^\n" + 
10668
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10669
			"----------\n" + 
10670
			"10. WARNING in X.java (at line 21)\n" + 
10671
			"	void foo7(MX<Class<? extends Class>> target, MX<Class<Class>> value) {\n" + 
10672
			"	                             ^^^^^\n" + 
10673
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10674
			"----------\n" + 
10675
			"11. WARNING in X.java (at line 21)\n" + 
10676
			"	void foo7(MX<Class<? extends Class>> target, MX<Class<Class>> value) {\n" + 
10677
			"	                                                      ^^^^^\n" + 
10678
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10679
			"----------\n" + 
10680
			"12. ERROR in X.java (at line 22)\n" + 
10681
			"	target= value; // foo7 - wrong\n" + 
10682
			"	        ^^^^^\n" + 
10683
			"Type mismatch: cannot convert from MX<Class<Class>> to MX<Class<? extends Class>>\n" + 
10684
			"----------\n" + 
10685
			"13. WARNING in X.java (at line 24)\n" + 
10686
			"	void foo8(MX<MX<? extends Class>> target, MX<MX<Class>> value) {\n" + 
10687
			"	                          ^^^^^\n" + 
10688
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10689
			"----------\n" + 
10690
			"14. WARNING in X.java (at line 24)\n" + 
10691
			"	void foo8(MX<MX<? extends Class>> target, MX<MX<Class>> value) {\n" + 
10692
			"	                                                ^^^^^\n" + 
10693
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
10694
			"----------\n" + 
10695
			"15. ERROR in X.java (at line 25)\n" + 
10696
			"	target= value; // foo8 - wrong\n" + 
10697
			"	        ^^^^^\n" + 
10698
			"Type mismatch: cannot convert from MX<MX<Class>> to MX<MX<? extends Class>>\n" + 
10699
			"----------\n" + 
10700
			"16. ERROR in X.java (at line 31)\n" + 
10701
			"	target= value; // foo10 - wrong\n" + 
10702
			"	        ^^^^^\n" + 
10703
			"Type mismatch: cannot convert from MX<capture#6-of ? extends Object> to MX<? extends String>\n" + 
10704
			"----------\n" + 
10705
			"17. ERROR in X.java (at line 34)\n" + 
10706
			"	target= value; // foo11 - wrong\n" + 
10707
			"	        ^^^^^\n" + 
10708
			"Type mismatch: cannot convert from MX<capture#8-of ? super String> to MX<? super Object>\n" + 
10709
			"----------\n");
10710
	}		
10711
	// check param type equivalences
10712
	public void test0367() {
10713
		this.runNegativeTest(
10714
			new String[] {
10715
				"X.java",	
10716
				"public class X { \n" + 
10717
				"	\n" + 
10718
				"	void foo1(MX<? extends MX> target, MX<MX<String>> value) {\n" + 
10719
				"		target= value; // foo1\n" + 
10720
				"	}\n" + 
10721
				"	void foo2(MX<?> target, MX<MX<String>> value) {\n" + 
10722
				"		target= value; // foo2\n" + 
10723
				"	}\n" + 
10724
				"	void foo3(MX<? super MX> target, MX<MX<String>> value) {\n" + 
10725
				"		target= value; // foo3\n" + 
10726
				"	}\n" + 
10727
				"}\n" + 
10728
				"\n" + 
10729
				"class MX<E> {\n" + 
10730
				"}\n"	,
10731
			},
10732
			"----------\n" + 
10733
			"1. WARNING in X.java (at line 3)\n" + 
10734
			"	void foo1(MX<? extends MX> target, MX<MX<String>> value) {\n" + 
10735
			"	                       ^^\n" + 
10736
			"MX is a raw type. References to generic type MX<E> should be parameterized\n" + 
10737
			"----------\n" + 
10738
			"2. WARNING in X.java (at line 9)\n" + 
10739
			"	void foo3(MX<? super MX> target, MX<MX<String>> value) {\n" + 
10740
			"	                     ^^\n" + 
10741
			"MX is a raw type. References to generic type MX<E> should be parameterized\n" + 
10742
			"----------\n" + 
10743
			"3. ERROR in X.java (at line 10)\n" + 
10744
			"	target= value; // foo3\n" + 
10745
			"	        ^^^^^\n" + 
10746
			"Type mismatch: cannot convert from MX<MX<String>> to MX<? super MX>\n" + 
10747
			"----------\n");
10748
	}
10749
	// check param type equivalences
10750
	public void test0368() {
10751
		this.runConformTest(
10752
			new String[] {
10753
				"X.java",	
10754
				"public class X<T extends Runnable> {\n" + 
10755
				"	\n" + 
10756
				"	static class MX <U> {\n" + 
10757
				"	}\n" + 
10758
				"	\n" + 
10759
				"	MX<T> createMX() { return new MX<T>(); }\n" + 
10760
				"\n" + 
10761
				"	void foo(X<?> x, MX<?> mx) {\n" + 
10762
				"		mx = x.createMX();\n" + 
10763
				"	}\n" + 
10764
				"}\n"	,
10765
			},
10766
			"");
10767
	}	
10768
	// bound check for Enum<T>
10769
	public void test0369() {
10770
		this.runConformTest(
10771
			new String[] {
10772
				"X.java",	
10773
				"public class X {\n" + 
10774
				"	\n" + 
10775
				"	<T extends Enum<T>> T foo(T t) { return null; }\n" + 
10776
				"}\n",
10777
			},
10778
			"");
10779
	}
10780
	// decoding raw binary type
10781
	public void test0370() {
10782
		this.runConformTest(
10783
    		new String[] {
10784
				"p/B.java",
10785
				"package p;\n" +
10786
				"import java.util.Map;\n" +
10787
				"public class B {\n" +
10788
				"	public static Map<Class, String> foo(byte[] byteArray, Object o, Class c) {\n" +
10789
				"		return null;\n" +
10790
				"	}\n" + 
10791
				"}"
10792
    		},
10793
			"");
10794
10795
		this.runConformTest(
10796
    		new String[] {
10797
    			"X.java",
10798
				"import java.util.Map;\n" + 
10799
				"\n" + 
10800
				"import p.B;\n" + 
10801
				"\n" + 
10802
				"public class X {\n" + 
10803
				"	{\n" + 
10804
				"		Map<Class, String> map = B.foo(null, null, null);\n" + 
10805
				"	}\n" + 
10806
				"}\n",
10807
    		},
10808
			"",
10809
			null,
10810
			false,
10811
			null);
10812
	}
10813
	// X<? extends Y> is not compatible with X<Y>
10814
	public void test0371() {
10815
		this.runNegativeTest(
10816
			new String[] {
10817
				"X.java",	
10818
				"public class X {\n" + 
10819
				"   	public void foo(XC<Runnable> target, XC<? extends Runnable> value) {\n" + 
10820
				"   		target = value;\n" + 
10821
				"   	}\n" + 
10822
				"}\n" + 
10823
				"class XC <E>{\n" + 
10824
				"}\n",
10825
			},
10826
			"----------\n" + 
10827
			"1. ERROR in X.java (at line 3)\n" + 
10828
			"	target = value;\n" + 
10829
			"	         ^^^^^\n" + 
10830
			"Type mismatch: cannot convert from XC<capture#1-of ? extends Runnable> to XC<Runnable>\n" + 
10831
			"----------\n");
10832
	}			
10833
	public void test0372() {
10834
		this.runConformTest(
10835
			new String[] {
10836
				"X.java",	
10837
				"import java.util.Iterator;\n" + 
10838
				"import java.util.Map;\n" + 
10839
				"import java.util.Map.Entry;\n" + 
10840
				"\n" + 
10841
				"public class X <K, V> {\n" + 
10842
				"\n" + 
10843
				"	void foo(Iterator<Map.Entry<K,V>> iter) {\n" + 
10844
				"		new XA.MXA<K,V>(iter.next());\n" + 
10845
				"	}\n" + 
10846
				"}\n" + 
10847
				"class XA <K, V> {\n" + 
10848
				"	static class MXA <K, V>  implements Entry<K,V> {\n" + 
10849
				"		MXA(Entry<K,V> e) {\n" + 
10850
				"		}\n" + 
10851
				"		public K getKey() {\n" + 
10852
				"			return null;\n" + 
10853
				"		}\n" + 
10854
				"		public V getValue() {\n" + 
10855
				"			return null;\n" + 
10856
				"		}\n" + 
10857
				"		public V setValue(V value) {\n" + 
10858
				"			return null;\n" + 
10859
				"		}\n" + 
10860
				"	}\n" + 
10861
				"}\n"	,
10862
			},
10863
			"");
10864
	}
10865
	public void test0373() {
10866
		this.runConformTest(
10867
			new String[] {
10868
				"XA.java",	
10869
				"import java.util.Map.Entry;\n" + 
10870
				"\n" + 
10871
				"public class XA <K, V> {\n" + 
10872
				"	static class MXA <K, V>  implements Entry<K,V> {\n" + 
10873
				"		MXA(Entry<K,V> e) {\n" + 
10874
				"		}\n" + 
10875
				"		public K getKey() {\n" + 
10876
				"			return null;\n" + 
10877
				"		}\n" + 
10878
				"		public V getValue() {\n" + 
10879
				"			return null;\n" + 
10880
				"		}\n" + 
10881
				"		public V setValue(V value) {\n" + 
10882
				"			return null;\n" + 
10883
				"		}\n" + 
10884
				"	}\n" + 
10885
				"}\n"	,
10886
			},
10887
			"");
10888
		// compile against binaries
10889
		this.runConformTest(
10890
			new String[] {
10891
				"X.java",	
10892
				"import java.util.Iterator;\n" + 
10893
				"import java.util.Map;\n" + 
10894
				"import java.util.Map.Entry;\n" + 
10895
				"\n" + 
10896
				"public class X <K, V> {\n" + 
10897
				"\n" + 
10898
				"	void foo(Iterator<Map.Entry<K,V>> iter) {\n" + 
10899
				"		new XA.MXA<K,V>(iter.next());\n" + 
10900
				"	}\n" + 
10901
				"}\n"	,
10902
			},
10903
			"",
10904
			null,
10905
			false,
10906
			null);
10907
	}
10908
	// wildcard with no upper bound uses type variable as upper bound
10909
	public void test0374() {
10910
		this.runConformTest(
10911
			new String[] {
10912
				"X.java",	
10913
				"public class X <T extends Exception> {\n" + 
10914
				"\n" + 
10915
				"	void foo1(X <? extends Exception> target, X<?> value) {\n" + 
10916
				"		target = value; // foo1\n" + 
10917
				"	}\n" + 
10918
				"	void foo2(X <? extends Exception> target, X<? super RuntimeException> value) {\n" + 
10919
				"		target = value;  // foo2\n" + 
10920
				"	}	\n" + 
10921
				"}\n",
10922
			},
10923
			"");
10924
	}	
10925
	public void test0375() {
10926
		this.runNegativeTest(
10927
			new String[] {
10928
				"X.java",	
10929
				"public class X <T> {\n" + 
10930
				"\n" + 
10931
				"	void foo1(X <? super Exception> target, X<? extends Exception> value) {\n" + 
10932
				"		target = value; // foo1\n" + 
10933
				"	}\n" + 
10934
				"}\n",
10935
			},
10936
			"----------\n" + 
10937
			"1. ERROR in X.java (at line 4)\n" + 
10938
			"	target = value; // foo1\n" + 
10939
			"	         ^^^^^\n" + 
10940
			"Type mismatch: cannot convert from X<capture#2-of ? extends Exception> to X<? super Exception>\n" + 
10941
			"----------\n");
10942
	}		
10943
	public void test0376() {
10944
		this.runConformTest(
10945
			new String[] {
10946
				"XA.java",	
10947
				"import java.util.Map.Entry;\n" + 
10948
				"\n" + 
10949
				"public class XA <K, V> {\n" + 
10950
				"   XA<K,V> self() { return this; } \n" +
10951
				"	static class MXA <K, V>  implements Entry<K,V> {\n" + 
10952
				"		MXA(Entry<K,V> e) {\n" + 
10953
				"		}\n" + 
10954
				"		public K getKey() {\n" + 
10955
				"			return null;\n" + 
10956
				"		}\n" + 
10957
				"		public V getValue() {\n" + 
10958
				"			return null;\n" + 
10959
				"		}\n" + 
10960
				"		public V setValue(V value) {\n" + 
10961
				"			return null;\n" + 
10962
				"		}\n" + 
10963
				"	}\n" + 
10964
				"}\n"	,
10965
			},
10966
			"");
10967
		// compile against binaries
10968
		this.runConformTest(
10969
			new String[] {
10970
				"X.java",	
10971
				"import java.util.Iterator;\n" + 
10972
				"import java.util.Map;\n" + 
10973
				"import java.util.Map.Entry;\n" + 
10974
				"\n" + 
10975
				"public class X <K, V> {\n" + 
10976
				"\n" + 
10977
				"	void foo(Iterator<Map.Entry<K,V>> iter) {\n" + 
10978
				"		new XA.MXA<K,V>(iter.next());\n" + 
10979
				"	}\n" + 
10980
				"}\n"	,
10981
			},
10982
			"",
10983
			null,
10984
			false,
10985
			null);
10986
	}	
10987
10988
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76601
10989
	public void test0377() {
10990
		this.runConformTest(
10991
			new String[] {
10992
				"Test.java",
10993
				"public class Test {\n" +
10994
					" public static void main (String[] args) {\n" +
10995
					"  final String val = (args == null||args.length==0 ? \"SUCC\" : args[0]) + \"ESS\";\n" +
10996
					"  class AllegedBoundMismatch<E2 extends SuperI<E2>> {\n" +
10997
					"   String field = val;\n" +
10998
					"  }\n" +
10999
					"  System.out.println(new Object() {\n" +
11000
					"   AllegedBoundMismatch<SubI<Q>> trial = new AllegedBoundMismatch<SubI<Q>>();\n" +
11001
					"  }.trial.field);\n" +
11002
					" }\n" +
11003
					"}\n" +
11004
					"class Q {}\n" +
11005
					"interface SubI<Q> extends SuperI<SubI<Q>> {}\n" +
11006
					"interface SuperI<Q> {}"
11007
			},
11008
		"SUCCESS");
11009
	}
11010
11011
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76219
11012
	public void test0378() {
11013
		this.runConformTest(
11014
			new String[] {
11015
				"BB.java",
11016
				"interface AA<W, Z extends AA<W, Z>> { \n" +
11017
					" public boolean m(AA<W, ?> that); \n" +
11018
					" public Z z(); \n" +
11019
					" public boolean b(); \n" +
11020
					"}\n" +
11021
					"abstract class BB<U, V extends AA<U, V>> implements AA<U,V> { \n" +
11022
					" public boolean m(AA<U, ?> wht) { return wht.z().b(); } \n" +
11023
					"}\n"}
11024
		);
11025
	}
11026
11027
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=71612
11028
	public void test0379() {
11029
		this.runConformTest(
11030
			new String[] {
11031
				"Test.java",
11032
				"import java.util.AbstractSet;\n" + 
11033
				"import java.util.Iterator;\n" + 
11034
				"public class Test extends AbstractSet<Runnable>{\n" + 
11035
				"    public static void main(String[] args) {\n" + 
11036
				"        Test t=new Test();\n" + 
11037
				"        t.add(null);\n" + 
11038
				"    }\n" + 
11039
				"    public boolean add(Runnable run) {\n" + 
11040
				"        System.out.println(\"success\");\n" + 
11041
				"        return true;\n" + 
11042
				"    }\n" + 
11043
				"    public Iterator<Runnable> iterator() {return null;}\n" + 
11044
				"    public int size() {return 0;}\n" + 
11045
				"}"
11046
				}
11047
		);
11048
	}
11049
11050
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77327
11051
	public void test0380() {
11052
		this.runConformTest(
11053
			new String[] {
11054
				"Test.java",
11055
				"import java.util.List;\n" + 
11056
				"public class Test {\n" + 
11057
				"	List<? super Number> wsn= null; // Contravariance\n" + 
11058
				"	List<? super Integer> wsi= wsn; // should work!\n" + 
11059
				"}\n"
11060
				}
11061
		);
11062
	}
11063
11064
	public void test0381() {
11065
		this.runNegativeTest(
11066
			new String[] {
11067
				"X.java",
11068
				"public class X extends Y {\n" + 
11069
				"	void foo(Class<? extends String> s) {}\n" + 
11070
				"}\n" + 
11071
				"class Y {\n" +
11072
				"	void foo(Class<String> s) {}\n" + 
11073
				"}\n"
11074
			},
11075
			"----------\n" + 
11076
			"1. ERROR in X.java (at line 2)\n" + 
11077
			"	void foo(Class<? extends String> s) {}\n" + 
11078
			"	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11079
			"Name clash: The method foo(Class<? extends String>) of type X has the same erasure as foo(Class<String>) of type Y but does not override it\n" + 
11080
			"----------\n");
11081
		this.runNegativeTest(
11082
			new String[] {
11083
				"X.java",
11084
				"public class X extends Y {\n" + 
11085
				"	void foo(Class<String> s) {}\n" + 
11086
				"}\n" + 
11087
				"class Y {\n" +
11088
				"	void foo(Class<? extends String> s) {}\n" + 
11089
				"}\n"
11090
			},
11091
			"----------\n" + 
11092
			"1. ERROR in X.java (at line 2)\n" + 
11093
			"	void foo(Class<String> s) {}\n" + 
11094
			"	     ^^^^^^^^^^^^^^^^^^^^\n" + 
11095
			"Name clash: The method foo(Class<String>) of type X has the same erasure as foo(Class<? extends String>) of type Y but does not override it\n" + 
11096
			"----------\n");
11097
	}
11098
	public void test0382() {
11099
		this.runNegativeTest(
11100
			new String[] {
11101
				"X.java",
11102
				"public class X extends Y implements I {}\n" + 
11103
				"interface I { void foo(Class<? extends String> s); }\n" + 
11104
				"class Y { void foo(Class<String> s) {} }\n"
11105
			},
11106
			"----------\n" + 
11107
			"1. ERROR in X.java (at line 1)\n" + 
11108
			"	public class X extends Y implements I {}\n" + 
11109
			"	             ^\n" + 
11110
			"Name clash: The method foo(Class<String>) of type Y has the same erasure as foo(Class<? extends String>) of type I but does not override it\n" + 
11111
			"----------\n" + 
11112
			"2. ERROR in X.java (at line 1)\n" + 
11113
			"	public class X extends Y implements I {}\n" + 
11114
			"	             ^\n" + 
11115
			"The type X must implement the inherited abstract method I.foo(Class<? extends String>)\n" + 
11116
			"----------\n");
11117
		this.runNegativeTest(
11118
			new String[] {
11119
				"X.java",
11120
				"public abstract class X extends Y implements I {}\n" + 
11121
				"interface I { void foo(Class<String> s); }\n" + 
11122
				"class Y { void foo(Class<? extends String> s) {} }\n"
11123
			},
11124
			"----------\n" + 
11125
			"1. ERROR in X.java (at line 1)\n" + 
11126
			"	public abstract class X extends Y implements I {}\n" + 
11127
			"	                      ^\n" + 
11128
			"Name clash: The method foo(Class<? extends String>) of type Y has the same erasure as foo(Class<String>) of type I but does not override it\n" + 
11129
			"----------\n");
11130
	}
11131
	public void test0383() {
11132
		this.runNegativeTest(
11133
			new String[] {
11134
				"X.java",
11135
				"public class X extends Y implements I { public <T> void foo(Class<T> s) {} }\n" + 
11136
				"interface I { <T, S> void foo(Class<T> s); }\n" + 
11137
				"class Y { public <T> void foo(Class<T> s) {} }\n"
11138
			},
11139
			"----------\n" + 
11140
			"1. ERROR in X.java (at line 1)\n" + 
11141
			"	public class X extends Y implements I { public <T> void foo(Class<T> s) {} }\n" + 
11142
			"	             ^\n" + 
11143
			"The type X must implement the inherited abstract method I.foo(Class<T>)\n" + 
11144
			"----------\n" + 
11145
			"2. ERROR in X.java (at line 1)\n" + 
11146
			"	public class X extends Y implements I { public <T> void foo(Class<T> s) {} }\n" + 
11147
			"	                                                        ^^^^^^^^^^^^^^^\n" + 
11148
			"Name clash: The method foo(Class<T>) of type X has the same erasure as foo(Class<T>) of type I but does not override it\n" + 
11149
			"----------\n" + 
11150
			"3. WARNING in X.java (at line 1)\n" + 
11151
			"	public class X extends Y implements I { public <T> void foo(Class<T> s) {} }\n" + 
11152
			"	                                                        ^^^^^^^^^^^^^^^\n" + 
11153
			"The method foo(Class<T>) of type X should be tagged with @Override since it actually overrides a superclass method\n" + 
11154
			"----------\n");
11155
			/*
11156
			X.java:1: X is not abstract and does not override abstract method <T,S>foo(java.lang.Class<T>) in I
11157
			public class X extends Y implements I { public <T> void foo(Class<T> s) {} }
11158
			       ^
11159
       		*/
11160
		this.runNegativeTest(
11161
			new String[] {
11162
				"X.java",
11163
				"public class X extends Y implements I {}\n" + 
11164
				"interface I { <T, S> void foo(Class<T> s); }\n" + 
11165
				"class Y { public <T> void foo(Class<T> s) {} }\n"
11166
			},
11167
			"----------\n" + 
11168
			"1. ERROR in X.java (at line 1)\n" + 
11169
			"	public class X extends Y implements I {}\n" + 
11170
			"	             ^\n" + 
11171
			"Name clash: The method foo(Class<T>) of type Y has the same erasure as foo(Class<T>) of type I but does not override it\n" + 
11172
			"----------\n" + 
11173
			"2. ERROR in X.java (at line 1)\n" + 
11174
			"	public class X extends Y implements I {}\n" + 
11175
			"	             ^\n" + 
11176
			"The type X must implement the inherited abstract method I.foo(Class<T>)\n" + 
11177
			"----------\n");
11178
			/*
11179
			X.java:1: X is not abstract and does not override abstract method <T,S>foo(java.lang.Class<T>) in I
11180
			public class X extends Y implements I {}
11181
			       ^
11182
			*/
11183
		this.runNegativeTest(
11184
			new String[] {
11185
				"X.java",
11186
				"public abstract class X extends Y implements I {}\n" + // NOTE: X is abstract
11187
				"interface I { <T> void foo(Class<T> s); }\n" + 
11188
				"class Y { public <T, S> void foo(Class<T> s) {} }\n"
11189
			},
11190
			"----------\n" + 
11191
			"1. ERROR in X.java (at line 1)\n" + 
11192
			"	public abstract class X extends Y implements I {}\n" + 
11193
			"	                      ^\n" + 
11194
			"Name clash: The method foo(Class<T>) of type Y has the same erasure as foo(Class<T>) of type I but does not override it\n" + 
11195
			"----------\n");
11196
			/*
11197
			X.java:1: name clash: <T,S>foo(java.lang.Class<T>) in Y and <T>foo(java.lang.Class<T>) in I have the same erasure, yet neither overrides the other
11198
			public abstract class X extends Y implements I {}
11199
			                ^
11200
			 */
11201
	}
11202
	public void test0384a() {
11203
		this.runConformTest(
11204
			new String[] {
11205
				"X.java",
11206
				"public class X extends Y {\n" + 
11207
				"	<T> java.util.List<T> foo3(java.util.List<T> t) { return t; }\n" + 
11208
				"	Class<String> foo4() { return null; }\n" + 
11209
				"	Class<String>[] foo5() { return null; }\n" + 
11210
				"}\n" + 
11211
				"class Y {\n" +
11212
				"	<T> java.util.List<T> foo3(java.util.List<T> t) { return t; }\n" + 
11213
				"	Class<? extends String> foo4() { return null; }\n" + 
11214
				"	Class<? extends String>[] foo5() { return null; }\n" + 
11215
				"}\n"
11216
			},
11217
			"");
11218
	}
11219
	public void test0384b() {
11220
		this.runNegativeTest(
11221
			new String[] {
11222
				"X.java",
11223
				"public class X extends Y {\n" + 
11224
				"	@Override Class<? extends String> foo() { return null; }\n" + 
11225
				"	@Override Class<? extends String>[] foo2() { return null; }\n" + 
11226
				"}\n" + 
11227
				"class Y {\n" +
11228
				"	Class<String> foo() { return null; }\n" + 
11229
				"	Class<String>[] foo2() { return null; }\n" + 
11230
				"}\n"
11231
			},
11232
			"----------\n" + 
11233
			"1. ERROR in X.java (at line 2)\n" + 
11234
			"	@Override Class<? extends String> foo() { return null; }\n" + 
11235
			"	          ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11236
			"The return type is incompatible with Y.foo()\n" + 
11237
			"----------\n" + 
11238
			"2. ERROR in X.java (at line 3)\n" + 
11239
			"	@Override Class<? extends String>[] foo2() { return null; }\n" + 
11240
			"	          ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11241
			"The return type is incompatible with Y.foo2()\n" + 
11242
			"----------\n");
11243
	}
11244
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77496
11245
	public void test0385() { 
11246
		this.runNegativeTest(
11247
			new String[] {
11248
				"X.java",
11249
				"import java.util.List;\n" + 
11250
				"interface IDoubles { List<Double> getList(); }\n" +
11251
				"class A implements IDoubles {\n" + 
11252
				"	public List<String> getList() { return null; }\n" + 
11253
				"}\n" + 
11254
				"class B {\n" + 
11255
				"	 public List<String> getList() { return null; }\n" + 
11256
				"}\n" + 
11257
				"class C extends B implements IDoubles {\n" + 
11258
				"	void use() { List<String> l= getList(); }\n" + 
11259
				"}\n"
11260
			},
11261
			"----------\n" + 
11262
			"1. ERROR in X.java (at line 4)\n" + 
11263
			"	public List<String> getList() { return null; }\n" + 
11264
			"	       ^^^^^^^^^^^^\n" + 
11265
			"The return type is incompatible with IDoubles.getList()\n" + 
11266
			"----------\n" + 
11267
			"2. ERROR in X.java (at line 9)\n" + 
11268
			"	class C extends B implements IDoubles {\n" + 
11269
			"	      ^\n" + 
11270
			"The return type is incompatible with IDoubles.getList(), B.getList()\n" + 
11271
			"----------\n");
11272
			/*
11273
			X.java:3: A is not abstract and does not override abstract method getList() in IDoubles
11274
			class A implements IDoubles {
11275
			^
11276
			X.java:4: getList() in A cannot implement getList() in IDoubles; attempting to use incompatible return type
11277
			found   : java.util.List<java.lang.String>
11278
			required: java.util.List<java.lang.Double>
11279
				public List<String> getList() { return null; }
11280
			                            ^
11281
			X.java:9: C is not abstract and does not override abstract method getList() in IDoubles
11282
			class C extends B implements IDoubles {
11283
			 */	
11284
	}
11285
11286
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77325
11287
	public void test0386() {
11288
		this.runNegativeTest(
11289
			new String[] {
11290
				"X.java",
11291
				"class X <R,U,V, T> {\n" + 
11292
					"	private U u;\n" + 
11293
					"	private V v;\n" + 
11294
					"	public X(U u,V v) { this.u= u; this.v= v; }\n" + 
11295
					"	public R getU() { return (R)u; } // Warning\n" + 
11296
					"	public R getV() { return (R)v; } // Warning\n" + 
11297
					"	Object o;\n" + 
11298
					"	public T getT() { return (T)o; } // Warning\n" + 
11299
					"}"
11300
			},
11301
			"----------\n" + 
11302
			"1. WARNING in X.java (at line 5)\n" + 
11303
			"	public R getU() { return (R)u; } // Warning\n" + 
11304
			"	                         ^^^^\n" + 
11305
			"Type safety: Unchecked cast from U to R\n" + 
11306
			"----------\n" + 
11307
			"2. WARNING in X.java (at line 6)\n" + 
11308
			"	public R getV() { return (R)v; } // Warning\n" + 
11309
			"	                         ^^^^\n" + 
11310
			"Type safety: Unchecked cast from V to R\n" + 
11311
			"----------\n" + 
11312
			"3. WARNING in X.java (at line 8)\n" + 
11313
			"	public T getT() { return (T)o; } // Warning\n" + 
11314
			"	                         ^^^^\n" + 
11315
			"Type safety: Unchecked cast from Object to T\n" + 
11316
			"----------\n");
11317
	}
11318
11319
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77422 - generic varargs method
11320
	public void test0387() {
11321
		this.runNegativeTest(
11322
			new String[] {
11323
				"X.java",
11324
				"import java.util.*;\n" + 
11325
				"\n" + 
11326
				"public class X<T>\n" + 
11327
				"{\n" + 
11328
				"\n" + 
11329
				"	public boolean test1()\n" + 
11330
				"	{\n" + 
11331
				"			test2(\"test\", null, 0);\n" + 
11332
				"	}\n" + 
11333
				"\n" + 
11334
				"	public <F> List<F> test2(final List<F> list, final String... strings)\n" + 
11335
				"	{\n" + 
11336
				"		return null;\n" + 
11337
				"	}\n" + 
11338
				"}\n"
11339
			},
11340
			"----------\n" + 
11341
			"1. ERROR in X.java (at line 8)\n" + 
11342
			"	test2(\"test\", null, 0);\n" + 
11343
			"	^^^^^\n" + 
11344
			"The method test2(List<F>, String...) in the type X<T> is not applicable for the arguments (String, null, int)\n" + 
11345
			"----------\n");
11346
	}
11347
11348
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77422 - variation
11349
	public void test0388() {
11350
		this.runConformTest(
11351
			new String[] {
11352
				"X.java",
11353
				"import java.util.*;\n" + 
11354
				"\n" + 
11355
				"public class X<T>\n" + 
11356
				"{\n" + 
11357
				"\n" + 
11358
				"	public boolean test01()\n" + 
11359
				"	{\n" + 
11360
				"			test02(null, null, \"test\");\n" + 
11361
				"			return false;\n" + 
11362
				"	}\n" + 
11363
				"\n" + 
11364
				"	public <F> List<F> test02(final List<F> list, final String... strings)\n" + 
11365
				"	{\n" + 
11366
				"		return null;\n" + 
11367
				"	}\n" + 
11368
				"}\n"
11369
			},
11370
			""
11371
		);
11372
	}
11373
11374
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77422 - variation
11375
	public void test0389() {
11376
		this.runConformTest(
11377
			new String[] {
11378
				"X.java",
11379
				"public class X {\n" + 
11380
				"\n" + 
11381
				"	public boolean test01()	{\n" + 
11382
				"		String s = foo(\"hello\");\n" + 
11383
				"		return s != null;\n" + 
11384
				"	}\n" + 
11385
				"\n" + 
11386
				"	public <F> F foo(F f, F... others) {\n" + 
11387
				"		return f;\n" + 
11388
				"	}\n" + 
11389
				"}\n"
11390
			},
11391
			""
11392
		);
11393
	}	
11394
	
11395
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77422 - variation
11396
	public void test0390() {
11397
		this.runConformTest(
11398
			new String[] {
11399
				"X.java",
11400
				"public class X {\n" + 
11401
				"\n" + 
11402
				"	public boolean test01()	{\n" + 
11403
				"		String s = foo(null, \"hello\");\n" + 
11404
				"		return s != null;\n" + 
11405
				"	}\n" + 
11406
				"\n" + 
11407
				"	public <F> F foo(F f, F... others) {\n" + 
11408
				"		return f;\n" + 
11409
				"	}\n" + 
11410
				"}\n"
11411
			},
11412
			""
11413
		);
11414
	}		
11415
	
11416
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77422 - variation
11417
	public void test0391() {
11418
		this.runNegativeTest(
11419
			new String[] {
11420
				"X.java",
11421
				"public class X {\n" + 
11422
				"\n" + 
11423
				"	public boolean test01()	{\n" + 
11424
				"		String[] s = foo(null, new String[]{ \"hello\" });\n" + 
11425
				"		return s != null;\n" + 
11426
				"	}\n" + 
11427
				"\n" + 
11428
				"	public <F> F foo(F f, F... others) {\n" + 
11429
				"		return f;\n" + 
11430
				"	}\n" + 
11431
				"}\n"	
11432
			},
11433
			"----------\n" + 
11434
			"1. ERROR in X.java (at line 4)\n" + 
11435
			"	String[] s = foo(null, new String[]{ \"hello\" });\n" + 
11436
			"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11437
			"Type mismatch: cannot convert from String to String[]\n" + 
11438
			"----------\n"
11439
		);
11440
	}		
11441
	
11442
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77422 - variation
11443
	public void test0392() {
11444
		this.runConformTest(
11445
			new String[] {
11446
				"X.java",
11447
				"public class X {\n" + 
11448
				"\n" + 
11449
				"	public boolean test01()	{\n" + 
11450
				"		foo(null, \"hello\");\n" + // no inference on expected type
11451
				"		return true;\n" + 
11452
				"	}\n" + 
11453
				"\n" + 
11454
				"	public <F> F foo(F f, F... others) {\n" + 
11455
				"		return f;\n" + 
11456
				"	}\n" + 
11457
				"}\n"
11458
			},
11459
			""
11460
		);
11461
	}		
11462
	
11463
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78049 - chech invalid array initializer
11464
	public void test0393() {
11465
		this.runConformTest(
11466
			new String[] {
11467
				"X.java",
11468
				"public class X {\n" + 
11469
				"\n" + 
11470
				"	public boolean test01()	{\n" + 
11471
				"		foo(null, \"hello\");\n" + // no inference on expected type
11472
				"		return true;\n" + 
11473
				"	}\n" + 
11474
				"\n" + 
11475
				"	public <F> F foo(F f, F... others) {\n" + 
11476
				"		return f;\n" + 
11477
				"	}\n" + 
11478
				"}\n"
11479
			},
11480
			""
11481
		);
11482
	}			
11483
	
11484
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78027
11485
	public void test0394() {
11486
		this.runConformTest(
11487
			new String[] {
11488
				"X.java",
11489
				"public class X \n" + 
11490
				"{\n" + 
11491
				"}\n" + 
11492
				"\n" + 
11493
				"interface ITest<C extends X>\n" + 
11494
				"{ \n" + 
11495
				"}\n" + 
11496
				"\n" + 
11497
				"abstract class Test<C extends X> implements ITest<C>\n" + 
11498
				"{\n" + 
11499
				"  protected Manager<C> m_manager;\n" + 
11500
				"  \n" + 
11501
				"  public ITest<C> get()\n" + 
11502
				"  {\n" + 
11503
				"    return m_manager.getById(getClass(), new Integer(1));\n" + 
11504
				"  }\n" + 
11505
				"    \n" + 
11506
				"  public static class Manager<C extends X>\n" + 
11507
				"  {\n" + 
11508
				"    public <T extends ITest<C>> T getById(Class<T> cls, Integer id)\n" + 
11509
				"    {\n" + 
11510
				"      return null;\n" + 
11511
				"    }\n" + 
11512
				"  }\n" + 
11513
				"}\n"
11514
			},
11515
			""
11516
		);
11517
	}			
11518
	
11519
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74119 - variation
11520
	public void test0395() {
11521
		this.runNegativeTest(
11522
			new String[] {
11523
				"X.java",
11524
				"public class X<T extends Exception> {\n" + 
11525
				"	T element;\n" + 
11526
				"	\n" + 
11527
				"	void foo(X<? super NullPointerException> xnpe) {\n" + 
11528
				"		xnpe.element = new java.io.IOException();\n" + 
11529
				"	}\n" + 
11530
				"}\n"
11531
			},
11532
			"----------\n" + 
11533
			"1. ERROR in X.java (at line 5)\n" + 
11534
			"	xnpe.element = new java.io.IOException();\n" + 
11535
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11536
			"Type mismatch: cannot convert from IOException to capture#1-of ? super NullPointerException\n" + 
11537
			"----------\n");
11538
	}			
11539
11540
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78139 - downcast generic method inference
11541
	public void test0396() {
11542
		this.runNegativeTest(
11543
			new String[] {
11544
				"X.java",
11545
				"import java.util.Collection;\n" + 
11546
				"import java.util.List;\n" + 
11547
				"import java.util.ArrayList;\n" + 
11548
				"\n" + 
11549
				"public class X\n" + 
11550
				"{\n" + 
11551
				"    public static <T> List<T> emptyList() {\n" + 
11552
				"        return new ArrayList<T>();\n" + 
11553
				"    }\n" + 
11554
				"    public static <T> Collection<T> emptyCollection() {\n" + 
11555
				"        return new ArrayList<T>();\n" + 
11556
				"    }\n" + 
11557
				"    public static <T> Iterable<T> emptyIterable() {\n" + 
11558
				"        return new ArrayList<T>();\n" + 
11559
				"    }\n" + 
11560
				"    \n" + 
11561
				"    public static void main(String[] args) {\n" + 
11562
				"    	 // generic inference using expected lhs type: T --> String\n" + 
11563
				"        final List<String> lL = emptyList(); // 1\n" + 
11564
				"        \n" + 
11565
				"    	 // generic inference using expected cast type: T --> String\n" + 
11566
				"        final Collection<String> cL = (Collection<String>)emptyList(); // 2\n" + 
11567
				"        \n" + 
11568
				"    	 // generic inference using expected cast type: T --> String\n" + 
11569
				"        final Iterable<String> iL = (Iterable<String>)emptyList(); // 3\n" + 
11570
				"        \n" + 
11571
				"    	 // generic inference using expected lhs type: T --> String\n" + 
11572
				"        final Collection<String> cC = emptyCollection(); // 4\n" + 
11573
				"        \n" + 
11574
				"    	 // generic inference using expected cast type: T --> String\n" + 
11575
				"        final Iterable<String> iC = (Iterable<String>)emptyCollection(); // 5\n" + 
11576
				"        \n" + 
11577
				"    	 // generic inference using expected lhs type: T --> String\n" + 
11578
				"        final Iterable<String> iI = emptyIterable(); // 6\n" + 
11579
				"        \n" + 
11580
				"    	 // generic inference using expected lhs type: T --> String\n" + 
11581
				"        final Collection<String> cL2 = emptyList(); // 7\n" + 
11582
				"        \n" + 
11583
				"    	 // generic inference using expected lhs type: T --> String\n" + 
11584
				"        final Iterable<String> iC2 = emptyCollection(); // 8\n" + 
11585
				"    }\n" + 
11586
				"}"
11587
			},
11588
			"----------\n" + 
11589
			"1. ERROR in X.java (at line 22)\n" + 
11590
			"	final Collection<String> cL = (Collection<String>)emptyList(); // 2\n" + 
11591
			"	                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11592
			"Cannot cast from List<Object> to Collection<String>\n" + 
11593
			"----------\n" + 
11594
			"2. ERROR in X.java (at line 25)\n" + 
11595
			"	final Iterable<String> iL = (Iterable<String>)emptyList(); // 3\n" + 
11596
			"	                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11597
			"Cannot cast from List<Object> to Iterable<String>\n" + 
11598
			"----------\n" + 
11599
			"3. ERROR in X.java (at line 31)\n" + 
11600
			"	final Iterable<String> iC = (Iterable<String>)emptyCollection(); // 5\n" + 
11601
			"	                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11602
			"Cannot cast from Collection<Object> to Iterable<String>\n" + 
11603
			"----------\n");
11604
	}		
11605
	
11606
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=76132
11607
	public void test0397() {
11608
		this.runNegativeTest(
11609
			new String[] {
11610
				"X.java",
11611
				"interface K1<A> { \n" + 
11612
				"        public <B extends A> void kk(K1<B> x); \n" + 
11613
				"} \n" + 
11614
				" \n" + 
11615
				"class K2<C> implements K1<C> { \n" + 
11616
				"        public <D extends C> void kk(K1<D> y) { \n" + 
11617
				"                System.out.println(\"K2::kk(\" + y.toString() + \")\"); \n" + 
11618
				"        } \n" + 
11619
				"} \n" + 
11620
				" \n" + 
11621
				"// --------------------------------------------------- \n" + 
11622
				" \n" + 
11623
				"interface L1<E> { \n" + 
11624
				"        public void ll(L1<? extends E> a); \n" + 
11625
				"} \n" + 
11626
				" \n" + 
11627
				"class L2<KK> implements L1<KK> { \n" + 
11628
				"        public void ll(L1<? extends KK> b) { \n" + 
11629
				"                ll2(b); \n" + 
11630
				"        } \n" + 
11631
				" \n" + 
11632
				"        private <LL extends KK> void ll2(L1<LL> c) { \n" + 
11633
				"                System.out.println(\"L2::ll2(\" + c.toString() + \")\"); \n" + 
11634
				"        } \n" + 
11635
				"} \n" + 
11636
				" \n" + 
11637
				"// --------------------------------------------------- \n" + 
11638
				" \n" + 
11639
				"interface M1<H> { \n" + 
11640
				"        public void mm(M1<? extends H> p); \n" + 
11641
				"} \n" + 
11642
				" \n" + 
11643
				"class M2<I> implements M1<I> { \n" + 
11644
				"        public <J extends I> void mm(M1<J> q) { \n" + 
11645
				"                System.out.println(\"M2::mm(\" + q.toString() + \")\"); \n" + 
11646
				"        } \n" + 
11647
				"} \n" + 
11648
				" \n" + 
11649
				"// =================================================== \n" + 
11650
				" \n" + 
11651
				"class XX            { public String toString() { return \"XX\"; } } \n" + 
11652
				"class YY extends XX { public String toString() { return \"YY\"; } } \n" + 
11653
				"class ZZ extends YY { public String toString() { return \"ZZ\"; } } \n" + 
11654
				" \n" + 
11655
				"// --------------------------------------------------- \n" + 
11656
				" \n" + 
11657
				"public class X { \n" + 
11658
				"        public static void main(String arg[]) { \n" + 
11659
				"                goK(new K2<YY>()); \n" + 
11660
				"                goL(new L2<YY>()); \n" + 
11661
				"                goM(new M2<YY>()); \n" + 
11662
				"        } \n" + 
11663
				" \n" + 
11664
				" \n" + 
11665
				"        public static void goK(K1<YY> k) { \n" + 
11666
				"                // k.kk(new K2<XX>()); // Would fail \n" + 
11667
				"                k.kk(new K2<YY>()); \n" + 
11668
				"                k.kk(new K2<ZZ>()); \n" + 
11669
				"        } \n" + 
11670
				" \n" + 
11671
				" \n" + 
11672
				"        public static void goL(L1<YY> l) { \n" + 
11673
				"                // l.ll(new L2<XX>()); // Would fail \n" + 
11674
				"                l.ll(new L2<YY>()); \n" + 
11675
				"                l.ll(new L2<ZZ>()); \n" + 
11676
				"        } \n" + 
11677
				" \n" + 
11678
				" \n" + 
11679
				"        public static void goM(M1<YY> m) { \n" + 
11680
				"                // m.mm(new M2<XX>()); // Would fail \n" + 
11681
				"                m.mm(new M2<YY>()); \n" + 
11682
				"                m.mm(new M2<ZZ>()); \n" + 
11683
				"        } \n" + 
11684
				"}"
11685
			},
11686
			"----------\n" + 
11687
			"1. ERROR in X.java (at line 33)\n" + 
11688
			"	class M2<I> implements M1<I> { \n" + 
11689
			"	      ^^\n" + 
11690
			"The type M2<I> must implement the inherited abstract method M1<I>.mm(M1<? extends I>)\n" + 
11691
			"----------\n" + 
11692
			"2. ERROR in X.java (at line 34)\n" + 
11693
			"	public <J extends I> void mm(M1<J> q) { \n" + 
11694
			"	                          ^^^^^^^^^^^\n" + 
11695
			"Name clash: The method mm(M1<J>) of type M2<I> has the same erasure as mm(M1<? extends H>) of type M1<H> but does not override it\n" + 
11696
			"----------\n" + 
11697
			"3. WARNING in X.java (at line 41)\n" + 
11698
			"	class XX            { public String toString() { return \"XX\"; } } \n" + 
11699
			"	                                    ^^^^^^^^^^\n" + 
11700
			"The method toString() of type XX should be tagged with @Override since it actually overrides a superclass method\n" + 
11701
			"----------\n" + 
11702
			"4. WARNING in X.java (at line 42)\n" + 
11703
			"	class YY extends XX { public String toString() { return \"YY\"; } } \n" + 
11704
			"	                                    ^^^^^^^^^^\n" + 
11705
			"The method toString() of type YY should be tagged with @Override since it actually overrides a superclass method\n" + 
11706
			"----------\n" + 
11707
			"5. WARNING in X.java (at line 43)\n" + 
11708
			"	class ZZ extends YY { public String toString() { return \"ZZ\"; } } \n" + 
11709
			"	                                    ^^^^^^^^^^\n" + 
11710
			"The method toString() of type ZZ should be tagged with @Override since it actually overrides a superclass method\n" + 
11711
			"----------\n");
11712
	}			
11713
	// cannot allocate parameterized type with wildcards
11714
	public void test0398() {
11715
		this.runNegativeTest(
11716
			new String[] {
11717
				"X.java",
11718
				"public class X <T> {\n" + 
11719
				"    X(){\n" + 
11720
				"    }\n" + 
11721
				"    public static void main(String[] args) {\n" + 
11722
				"		new X<?>();\n" + 
11723
				"		new X<? extends String>();\n" + 
11724
				"		new X<?>(){};\n" + 
11725
				"		new X<? extends String>(){};\n" + 
11726
				"	}\n" + 
11727
				"}\n"	,
11728
			},
11729
			"----------\n" + 
11730
			"1. ERROR in X.java (at line 5)\n" + 
11731
			"	new X<?>();\n" + 
11732
			"	    ^\n" + 
11733
			"Cannot instantiate the type X<?>\n" + 
11734
			"----------\n" + 
11735
			"2. ERROR in X.java (at line 6)\n" + 
11736
			"	new X<? extends String>();\n" + 
11737
			"	    ^\n" + 
11738
			"Cannot instantiate the type X<? extends String>\n" + 
11739
			"----------\n" + 
11740
			"3. ERROR in X.java (at line 7)\n" + 
11741
			"	new X<?>(){};\n" + 
11742
			"	    ^\n" + 
11743
			"The type new X(){} cannot extend or implement X<?>. A supertype may not specify any wildcard\n" + 
11744
			"----------\n" + 
11745
			"4. ERROR in X.java (at line 8)\n" + 
11746
			"	new X<? extends String>(){};\n" + 
11747
			"	    ^\n" + 
11748
			"The type new X(){} cannot extend or implement X<? extends String>. A supertype may not specify any wildcard\n" + 
11749
			"----------\n");
11750
	}
11751
	
11752
	public void test0399() {
11753
		this.runNegativeTest(
11754
			new String[] {
11755
				"X.java",
11756
				"public class X <T> {\n" + 
11757
				"    T t;\n" + 
11758
				"    X(T t){\n" + 
11759
				"        this.t = t;\n" + 
11760
				"    }\n" + 
11761
				"    public static void main(String[] args) {\n" + 
11762
				"		X<? extends AX> x = new X<AX<Math>>(new AX<String>());\n" + 
11763
				"	}\n" + 
11764
				"}\n" + 
11765
				"\n" + 
11766
				"class AX<P> {\n" + 
11767
				"    P foo() { return null; }\n" + 
11768
				"}\n",
11769
			},
11770
			"----------\n" + 
11771
			"1. WARNING in X.java (at line 7)\n" + 
11772
			"	X<? extends AX> x = new X<AX<Math>>(new AX<String>());\n" + 
11773
			"	            ^^\n" + 
11774
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
11775
			"----------\n" + 
11776
			"2. ERROR in X.java (at line 7)\n" + 
11777
			"	X<? extends AX> x = new X<AX<Math>>(new AX<String>());\n" + 
11778
			"	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11779
			"The constructor X<AX<Math>>(AX<String>) is undefined\n" + 
11780
			"----------\n");	
11781
	}
11782
	
11783
	public void test0400() {
11784
		this.runNegativeTest(
11785
			new String[] {
11786
				"X.java",
11787
				"public class X <T> {\n" + 
11788
				"    T t;\n" + 
11789
				"    X(X<? extends T> xt){\n" + 
11790
				"        this.t = xt.t;\n" + 
11791
				"    }\n" + 
11792
				"    public static void main(String[] args) {\n" + 
11793
				"		X<? extends AX> x = new X<AX<Math>>(new X<AX<String>>(null));\n" + 
11794
				"	}\n" + 
11795
				"}\n" + 
11796
				"class AX<P> {\n" + 
11797
				"    P foo() { return null; }\n" + 
11798
				"}",
11799
			},
11800
			"----------\n" + 
11801
			"1. WARNING in X.java (at line 7)\n" + 
11802
			"	X<? extends AX> x = new X<AX<Math>>(new X<AX<String>>(null));\n" + 
11803
			"	            ^^\n" + 
11804
			"AX is a raw type. References to generic type AX<P> should be parameterized\n" + 
11805
			"----------\n" + 
11806
			"2. ERROR in X.java (at line 7)\n" + 
11807
			"	X<? extends AX> x = new X<AX<Math>>(new X<AX<String>>(null));\n" + 
11808
			"	                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
11809
			"The constructor X<AX<Math>>(X<AX<String>>) is undefined\n" + 
11810
			"----------\n");	
11811
	}		
11812
11813
	// legal to allocate/inherit from a type with wildcards, as long as non direct arguments
11814
	public void test0401() {
11815
		this.runConformTest(
11816
			new String[] {
11817
				"X.java",
11818
				"public class X<T> {\n" + 
11819
				"	void foo() {\n" + 
11820
				"		new X<X<?>>();\n" + 
11821
				"		new X<X<? extends String>>();\n" + 
11822
				"		new X<X<?>>(){};\n" + 
11823
				"		new X<X<? extends String>>(){};\n" + 
11824
				"	}\n" + 
11825
				"}",
11826
			},
11827
			"");	
11828
	}	
11829
	
11830
	// legal to inherit from a type with wildcards, as long as non direct arguments
11831
	public void test0402() {
11832
		this.runConformTest(
11833
			new String[] {
11834
				"X.java",
11835
				"public class X extends Y<Y<?>> {\n" + 
11836
				"}\n" + 
11837
				"class Y<T> {}",
11838
			},
11839
			"");	
11840
	}
11841
	// check cast between generic types
11842
	public void test0403() {
11843
		this.runNegativeTest(
11844
			new String[] {
11845
				"X.java",
11846
				"public class X <T> {\n" + 
11847
				"	\n" + 
11848
				"	void foo(X<X<? extends String>> xs) {\n" + 
11849
				"		X<X<String>> x = (X<X<String>>) xs;\n" + 
11850
				"		Zork z;\n" +
11851
				"	}\n" + 
11852
				"}\n",
11853
			},
11854
			"----------\n" + 
11855
			"1. ERROR in X.java (at line 4)\n" + 
11856
			"	X<X<String>> x = (X<X<String>>) xs;\n" + 
11857
			"	                 ^^^^^^^^^^^^^^^^^\n" + 
11858
			"Cannot cast from X<X<? extends String>> to X<X<String>>\n" + 
11859
			"----------\n" + 
11860
			"2. ERROR in X.java (at line 5)\n" + 
11861
			"	Zork z;\n" + 
11862
			"	^^^^\n" + 
11863
			"Zork cannot be resolved to a type\n" + 
11864
			"----------\n");	
11865
	}
11866
	
11867
	// check cast between generic types
11868
	public void test0404() {
11869
		this.runNegativeTest(
11870
			new String[] {
11871
				"X.java",
11872
				"public class X <T> {\n" + 
11873
				"	\n" + 
11874
				"	void foo(X<? extends String> xs) {\n" + 
11875
				"		X<String> x = (X<String>) xs;\n" + 
11876
				"		Zork z;\n" +
11877
				"	}\n" + 
11878
				"}\n",
11879
			},
11880
			"----------\n" + 
11881
			"1. WARNING in X.java (at line 4)\n" + 
11882
			"	X<String> x = (X<String>) xs;\n" + 
11883
			"	              ^^^^^^^^^^^^^^\n" + 
11884
			"Type safety: Unchecked cast from X<capture#1-of ? extends String> to X<String>\n" + 
11885
			"----------\n" + 
11886
			"2. ERROR in X.java (at line 5)\n" + 
11887
			"	Zork z;\n" + 
11888
			"	^^^^\n" + 
11889
			"Zork cannot be resolved to a type\n" + 
11890
			"----------\n");	
11891
	}		
11892
11893
	// check cast between generic types
11894
	public void test0405() {
11895
		this.runNegativeTest(
11896
			new String[] {
11897
				"X.java",
11898
				"public class X <E> {\n" + 
11899
				"	\n" + 
11900
				"	<T> void foo(X<X<T>> xs) {\n" + 
11901
				"		X<X<String>> x = (X<X<String>>) xs;\n" + 
11902
				"	}\n" + 
11903
				"	<T> void bar(X<T> xs) {\n" + 
11904
				"		X<String> x = (X<String>) xs;\n" + 
11905
				"	}	\n" + 
11906
				"}\n",
11907
			},
11908
			"----------\n" + 
11909
			"1. ERROR in X.java (at line 4)\n" + 
11910
			"	X<X<String>> x = (X<X<String>>) xs;\n" + 
11911
			"	                 ^^^^^^^^^^^^^^^^^\n" + 
11912
			"Cannot cast from X<X<T>> to X<X<String>>\n" + 
11913
			"----------\n" + 
11914
			"2. WARNING in X.java (at line 7)\n" + 
11915
			"	X<String> x = (X<String>) xs;\n" + 
11916
			"	              ^^^^^^^^^^^^^^\n" + 
11917
			"Type safety: Unchecked cast from X<T> to X<String>\n" + 
11918
			"----------\n");	
11919
	}		
11920
	
11921
	public void test0406() {
11922
		this.runConformTest(
11923
			new String[] {
11924
				"X.java",
11925
				"public abstract class X<K1,V1> implements M<K1,V1> {\n" + 
11926
				"	abstract M<K1,V1> other();\n" + 
11927
				"	public S<E<K1,V1>> entrySet() {\n" + 
11928
				"		return other().entrySet();\n" + 
11929
				"	}\n" + 
11930
				"}\n" + 
11931
				"interface M<K2,V2> {\n" + 
11932
				"	 interface E<K3,V3> { }\n" + 
11933
				"	 S<E<K2, V2>> entrySet();\n" + 
11934
				"}\n" + 
11935
				"interface S<T> {}",
11936
			},
11937
			"");	
11938
	}		
11939
	
11940
	public void test0407() {
11941
		this.runConformTest(
11942
			new String[] {
11943
				"X.java",
11944
				"public abstract class X<K1,V1> implements M<K1,V1> {\n" + 
11945
				"	abstract M<K1,V1> other();\n" + 
11946
				"	public S<M.E<K1,V1>> entrySet() {\n" + // qualified M.E...
11947
				"		return other().entrySet();\n" + 
11948
				"	}\n" + 
11949
				"}\n" + 
11950
				"interface M<K2,V2> {\n" + 
11951
				"	 interface E<K3,V3> { }\n" + 
11952
				"	 S<E<K2, V2>> entrySet();\n" + 
11953
				"}\n" + 
11954
				"interface S<T> {}",
11955
			},
11956
			"");	
11957
	}			
11958
11959
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78008
11960
	public void test0408() {
11961
		this.runConformTest(
11962
			new String[] {
11963
				"X.java",
11964
				"import java.util.*;\n" + 
11965
				"public class X {\n" + 
11966
				"    public Integer[] getTypes() {\n" + 
11967
				"        List<Integer> list = new ArrayList<Integer>();\n" + 
11968
				"        return list == null \n" + 
11969
				"            ? new Integer[0] \n" + 
11970
				"            : list.toArray(new Integer[list.size()]);\n" + 
11971
				"    }\n" + 
11972
				"    public static void main(String[] args) {\n" + 
11973
				"        Class clazz = null;\n" + 
11974
				"        try {\n" + 
11975
				"            clazz = Class.forName(\"X\");\n" + 
11976
				"    	     System.out.println(\"SUCCESS\");\n" + 
11977
				"        } catch (Throwable e) {\n" + 
11978
				"            e.printStackTrace();\n" + 
11979
				"        }\n" + 
11980
				"    }\n" + 
11981
				"}",
11982
			},
11983
			"SUCCESS");	
11984
	}	
11985
	
11986
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78008
11987
	public void test0409() {
11988
		this.runConformTest(
11989
			new String[] {
11990
				"X.java",
11991
				"import java.util.*;\n" + 
11992
				"public class X {\n" + 
11993
				"    public Number getTypes() {\n" + 
11994
				"        List<Integer> list = new ArrayList<Integer>();\n" + 
11995
				"        return list == null \n" + 
11996
				"            ? Float.valueOf(0)\n" + 
11997
				"            : list.get(0);\n" + 
11998
				"    }\n" + 
11999
				"    public static void main(String[] args) {\n" + 
12000
				"        Class clazz = null;\n" + 
12001
				"        try {\n" + 
12002
				"            clazz = Class.forName(\"X\");\n" + 
12003
				"    	     System.out.println(\"SUCCESS\");\n" + 
12004
				"        } catch (Throwable e) {\n" + 
12005
				"            e.printStackTrace();\n" + 
12006
				"        }\n" + 
12007
				"    }\n" + 
12008
				"}",
12009
			},
12010
			"SUCCESS");	
12011
	}			
12012
12013
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=74178
12014
	public void test0410() {
12015
		this.runNegativeTest(
12016
			new String[] {
12017
				"X.java",
12018
				"import java.util.List;\n" + 
12019
				"\n" + 
12020
				"public class X {\n" + 
12021
				"\n" + 
12022
				"public void write(List<? super Exception> list) {\n" + 
12023
				"	\n" + 
12024
				"  list.add(new RuntimeException());             // works\n" + 
12025
				"  list.add(new IllegalMonitorStateException()); // works\n" + 
12026
				"  Exception exc = new Exception();\n" + 
12027
				"  list.add(exc);                                // works\n" + 
12028
				"  list.add(new Object());                       // should fail\n" + 
12029
				"  list.add(new Throwable());                    // should fail\n" + 
12030
				"  list.add(new Exception());                    // works\n" + 
12031
				"}\n" + 
12032
				"}",
12033
			},
12034
			"----------\n" + 
12035
			"1. ERROR in X.java (at line 11)\n" + 
12036
			"	list.add(new Object());                       // should fail\n" + 
12037
			"	     ^^^\n" + 
12038
			"The method add(capture#4-of ? super Exception) in the type List<capture#4-of ? super Exception> is not applicable for the arguments (Object)\n" + 
12039
			"----------\n" + 
12040
			"2. ERROR in X.java (at line 12)\n" + 
12041
			"	list.add(new Throwable());                    // should fail\n" + 
12042
			"	     ^^^\n" + 
12043
			"The method add(capture#5-of ? super Exception) in the type List<capture#5-of ? super Exception> is not applicable for the arguments (Throwable)\n" + 
12044
			"----------\n");	
12045
	}			
12046
	
12047
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78015 
12048
	public void test0411() {
12049
		this.runConformTest(
12050
			new String[] {
12051
				"X.java",
12052
				"interface I<T> {\n" + 
12053
				"    void m1(T t);\n" + 
12054
				"    void m2(T t);\n" + 
12055
				"}\n" + 
12056
				"\n" + 
12057
				"class A {};\n" + 
12058
				"\n" + 
12059
				"class B implements I<A> {\n" + 
12060
				"    public void m1(A a) {\n" + 
12061
				"    	System.out.println(\"SUCCESS\");\n" + 
12062
				"    }\n" + 
12063
				"    public void m2(A a) {}\n" + 
12064
				"}\n" + 
12065
				"\n" + 
12066
				"public class X {\n" + 
12067
				"    public static void main(String[] args) {\n" + 
12068
				"        m(new B());\n" + 
12069
				"    }\n" + 
12070
				"\n" + 
12071
				"    public static void m(I<A> x) {\n" + 
12072
				"        x.m1(null);\n" + 
12073
				"    }\n" + 
12074
				"}",
12075
			},
12076
			"SUCCESS");	
12077
	}		
12078
	
12079
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78467 
12080
	public void test0412() {
12081
		this.runNegativeTest(
12082
			new String[] {
12083
				"X.java",
12084
				"public class X {\n" + 
12085
				"\n" + 
12086
				"    public static <T> T first(T... args) {\n" + 
12087
				"        return args[0];\n" + 
12088
				"    }\n" + 
12089
				"    \n" + 
12090
				"    public static void main(String[] args) {\n" + 
12091
				"    	if (false) { \n" + 
12092
				"    		String s = first(); \n" + 
12093
				"    		int i; \n" + 
12094
				"    		i++; \n" + 
12095
				"    	}\n" + 
12096
				"        System.out.println(first(\"SUCCESS\", \"List\"));\n" + 
12097
				"    }\n" + 
12098
				"   Zork z;\n" +
12099
				"}",
12100
			},
12101
			"----------\n" + 
12102
			"1. ERROR in X.java (at line 15)\n" + 
12103
			"	Zork z;\n" + 
12104
			"	^^^^\n" + 
12105
			"Zork cannot be resolved to a type\n" + 
12106
			"----------\n");	
12107
	}
12108
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78467 - variation
12109
	public void test0412a() {
12110
		this.runNegativeTest(
12111
			new String[] {
12112
				"X.java",
12113
				"import java.util.*;\n" +
12114
				"public class X {\n" + 
12115
				"\n" + 
12116
				"    public static <T> T first(T... args) {\n" + 
12117
				"        return args[0];\n" + 
12118
				"    }\n" + 
12119
				"    \n" + 
12120
				"    public static void main(String[] args) {\n" + 
12121
				"    	if (false) { \n" + 
12122
				"    		List<String> ls = first(); \n" + 
12123
				"    		int i; \n" + 
12124
				"    		i++; \n" + 
12125
				"    	}\n" + 
12126
				"        System.out.println(first(\"SUCCESS\", \"List\"));\n" + 
12127
				"    }\n" + 
12128
				"   Zork z;\n" +
12129
				"}",
12130
			},
12131
			"----------\n" + 
12132
			"1. WARNING in X.java (at line 10)\n" + 
12133
			"	List<String> ls = first(); \n" + 
12134
			"	                  ^^^^^^^\n" + 
12135
			"Type safety : A generic array of List<String> is created for a varargs parameter\n" + 
12136
			"----------\n" + 
12137
			"2. ERROR in X.java (at line 16)\n" + 
12138
			"	Zork z;\n" + 
12139
			"	^^^^\n" + 
12140
			"Zork cannot be resolved to a type\n" + 
12141
			"----------\n");	
12142
	}
12143
	
12144
	public void test0413() {
12145
		this.runConformTest(
12146
			new String[] {
12147
				"X.java",
12148
				"public class X<T> {\n" + 
12149
				"	static class TLM {\n" + 
12150
				"	}\n" + 
12151
				"    TLM getMap(TL t) {\n" + 
12152
				"        return t.tls;\n" + 
12153
				"    }\n" + 
12154
				"    static TLM createInheritedMap(TLM parentMap) {\n" + 
12155
				"        return new TLM();\n" + 
12156
				"    }  \n" + 
12157
				"}\n" + 
12158
				"\n" + 
12159
				"class TL {\n" + 
12160
				"   X.TLM tls = null;\n" + 
12161
				"}",
12162
			},
12163
			"");	
12164
	}
12165
	
12166
	public void test0414() {
12167
		this.runConformTest(
12168
			new String[] {
12169
				"X.java",
12170
				"public class X {\n" + 
12171
				"	void foo(L l, C<? super X> c) {\n" + 
12172
				"		bar(l, c);\n" + 
12173
				"	}\n" + 
12174
				"	<T> void bar(L<T> l, C<? super T> c) { \n" + 
12175
				"	}	\n" + 
12176
				"}\n" + 
12177
				"class C<E> {}\n" + 
12178
				"class L<E> {}",
12179
			},
12180
			"");	
12181
	}
12182
	
12183
	public void test0415() {
12184
		this.runConformTest(
12185
			new String[] {
12186
				"X.java",
12187
				"public class X {\n" + 
12188
				"    public S<M.E<Object,Object>> foo(HM hm) {\n" + 
12189
				"		return C.bar(hm).foo();\n" + 
12190
				"    }\n" + 
12191
				"}\n" + 
12192
				"class C {\n" + 
12193
				"    public static <K,V> M<K,V> bar(M<? extends K,? extends V> m) {\n" + 
12194
				"		return null;\n" + 
12195
				"    }\n" + 
12196
				"}\n" + 
12197
				"class S<E> {\n" + 
12198
				"}\n" + 
12199
				"abstract class HM<U,V> implements M<U,V>{\n" + 
12200
				"}\n" + 
12201
				"interface M<A,B> {\n" + 
12202
				"	static class E<S,T> {}\n" + 
12203
				"	S<E<A,B>> foo();	\n" + 
12204
				"}",
12205
			},
12206
			"");	
12207
	}	
12208
	
12209
	public void test0416() {
12210
		this.runConformTest(
12211
			new String[] {
12212
				"X.java",
12213
				"public class X {\n" + 
12214
				"    public S<M.E<Object,String>> foo(HM hm) {\n" + 
12215
				"    	M<Object, String> m = C.bar(hm);\n" + 
12216
				"    	if (false) return m.foo();\n" + 
12217
				"		return C.bar(hm).foo();\n" + 
12218
				"    }\n" + 
12219
				"}\n" + 
12220
				"class C {\n" + 
12221
				"    public static <K,V> M<K,V> bar(M<? extends K,? extends V> m) {\n" + 
12222
				"		return null;\n" + 
12223
				"    }\n" + 
12224
				"}\n" + 
12225
				"class S<E> {\n" + 
12226
				"}\n" + 
12227
				"abstract class HM<U,V> implements M<U,V>{\n" + 
12228
				"}\n" + 
12229
				"interface M<A,B> {\n" + 
12230
				"	static class E<S,T> {}\n" + 
12231
				"	S<E<A,B>> foo();	\n" + 
12232
				"}",
12233
			},
12234
			"");	
12235
	}
12236
	
12237
	public void test0417() {
12238
		this.runConformTest(
12239
			new String[] {
12240
				"X.java",
12241
				"public class X<E> {\n" + 
12242
				"	\n" + 
12243
				"	<T> X<T> foo(X<T> xt) {\n" + 
12244
				"		return null;\n" + 
12245
				"	}\n" + 
12246
				"	X<E> identity() {\n" + 
12247
				"		return this;\n" + 
12248
				"	}\n" + 
12249
				"	void bar(X x) {\n" + 
12250
				"		X<String> xs = foo(x).identity();\n" + 
12251
				"	}\n" + 
12252
				"}\n",
12253
			},
12254
			"");	
12255
	}			
12256
	
12257
	public void test0418() {
12258
		this.runConformTest(
12259
			new String[] {
12260
				"X.java",
12261
				"public class X<E> {\n" + 
12262
				"	\n" + 
12263
				"	<T> X<T> foo(X<T> xt, X<T> xt2) {\n" + 
12264
				"		return null;\n" + 
12265
				"	}\n" + 
12266
				"	X<E> identity() {\n" + 
12267
				"		return this;\n" + 
12268
				"	}\n" + 
12269
				"	void bar(X x, X<String> xs) {\n" + 
12270
				"		X<String> xs2 = foo(x, xs).identity();\n" + 
12271
				"	}\n" + 
12272
				"}\n",
12273
			},
12274
			"");	
12275
	}			
12276
	
12277
	public void test0419() {
12278
		this.runConformTest(
12279
			new String[] {
12280
				"X.java",
12281
				"public class X<E> {\n" + 
12282
				"	\n" + 
12283
				"	<T,U> X<T> foo(X<T> xt, X<U> xt2) {\n" + 
12284
				"		return null;\n" + 
12285
				"	}\n" + 
12286
				"	X<E> identity() {\n" + 
12287
				"		return this;\n" + 
12288
				"	}\n" + 
12289
				"	void bar(X x, X<String> xs) {\n" + 
12290
				"		X<String> xs2 = foo(x, xs).identity();\n" + 
12291
				"	}\n" + 
12292
				"}\n",
12293
			},
12294
			"");	
12295
	}		
12296
	
12297
	public void test0420() {
12298
		this.runConformTest(
12299
			new String[] {
12300
				"X.java",
12301
				"public class X<E> {\n" + 
12302
				"	\n" + 
12303
				"	<T,U> X<U> foo(X<T> xt, X<U> xt2) {\n" + 
12304
				"		return null;\n" + 
12305
				"	}\n" + 
12306
				"	X<E> identity() {\n" + 
12307
				"		return this;\n" + 
12308
				"	}\n" + 
12309
				"	void bar(X x, X<String> xs) {\n" + 
12310
				"		X<String> xs2 = foo(x, xs).identity();\n" + 
12311
				"	}\n" + 
12312
				"}\n",
12313
			},
12314
			"");	
12315
	}		
12316
	
12317
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78863
12318
	public void test0421() {
12319
		this.runConformTest(
12320
			new String[] {
12321
				"Test.java",
12322
				"import java.util.HashMap;\n" +
12323
				"import java.util.List;\n" +
12324
				"import java.util.Map;\n" +
12325
				"\n" +
12326
				"public class Test\n" +
12327
				"{\n" +
12328
				"  protected Map<Class<? extends Object>, List<Object>> m_test\n" +
12329
				"    = new HashMap<Class<? extends Object>, List<Object>>();\n" +
12330
				"}\n",
12331
				"Test2.java",
12332
				"import java.util.List;\n" +
12333
				"import java.util.Map;\n" +
12334
				"\n" +
12335
				"public class Test2 extends Test\n" +
12336
				"{\n" +
12337
				"  public Map<Class<? extends Object>, List<Object>> test()\n" +
12338
				"  {\n" +
12339
				"    return m_test;\n" +
12340
				"  }\n" +
12341
				"}\n",
12342
			},
12343
			"");	
12344
	}
12345
	
12346
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78704
12347
	public void test0422() {
12348
		this.runNegativeTest(
12349
			new String[] {
12350
				"X.java",
12351
				"public class X<T> {\n" +
12352
				"	String foo() {\n" +
12353
				"		return new X();\n" +
12354
				"	}\n" +
12355
				"}\n",
12356
			},
12357
			"----------\n" + 
12358
			"1. ERROR in X.java (at line 3)\n" + 
12359
			"	return new X();\n" + 
12360
			"	       ^^^^^^^\n" + 
12361
			"Type mismatch: cannot convert from X to String\n" + 
12362
			"----------\n" + 
12363
			"2. WARNING in X.java (at line 3)\n" + 
12364
			"	return new X();\n" + 
12365
			"	           ^\n" + 
12366
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
12367
			"----------\n");
12368
	}
12369
	
12370
	public void test0423() {
12371
		this.runNegativeTest(
12372
			new String[] {
12373
				"X.java",
12374
				"public class X {\n" + 
12375
				"\n" + 
12376
				"    static <T extends X> T bar() {\n" + 
12377
				"        return null;\n" + 
12378
				"    }\n" + 
12379
				"    static <U extends X&Runnable> U foo() {\n" + 
12380
				"        return null;\n" + 
12381
				"    }\n" + 
12382
				"\n" + 
12383
				"    public static void main(String argv[]) {\n" + 
12384
				"    	bar();\n" + 
12385
				"        foo();\n" + 
12386
				"    }\n" + 
12387
				"\n" + 
12388
				"}",
12389
			},
12390
			"----------\n" + 
12391
			"1. ERROR in X.java (at line 12)\n" + 
12392
			"	foo();\n" + 
12393
			"	^^^\n" + 
12394
			"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type X is not a valid substitute for the bounded parameter <U extends X & Runnable>\n" + 
12395
			"----------\n");
12396
	}	
12397
	
12398
	public void test0424() {
12399
		this.runConformTest(
12400
			new String[] {
12401
				"X.java",
12402
				"public class X {\n" + 
12403
				"	\n" + 
12404
				"	<T extends A> T foo(T t) {\n" + 
12405
				"		return t;\n" + 
12406
				"	}\n" + 
12407
				"	public static void main(String[] args) {\n" + 
12408
				"		new X().bar();\n" + 
12409
				"	}\n" + 
12410
				"	void bar() {\n" + 
12411
				"		B b = foo(new B());\n" + 
12412
				"	}\n" + 
12413
				"}\n" + 
12414
				"\n" + 
12415
				"class A {}\n" + 
12416
				"class B extends A {}\n" + 
12417
				"\n",
12418
			},
12419
		"");
12420
	}		
12421
	
12422
	// check tiebreak eliminates related generic methods which are less specific
12423
	public void test0425() {
12424
		this.runNegativeTest(
12425
			new String[] {
12426
				"X.java",
12427
				"import java.io.IOException;\n" + 
12428
				"\n" + 
12429
				"public class X {\n" + 
12430
				"    static <E extends A> void m(E e) { System.out.println(\"A:\"+e.getClass()); }\n" + 
12431
				"    static <F extends B> void m(F f) throws Exception { System.out.println(\"B:\"+f.getClass()); }\n" + 
12432
				"    static <G extends C> void m(G g) throws IOException { System.out.println(\"C:\"+g.getClass()); }\n" + 
12433
				"\n" + 
12434
				"    public static void main(String[] args) {\n" + 
12435
				"        m(new A());\n" + 
12436
				"        m(new B());\n" + 
12437
				"        m(new C());\n" + 
12438
				"    }\n" + 
12439
				"}\n" + 
12440
				"\n" + 
12441
				"class A {}\n" + 
12442
				"class B extends A {}\n" + 
12443
				"class C extends A {}\n" + 
12444
				"\n",
12445
			},
12446
			"----------\n" + 
12447
			"1. ERROR in X.java (at line 10)\n" + 
12448
			"	m(new B());\n" + 
12449
			"	^^^^^^^^^^\n" + 
12450
			"Unhandled exception type Exception\n" + 
12451
			"----------\n" + 
12452
			"2. ERROR in X.java (at line 11)\n" + 
12453
			"	m(new C());\n" + 
12454
			"	^^^^^^^^^^\n" + 
12455
			"Unhandled exception type IOException\n" + 
12456
			"----------\n");
12457
	}			
12458
	
12459
	// check inferred return types are truly based on arguments, and not on parameter erasures
12460
	public void test0426() {
12461
		this.runConformTest(
12462
			new String[] {
12463
				"X.java",
12464
				"public class X {\n" + 
12465
				"    static <E extends A> E m(E e) { System.out.print(\"[A:\"+e.getClass()+\"]\"); return e; }\n" + 
12466
				"\n" + 
12467
				"    public static void main(String[] args) {\n" + 
12468
				"        A a = m(new A());\n" + 
12469
				"        B b = m(new B());\n" + 
12470
				"        C c = m(new C());\n" + 
12471
				"    }\n" + 
12472
				"}\n" + 
12473
				"\n" + 
12474
				"class A {}\n" + 
12475
				"class B extends A {}\n" + 
12476
				"class C extends A {}\n",
12477
			},
12478
			"[A:class A][A:class B][A:class C]");
12479
	}			
12480
	
12481
	// check inferred return types are truly based on arguments, and not on parameter erasures
12482
	public void test0427() {
12483
		this.runConformTest(
12484
			new String[] {
12485
				"X.java",
12486
				"public class X {\n" + 
12487
				"    static <E extends A> E m(E e, E... e2) { System.out.print(\"[A:\"+e.getClass()+\"]\"); return e; }\n" + 
12488
				"    static <F extends B> F m(F f, F... f2) { System.out.print(\"[B:\"+f.getClass()+\"]\"); return f; }\n" + 
12489
				"    static <G extends C> G m(G g, G... g2) { System.out.print(\"[C:\"+g.getClass()+\"]\"); return g; }\n" + 
12490
				"\n" + 
12491
				"    public static void main(String[] args) {\n" + 
12492
				"        A a = m(new A(), new A());\n" + 
12493
				"        B b = m(new B(), new B());\n" + 
12494
				"        C c = m(new C(), new C());\n" + 
12495
				"    }\n" + 
12496
				"}\n" + 
12497
				"\n" + 
12498
				"class A {}\n" + 
12499
				"class B extends A {}\n" + 
12500
				"class C extends A {}\n",
12501
			},
12502
			"[A:class A][B:class B][C:class C]");
12503
	}			
12504
12505
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=79390
12506
	public void test0428() {
12507
		this.runNegativeTest(
12508
			new String[] {
12509
				"X.java",
12510
				"public class X {\n" + 
12511
				"   Zork z;\n" + 
12512
				"	public static void foo() {\n" + 
12513
				"		class A<T extends Number> {\n" + 
12514
				"			T t = null;\n" + 
12515
				"			T get() {\n" + 
12516
				"				return t;\n" + 
12517
				"			}\n" + 
12518
				"		}\n" + 
12519
				"		A<Long> a = new A<Long>() {\n" + 
12520
				"			@Override\n" +
12521
				"			Long get() {\n" +
12522
				"				return new Long(5);\n" + 
12523
				"			}\n" + 
12524
				"		};\n" + 
12525
				"	}\n" + 
12526
				"}\n",
12527
			},
12528
			"----------\n" + 
12529
			"1. ERROR in X.java (at line 2)\n" + 
12530
			"	Zork z;\n" + 
12531
			"	^^^^\n" + 
12532
			"Zork cannot be resolved to a type\n" + 
12533
			"----------\n");
12534
	}		
12535
12536
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12537
	public void test0429() { 
12538
		this.runConformTest(
12539
			new String[] {
12540
				"X1.java",
12541
				"class X1 <T extends Y & Comparable<Y>> {}\n" +
12542
				"abstract class Y implements Comparable<Y> {}",
12543
			},
12544
			""
12545
		);
12546
	}
12547
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12548
	public void test0429a() { 
12549
		this.runConformTest(
12550
			new String[] {
12551
				"X2.java",
12552
				"class X2 <T extends Y & Comparable<Y>> {}\n" +
12553
				"abstract class Y extends Z {}\n" +
12554
				"abstract class Z implements Comparable<Y> {}",
12555
			},
12556
			""
12557
		);
12558
	}
12559
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12560
	public void test0429b() { 
12561
		this.runConformTest(
12562
			new String[] {
12563
				"X3.java",
12564
				"class X3 <T extends Y & Comparable<Z>> {}\n" +
12565
				"abstract class Y extends Z {}\n" +
12566
				"abstract class Z implements Comparable<Z> {}",
12567
			},
12568
			""
12569
		);
12570
	}
12571
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293
12572
	// **
12573
	public void test0429c() { 
12574
		this.runNegativeTest(
12575
			new String[] {
12576
				"X4.java",
12577
				"class X4 <T extends Comparable<Z> & Comparable<Z>> {}\n" +
12578
				"abstract class Y extends Z {}\n" +
12579
				"abstract class Z implements Comparable<Z> {}",
12580
			},
12581
			"----------\n" + 
12582
			"1. ERROR in X4.java (at line 1)\n" + 
12583
			"	class X4 <T extends Comparable<Z> & Comparable<Z>> {}\n" + 
12584
			"	                                    ^^^^^^^^^^\n" + 
12585
			"Duplicate bound Comparable<Z>\n" + 
12586
			"----------\n"
12587
			// no complaints about duplicates if they are both parameterized with same args
12588
			// but you cannot extend Comparable & Comparable so we'll report an error
12589
		);
12590
	}
12591
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12592
	public void test0429d() { 
12593
		this.runNegativeTest(
12594
			new String[] {
12595
				"X5.java",
12596
				"class X5 <T extends Y & Comparable<X5>> {}\n" +
12597
				"abstract class Y implements Comparable<Y> {}",
12598
			},
12599
			"----------\n" + 
12600
			"1. ERROR in X5.java (at line 1)\n" + 
12601
			"	class X5 <T extends Y & Comparable<X5>> {}\n" + 
12602
			"	                        ^^^^^^^^^^\n" + 
12603
			"The interface Comparable cannot be implemented more than once with different arguments: Comparable<X5> and Comparable<Y>\n" + 
12604
			"----------\n" + 
12605
			"2. WARNING in X5.java (at line 1)\n" + 
12606
			"	class X5 <T extends Y & Comparable<X5>> {}\n" + 
12607
			"	                                   ^^\n" + 
12608
			"X5 is a raw type. References to generic type X5<T> should be parameterized\n" + 
12609
			"----------\n"
12610
			// Comparable cannot be inherited with different arguments: <X5> and <Y>
12611
		);
12612
	}
12613
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12614
	public void test0429e() { 
12615
		this.runNegativeTest(
12616
			new String[] {
12617
				"X6.java",
12618
				"class X6 <T extends Y & Comparable<X6>> {}\n" +
12619
				"abstract class Y extends Z {}\n" +
12620
				"abstract class Z implements Comparable<Z> {}",
12621
			},
12622
			"----------\n" + 
12623
			"1. ERROR in X6.java (at line 1)\n" + 
12624
			"	class X6 <T extends Y & Comparable<X6>> {}\n" + 
12625
			"	                        ^^^^^^^^^^\n" + 
12626
			"The interface Comparable cannot be implemented more than once with different arguments: Comparable<X6> and Comparable<Z>\n" + 
12627
			"----------\n" + 
12628
			"2. WARNING in X6.java (at line 1)\n" + 
12629
			"	class X6 <T extends Y & Comparable<X6>> {}\n" + 
12630
			"	                                   ^^\n" + 
12631
			"X6 is a raw type. References to generic type X6<T> should be parameterized\n" + 
12632
			"----------\n"
12633
			// Comparable cannot be inherited with different arguments: <X6> and <Y>
12634
		);
12635
	}
12636
		
12637
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12638
	public void test0429f() { 
12639
		this.runNegativeTest(
12640
			new String[] {
12641
				"X7.java",
12642
				"class X7 <T extends Comparable<Z> & Comparable<X7>> {}\n" +
12643
				"abstract class Y extends Z {}\n" +
12644
				"abstract class Z implements Comparable<Z> {}",
12645
			},
12646
			"----------\n" + 
12647
			"1. ERROR in X7.java (at line 1)\n" + 
12648
			"	class X7 <T extends Comparable<Z> & Comparable<X7>> {}\n" + 
12649
			"	                                    ^^^^^^^^^^\n" + 
12650
			"The interface Comparable cannot be implemented more than once with different arguments: Comparable<X7> and Comparable<Z>\n" + 
12651
			"----------\n" + 
12652
			"2. WARNING in X7.java (at line 1)\n" + 
12653
			"	class X7 <T extends Comparable<Z> & Comparable<X7>> {}\n" + 
12654
			"	                                               ^^\n" + 
12655
			"X7 is a raw type. References to generic type X7<T> should be parameterized\n" + 
12656
			"----------\n"
12657
			// Comparable cannot be inherited with different arguments: <Z> and <X7>
12658
		);
12659
	}
12660
	
12661
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78293	
12662
	public void test0429g() {
12663
		this.runNegativeTest(new String[] {
12664
				"X.java",
12665
				"interface I<T> {}\n" + 
12666
				"\n" + 
12667
				"class A implements I<A>, I<A> {}\n" + 
12668
				"public class X<E extends A & I<E> & I<E>>  {\n" + 
12669
				"}"
12670
			}, 
12671
			"----------\n" + 
12672
			"1. ERROR in X.java (at line 3)\n" + 
12673
			"	class A implements I<A>, I<A> {}\n" + 
12674
			"	                         ^\n" + 
12675
			"Duplicate interface I<A> for the type A\n" + 
12676
			"----------\n" + 
12677
			"2. ERROR in X.java (at line 4)\n" + 
12678
			"	public class X<E extends A & I<E> & I<E>>  {\n" + 
12679
			"	                             ^\n" + 
12680
			"The interface I cannot be implemented more than once with different arguments: I<E> and I<A>\n" + 
12681
			"----------\n" + 
12682
			"3. ERROR in X.java (at line 4)\n" + 
12683
			"	public class X<E extends A & I<E> & I<E>>  {\n" + 
12684
			"	                                    ^\n" + 
12685
			"Duplicate bound I<E>\n" + 
12686
			"----------\n");
12687
	}
12688
	
12689
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=79797
12690
	public void test0430() {
12691
		this.runConformTest(
12692
			new String[] {
12693
				"p/MMM.java",
12694
				"package p;\n" +
12695
				"public interface MMM< F extends MMM<F,G>, G extends NNN> { } \n",
12696
				"p/NNN.java",
12697
				"package p;\n" +
12698
				"public interface NNN { } \n",
12699
			},
12700
			"");
12701
12702
		this.runConformTest(
12703
			new String[] {
12704
				"X.java",
12705
				"import p.MMM;\n" + 
12706
				"import p.NNN;\n" + 
12707
				"\n" + 
12708
				"interface RRR< A extends MMM<A, B>, B extends NNN> {}\n" + 
12709
				"\n" + 
12710
				"class J1 implements MMM<J1, J2> { }\n" + 
12711
				"class J2 implements NNN { }\n" + 
12712
				"\n" + 
12713
				"class J3 implements RRR<J1,J2> {} \n" + 
12714
				"\n" + 
12715
				"public class X {\n" + 
12716
				"  public static void main(String[] args) {\n" + 
12717
				"    J3 thing = null;\n" + 
12718
				"  }\n" + 
12719
				"}\n",
12720
			},
12721
			"",
12722
			null,
12723
			false, // do not flush output
12724
			null);		
12725
	}			
12726
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=79891
12727
	public void test0431() {
12728
		this.runNegativeTest(
12729
			new String[] {
12730
				"X.java",
12731
				"public class X<Type> {\n" + 
12732
				"  private class Element {\n" + 
12733
				"  }\n" + 
12734
				"  public X() {\n" + 
12735
				"    Element[] eArray = new Element[10];\n" + 
12736
				"  }\n" + 
12737
				"}\n",
12738
			},
12739
		"----------\n" + 
12740
		"1. ERROR in X.java (at line 5)\n" + 
12741
		"	Element[] eArray = new Element[10];\n" + 
12742
		"	                   ^^^^^^^^^^^^^^^\n" + 
12743
		"Cannot create a generic array of X<Type>.Element\n" + 
12744
		"----------\n");
12745
	}		
12746
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=79891
12747
	public void test0432() {
12748
		this.runConformTest(
12749
			new String[] {
12750
				"X.java",
12751
				"public class X<Type> {\n" + 
12752
				"  private static class Element {\n" + 
12753
				"  }\n" + 
12754
				"  public X() {\n" + 
12755
				"    Element[] eArray = new Element[10];\n" + 
12756
				"  }\n" + 
12757
				"}\n",
12758
			},
12759
		"");
12760
	}
12761
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80144
12762
	public void test0433() {
12763
		this.runConformTest(
12764
			new String[] {
12765
				"X.java",
12766
				"import java.util.*;\n" + 
12767
				"\n" + 
12768
				"interface Alpha<\n" + 
12769
				"	A1 extends Alpha<A1, B1>, \n" + 
12770
				"	B1 extends Beta<A1, B1>> {\n" + 
12771
				"}\n" + 
12772
				"interface Beta<\n" + 
12773
				"	A2 extends Alpha<A2, B2>, \n" + 
12774
				"	B2 extends Beta<A2, B2>> {\n" + 
12775
				"}\n" + 
12776
				"interface Phi<\n" + 
12777
				"	A3 extends Alpha<A3, B3>, \n" + 
12778
				"	B3 extends Beta<A3, B3>> {\n" + 
12779
				"	\n" + 
12780
				"	public void latinize(A3 s);\n" + 
12781
				"}\n" + 
12782
				"\n" + 
12783
				"public class X<\n" + 
12784
				"	A extends Alpha<A, B>, \n" + 
12785
				"	B extends Beta<A, B>, \n" + 
12786
				"	P extends Phi<A, B>> extends ArrayList<P> implements Phi<A, B> {\n" + 
12787
				"	\n" + 
12788
				"	public final void latinize(A a) {\n" + 
12789
				"		frenchify(this, a); // (X<A,B,P>, A)\n" + 
12790
				"	}\n" + 
12791
				"	// -----------------------------------------------------------------\n" + 
12792
				"	public static final <AA extends Alpha<AA, BB>, BB extends Beta<AA, BB>> \n" + 
12793
				"	void frenchify(Collection< ? extends Phi<AA, BB>> phis, AA aa) {\n" + 
12794
				"		for (final Phi<AA, BB> phi : phis)\n" + 
12795
				"			phi.latinize(aa);\n" + 
12796
				"	}\n" + 
12797
				"}\n",
12798
			},
12799
		"");
12800
	}
12801
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80083
12802
	public void test0434() {
12803
		this.runConformTest(
12804
			new String[] {
12805
				"X.java",
12806
				"import java.util.ArrayList;\n" + 
12807
				"\n" + 
12808
				"public class X\n" + 
12809
				"{\n" + 
12810
				"\n" + 
12811
				"  public static void main(String[] args)\n" + 
12812
				"  {\n" + 
12813
				"    ArrayList<String> l = new ArrayList<String>();\n" + 
12814
				"    l.add(\"x\");\n" + 
12815
				"    String s = \"\";\n" + 
12816
				"    s += l.get(0); // X\n" + 
12817
				"    System.out.println(\"SUCCESS\");\n" + 
12818
				"  }\n" + 
12819
				"\n" + 
12820
				"}\n",
12821
			},
12822
		"SUCCESS");
12823
	}
12824
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80765
12825
	public void test0435() {
12826
		this.runNegativeTest(
12827
			new String[] {
12828
				"Test.java",//===============================
12829
				"import java.lang.reflect.InvocationTargetException;\n" + 
12830
				"import java.lang.reflect.Method;\n" + 
12831
				"\n" + 
12832
				"import orders.DiscreteOrder;\n" + 
12833
				"import orders.impl.IntegerOrder;\n" + 
12834
				"import orders.impl.IntegerOrder2;\n" + 
12835
				"\n" + 
12836
				"public class Test {\n" + 
12837
				"\n" + 
12838
				"    public static void main(String[] args) throws SecurityException,\n" + 
12839
				"            NoSuchMethodException, IllegalArgumentException,\n" + 
12840
				"            IllegalAccessException {\n" + 
12841
				"        Test test = new Test();\n" + 
12842
				"\n" + 
12843
				"        for (String method : new String[] { \"test01\", \"test02\", \"test03\", \"test04\" }) {\n" + 
12844
				"            Method m = test.getClass().getMethod(method);\n" + 
12845
				"            try {\n" + 
12846
				"                m.invoke(test);\n" + 
12847
				"                System.out.print(\"*** \" + m + \": success\");\n" + 
12848
				"            } catch (InvocationTargetException e) {\n" + 
12849
				"                System.out.print(\"*** \" + m + \": failed, stacktrace follows\");\n" + 
12850
				"                e.getCause().printStackTrace(System.out);\n" + 
12851
				"            }\n" + 
12852
				"        }\n" + 
12853
				"    }\n" + 
12854
				"\n" + 
12855
				"    public void test01() { // works\n" + 
12856
				"        new IntegerOrder().next(new Integer(0)); // works\n" + 
12857
				"    }\n" + 
12858
				"\n" + 
12859
				"    public void test02() { // doesn\'t work\n" + 
12860
				"        final DiscreteOrder<Integer> order = new IntegerOrder();\n" + 
12861
				"        order.next(new Integer(0));\n" + 
12862
				"    }\n" + 
12863
				"\n" + 
12864
				"    public void test03() { // works\n" + 
12865
				"        new IntegerOrder2().next(new Integer(0)); // works\n" + 
12866
				"    }\n" + 
12867
				"\n" + 
12868
				"    public void test04() { // doesn\'t work\n" + 
12869
				"        final DiscreteOrder<Integer> order = new IntegerOrder2();\n" + 
12870
				"        order.next(new Integer(0));\n" + 
12871
				"    }\n" + 
12872
				"}\n",
12873
				"orders/DiscreteOrder.java",//===============================
12874
				"package orders;\n" + 
12875
				"public interface DiscreteOrder<E extends Comparable<E>> {\n" + 
12876
				"    /**\n" + 
12877
				"     * @return The element immediately before <code>element</code> in the\n" + 
12878
				"     *         discrete ordered space.\n" + 
12879
				"     */\n" + 
12880
				"    public E previous(E element);\n" + 
12881
				"    /**\n" + 
12882
				"     * @return The element immediately after <code>element</code> in the\n" + 
12883
				"     *         discrete ordered space.\n" + 
12884
				"     */\n" + 
12885
				"    public E next(E element);\n" + 
12886
				"}\n",				
12887
				"orders/impl/IntegerOrder.java",//===============================
12888
				"package orders.impl;\n" + 
12889
				"import orders.DiscreteOrder;\n" + 
12890
				"\n" + 
12891
				"public class IntegerOrder implements DiscreteOrder<Integer> {\n" + 
12892
				"\n" + 
12893
				"    public IntegerOrder() {\n" + 
12894
				"        super();\n" + 
12895
				"    }\n" + 
12896
				"\n" + 
12897
				"    public Integer previous(Integer arg0) {\n" + 
12898
				"        return new Integer(arg0.intValue() - 1);\n" + 
12899
				"    }\n" + 
12900
				"\n" + 
12901
				"    public Integer next(Integer arg0) {\n" + 
12902
				"        return new Integer(arg0.intValue() + 1);\n" + 
12903
				"    }\n" + 
12904
				"}\n",				
12905
				"orders/impl/IntegerOrder2.java",//===============================
12906
				"package orders.impl;\n" + 
12907
				"\n" + 
12908
				"\n" + 
12909
				"public class IntegerOrder2 extends IntegerOrder {\n" + 
12910
				"\n" + 
12911
				"    public IntegerOrder2() {\n" + 
12912
				"        super();\n" + 
12913
				"    }\n" + 
12914
				"\n" + 
12915
				"    public Comparable previous(Comparable arg0) {\n" + 
12916
				"        return previous((Integer) arg0);\n" + 
12917
				"    }\n" + 
12918
				"\n" + 
12919
				"    public Comparable next(Comparable arg0) {\n" + 
12920
				"        return next((Integer) arg0);\n" + 
12921
				"    }\n" + 
12922
				"\n" + 
12923
				"}\n",
12924
			},
12925
			"----------\n" + 
12926
			"1. WARNING in orders\\impl\\IntegerOrder2.java (at line 10)\n" + 
12927
			"	public Comparable previous(Comparable arg0) {\n" + 
12928
			"	       ^^^^^^^^^^\n" + 
12929
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
12930
			"----------\n" + 
12931
			"2. ERROR in orders\\impl\\IntegerOrder2.java (at line 10)\n" + 
12932
			"	public Comparable previous(Comparable arg0) {\n" + 
12933
			"	                  ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
12934
			"Name clash: The method previous(Comparable) of type IntegerOrder2 has the same erasure as previous(E) of type DiscreteOrder<E> but does not override it\n" + 
12935
			"----------\n" + 
12936
			"3. WARNING in orders\\impl\\IntegerOrder2.java (at line 10)\n" + 
12937
			"	public Comparable previous(Comparable arg0) {\n" + 
12938
			"	                           ^^^^^^^^^^\n" + 
12939
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
12940
			"----------\n" + 
12941
			"4. WARNING in orders\\impl\\IntegerOrder2.java (at line 14)\n" + 
12942
			"	public Comparable next(Comparable arg0) {\n" + 
12943
			"	       ^^^^^^^^^^\n" + 
12944
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
12945
			"----------\n" + 
12946
			"5. ERROR in orders\\impl\\IntegerOrder2.java (at line 14)\n" + 
12947
			"	public Comparable next(Comparable arg0) {\n" + 
12948
			"	                  ^^^^^^^^^^^^^^^^^^^^^\n" + 
12949
			"Name clash: The method next(Comparable) of type IntegerOrder2 has the same erasure as next(E) of type DiscreteOrder<E> but does not override it\n" + 
12950
			"----------\n" + 
12951
			"6. WARNING in orders\\impl\\IntegerOrder2.java (at line 14)\n" + 
12952
			"	public Comparable next(Comparable arg0) {\n" + 
12953
			"	                       ^^^^^^^^^^\n" + 
12954
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
12955
			"----------\n"
12956
			// "*** public void Test.test01(): success*** public void Test.test02(): success*** public void Test.test03(): success*** public void Test.test04(): success"
12957
			// name clash: next(java.lang.Comparable) in orders.impl.IntegerOrder2 and next(E) in orders.DiscreteOrder<java.lang.Integer> have the same erasure, yet neither overrides the other
12958
		);
12959
	}
12960
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80028
12961
	public void test0436() {
12962
		this.runConformTest(
12963
			new String[] {
12964
				"A.java",
12965
				"public class A {\n" + 
12966
				"	public static void main(String[] args) {\n" + 
12967
				"		Number n= new Integer(1);\n" + 
12968
				"		X x = new X<Number>();\n" + 
12969
				"		x.m(n);\n" + 
12970
				"		x.m(new Integer(2));\n" + 
12971
				"		Y y= new Y();\n" + 
12972
				"		y.m(n);\n" + 
12973
				"		y.m(new Integer(2));\n" + 
12974
				"	}\n" + 
12975
				"}\n",
12976
				"X.java",
12977
				"class X<T> {\n" + 
12978
				"	public void m(Number num) { System.out.print(\"X.m(Number) = \" + num + ','); }\n" + 
12979
				"	public void m(T t) { System.out.print(\"X.m(T) = \" + t + ','); }\n" + 
12980
				"}\n",
12981
				"Y.java",
12982
				"class Y extends X<Number> {\n" + 
12983
				"	public void m(Number num) { System.out.print(\"Y.m(Number) = \" + num + ','); }\n" + 
12984
				"}\n",
12985
			},
12986
		"X.m(Number) = 1,X.m(Number) = 2,Y.m(Number) = 1,Y.m(Number) = 2,");
12987
	}
12988
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=80028
12989
	public void test0437() {
12990
		this.runConformTest(
12991
			new String[] {
12992
				"A.java",
12993
				"public class A {\n" + 
12994
				"	public static void main(String[] args) {\n" + 
12995
				"		Number n= new Integer(1);\n" + 
12996
				"		X x = new X<Number>();\n" + 
12997
				"		x.m(n);\n" + 
12998
				"		x.m(new Integer(2));\n" + 
12999
				"		Y y= new Y();\n" + 
13000
				"		y.m(n);\n" + 
13001
				"		y.m(new Integer(2));\n" + 
13002
				"	}\n" + 
13003
				"}\n",
13004
				"X.java",
13005
				"class X<T> {\n" + 
13006
				"	public void m(Number num) { System.out.print(\"X.m(Number) = \" + num + ','); }\n" + 
13007
				"	public void m(T t) { System.out.print(\"X.m(T) = \" + t + ','); }\n" + 
13008
				"}\n",
13009
				"Y.java",
13010
				"class Y extends X<Number> {\n" + 
13011
				"	public void m(Number num) { System.out.print(\"Y.m(Number) = \" + num + ','); }\n" + 
13012
				"}\n",
13013
			},
13014
		"X.m(Number) = 1,X.m(Number) = 2,Y.m(Number) = 1,Y.m(Number) = 2,");
13015
	}	
13016
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78591
13017
	public void test0438() {
13018
		this.runNegativeTest(
13019
			new String[] {
13020
				"X.java",
13021
				"import java.util.List;\n" + 
13022
				"public class X<T> {\n" + 
13023
				"    Zork z;\n" +
13024
				"    List<T> list;\n" + 
13025
				"    void add(Object abs) {\n" + 
13026
				"        list.add((T) list.get(0)); // checked cast\n" + 
13027
				"        list.add((T) abs); // unchecked cast\n" + 
13028
				"    }\n" + 
13029
				"    void bar(List<? extends T> other) {\n" + 
13030
				"    	list.add((T) other.get(0)); // checked cast\n" + 
13031
				"    }\n" + 
13032
				"    void baz(List<? super T> other) {\n" + 
13033
				"    	list.add((T) other.get(0)); // unchecked cast\n" + 
13034
				"    }\n" + 
13035
				"}\n",
13036
			},
13037
			"----------\n" + 
13038
			"1. ERROR in X.java (at line 3)\n" + 
13039
			"	Zork z;\n" + 
13040
			"	^^^^\n" + 
13041
			"Zork cannot be resolved to a type\n" + 
13042
			"----------\n" + 
13043
			"2. WARNING in X.java (at line 6)\n" + 
13044
			"	list.add((T) list.get(0)); // checked cast\n" + 
13045
			"	         ^^^^^^^^^^^^^^^\n" + 
13046
			"Unnecessary cast from T to T\n" + 
13047
			"----------\n" + 
13048
			"3. WARNING in X.java (at line 7)\n" + 
13049
			"	list.add((T) abs); // unchecked cast\n" + 
13050
			"	         ^^^^^^^\n" + 
13051
			"Type safety: Unchecked cast from Object to T\n" + 
13052
			"----------\n" + 
13053
			"4. WARNING in X.java (at line 10)\n" + 
13054
			"	list.add((T) other.get(0)); // checked cast\n" + 
13055
			"	         ^^^^^^^^^^^^^^^^\n" + 
13056
			"Unnecessary cast from capture#1-of ? extends T to T\n" + 
13057
			"----------\n" + 
13058
			"5. WARNING in X.java (at line 13)\n" + 
13059
			"	list.add((T) other.get(0)); // unchecked cast\n" + 
13060
			"	         ^^^^^^^^^^^^^^^^\n" + 
13061
			"Type safety: Unchecked cast from capture#2-of ? super T to T\n" + 
13062
			"----------\n");
13063
	}		
13064
13065
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78592
13066
	public void test0439() {
13067
		this.runNegativeTest(
13068
			new String[] {
13069
				"X.java",
13070
				"class Node {\n" + 
13071
				"}\n" + 
13072
				"class Composite<E> {\n" + 
13073
				"}\n" + 
13074
				"class Concrete extends Composite {\n" + 
13075
				"}\n" + 
13076
				"public class X {\n" + 
13077
				"    Composite<Node> comp = new Concrete(); // unchecked cast\n" + 
13078
				"    Zork z;\n" +
13079
				"}\n",
13080
			},
13081
			"----------\n" + 
13082
			"1. WARNING in X.java (at line 5)\n" + 
13083
			"	class Concrete extends Composite {\n" + 
13084
			"	                       ^^^^^^^^^\n" + 
13085
			"Composite is a raw type. References to generic type Composite<E> should be parameterized\n" + 
13086
			"----------\n" + 
13087
			"2. WARNING in X.java (at line 8)\n" + 
13088
			"	Composite<Node> comp = new Concrete(); // unchecked cast\n" + 
13089
			"	                       ^^^^^^^^^^^^^^\n" + 
13090
			"Type safety: The expression of type Concrete needs unchecked conversion to conform to Composite<Node>\n" + 
13091
			"----------\n" + 
13092
			"3. ERROR in X.java (at line 9)\n" + 
13093
			"	Zork z;\n" + 
13094
			"	^^^^\n" + 
13095
			"Zork cannot be resolved to a type\n" + 
13096
			"----------\n");
13097
	}	
13098
	
13099
	public void test0440() {
13100
		this.runNegativeTest(
13101
			new String[] {
13102
				"X.java",
13103
				"public class X<T> {\n" + 
13104
				"	class Y<U> {\n" + 
13105
				"		public void foo(X<T> xt) {\n" + 
13106
				"			U u = (U) xt;\n" + 
13107
				"		}\n" + 
13108
				"	}\n" + 
13109
				"  Zork z;\n" +
13110
				"}\n",
13111
			},
13112
			"----------\n" + 
13113
			"1. WARNING in X.java (at line 4)\n" + 
13114
			"	U u = (U) xt;\n" + 
13115
			"	      ^^^^^^\n" + 
13116
			"Type safety: Unchecked cast from X<T> to U\n" + 
13117
			"----------\n" + 
13118
			"2. ERROR in X.java (at line 7)\n" + 
13119
			"	Zork z;\n" + 
13120
			"	^^^^\n" + 
13121
			"Zork cannot be resolved to a type\n" + 
13122
			"----------\n");
13123
	}		
13124
	
13125
	public void test0441() {
13126
		this.runNegativeTest(
13127
			new String[] {
13128
				"X.java",
13129
				"public class X<T extends Number> {\n" + 
13130
				"    T[] array;\n" + 
13131
				"    X(int s) {\n" + 
13132
				"        array = (T[]) new Number[s];   // Unnecessary cast from Number[] to T[]\n" + 
13133
				"        array = new Number[s];   // Type mismatch: cannot convert from Number[] to T[]\n" + 
13134
				"     }\n" + 
13135
				"}\n",
13136
			},
13137
			"----------\n" + 
13138
			"1. WARNING in X.java (at line 4)\n" + 
13139
			"	array = (T[]) new Number[s];   // Unnecessary cast from Number[] to T[]\n" + 
13140
			"	        ^^^^^^^^^^^^^^^^^^^\n" + 
13141
			"Type safety: Unchecked cast from Number[] to T[]\n" + 
13142
			"----------\n" + 
13143
			"2. ERROR in X.java (at line 5)\n" + 
13144
			"	array = new Number[s];   // Type mismatch: cannot convert from Number[] to T[]\n" + 
13145
			"	        ^^^^^^^^^^^^^\n" + 
13146
			"Type mismatch: cannot convert from Number[] to T[]\n" + 
13147
			"----------\n");
13148
	}		
13149
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82053
13150
	public void test0442() {
13151
		this.runConformTest(
13152
			new String[] {
13153
				"X.java",
13154
				"class Foo {\n" + 
13155
				"	public interface Model {\n" + 
13156
				"	}\n" + 
13157
				"	public interface View<M extends Model> {\n" + 
13158
				"		M getTarget() ;\n" + 
13159
				"	}\n" + 
13160
				"}\n" + 
13161
				"class Bar {\n" + 
13162
				"	public interface Model extends Foo.Model {\n" + 
13163
				"	}\n" + 
13164
				"	public interface View<M extends Model> extends Foo.View<M> {\n" + 
13165
				"	}\n" + 
13166
				"}\n" + 
13167
				"public class X {\n" + 
13168
				"	public void baz() {\n" + 
13169
				"		Bar.View<?> bv = null ;\n" + 
13170
				"		Bar.Model m = bv.getTarget() ;\n" + 
13171
				"	}\n" + 
13172
				"}\n",
13173
			},
13174
			"");
13175
	}		
13176
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81757
13177
	public void test0443() {
13178
		this.runConformTest(
13179
			new String[] {
13180
				"X.java",
13181
				"import java.util.Iterator;\n" + 
13182
				"public class X implements Iterator<String> {\n" + 
13183
				"    public boolean hasNext() { return false; }\n" + 
13184
				"    public String next() { return null; }\n" + 
13185
				"    public void remove() {}\n" + 
13186
				"}\n",
13187
			},
13188
			"");
13189
	}		
13190
	
13191
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81824
13192
	public void test0444() {
13193
		this.runNegativeTest(
13194
			new String[] {
13195
				"X.java",
13196
				"public class X implements I<Integer>, I<String> {}\n" + 
13197
				"interface I<T> {}\n"
13198
			},
13199
			"----------\n" + 
13200
			"1. ERROR in X.java (at line 1)\n" + 
13201
			"	public class X implements I<Integer>, I<String> {}\n" + 
13202
			"	             ^\n" + 
13203
			"The interface I cannot be implemented more than once with different arguments: I<String> and I<Integer>\n" + 
13204
			"----------\n");
13205
	}
13206
13207
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78810
13208
	public void test0445() {
13209
		this.runNegativeTest(
13210
			new String[] {
13211
				"X.java",
13212
				"public abstract class X {\n" + 
13213
				"    public abstract Object getProperty(final Object src, final String name);\n" + 
13214
				"    Zork z;\n" + 
13215
				"    public <T> T getTheProperty(final Object src, final String name)\n" + 
13216
				"    {\n" + 
13217
				"        final T val = (T) getProperty(src, name); // this gives erroneous cast warning\n" + 
13218
				"        return val;\n" + 
13219
				"    }\n" + 
13220
				"}\n"	,
13221
			},
13222
			"----------\n" + 
13223
			"1. ERROR in X.java (at line 3)\n" + 
13224
			"	Zork z;\n" + 
13225
			"	^^^^\n" + 
13226
			"Zork cannot be resolved to a type\n" + 
13227
			"----------\n" + 
13228
			"2. WARNING in X.java (at line 6)\n" + 
13229
			"	final T val = (T) getProperty(src, name); // this gives erroneous cast warning\n" + 
13230
			"	              ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13231
			"Type safety: Unchecked cast from Object to T\n" + 
13232
			"----------\n");
13233
	}		
13234
13235
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 **
13236
	public void test0446() {
13237
		this.runNegativeTest(
13238
			new String[] {
13239
				"X.java",
13240
				"public class X<A> {\n" + 
13241
				"  class Inner<B> { }\n" + 
13242
				"\n" + 
13243
				"  void method() {\n" + 
13244
				"    X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" + 
13245
				"    Inner<Integer> b= new X<A>().new Inner<Integer>();\n" + 
13246
				"    Inner<Integer> c= new Inner<Integer>();\n" + 
13247
				"    // OK\n" + 
13248
				"\n" + 
13249
				"    X<String>.Inner<Integer> d= new X<String>.Inner<Integer>();\n" + 
13250
				"    //eclipse: OK\n" + 
13251
				"    //other: error: \'(\' or \'[\' expected\n" + 
13252
				"\n" + 
13253
				"    X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" + 
13254
				"    X<A>.Inner<Integer> f= new Inner<Integer>();\n" + 
13255
				"    e= b;\n" + 
13256
				"    f= c;\n" + 
13257
				"    //other: OK\n" + 
13258
				"    //eclipse: Type mismatch: cannot convert from X<A>.Inner<Integer> to X<A>.Inner<Integer>\n" + 
13259
				"\n" + 
13260
				"  }\n" + 
13261
				"}\n" + 
13262
				"\n" + 
13263
				"class External {\n" + 
13264
				"  void m() {\n" + 
13265
				"    X<String>.Inner<Integer> x= new X<String>().new Inner<Integer>();\n" + 
13266
				"    // OK\n" + 
13267
				"  }\n" + 
13268
				"}\n",
13269
			},
13270
			"----------\n" + 
13271
			"1. ERROR in X.java (at line 10)\n" + 
13272
			"	X<String>.Inner<Integer> d= new X<String>.Inner<Integer>();\n" + 
13273
			"	                                ^^^^^^^^^^^^^^^\n" + 
13274
			"Cannot allocate the member type X<String>.Inner<Integer> using a parameterized compound name; use its simple name and an enclosing instance of type X<String>\n" + 
13275
			"----------\n");
13276
	}		
13277
	
13278
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 - variation
13279
	public void test0447() {
13280
		this.runNegativeTest(
13281
			new String[] {
13282
				"X.java",
13283
				"public class X<A> {\n" + 
13284
				"  class Inner<B> { }\n" + 
13285
				"\n" + 
13286
				"  void method() {\n" + 
13287
				"    X<String>.Inner<Integer> d1 = new X<String>.Inner<Integer>();\n" + 
13288
				"    X.Inner d2 = new X.Inner();\n" + 
13289
				"    X.Inner<Integer> d3 = new X.Inner<Integer>();\n" + 
13290
				"    d1 = d2;\n" +
13291
				"    d2 = d1;\n" +
13292
				"    d1 = d3;\n" +
13293
				"    d3 = d1;\n" +
13294
				"    d2 = d3;\n" +
13295
				"    d3 = d2;\n" +
13296
				"\n" + 
13297
				"  }\n" + 
13298
				"}\n",
13299
			},
13300
			"----------\n" + 
13301
			"1. ERROR in X.java (at line 5)\n" + 
13302
			"	X<String>.Inner<Integer> d1 = new X<String>.Inner<Integer>();\n" + 
13303
			"	                                  ^^^^^^^^^^^^^^^\n" + 
13304
			"Cannot allocate the member type X<String>.Inner<Integer> using a parameterized compound name; use its simple name and an enclosing instance of type X<String>\n" + 
13305
			"----------\n" + 
13306
			"2. WARNING in X.java (at line 6)\n" + 
13307
			"	X.Inner d2 = new X.Inner();\n" + 
13308
			"	^^^^^^^\n" + 
13309
			"X.Inner is a raw type. References to generic type X<A>.Inner<B> should be parameterized\n" + 
13310
			"----------\n" + 
13311
			"3. WARNING in X.java (at line 6)\n" + 
13312
			"	X.Inner d2 = new X.Inner();\n" + 
13313
			"	                 ^^^^^^^\n" + 
13314
			"X.Inner is a raw type. References to generic type X<A>.Inner<B> should be parameterized\n" + 
13315
			"----------\n" + 
13316
			"4. ERROR in X.java (at line 7)\n" + 
13317
			"	X.Inner<Integer> d3 = new X.Inner<Integer>();\n" + 
13318
			"	^^^^^^^\n" + 
13319
			"The member type X.Inner<Integer> must be qualified with a parameterized type, since it is not static\n" + 
13320
			"----------\n" + 
13321
			"5. ERROR in X.java (at line 7)\n" + 
13322
			"	X.Inner<Integer> d3 = new X.Inner<Integer>();\n" + 
13323
			"	                          ^^^^^^^\n" + 
13324
			"The member type X.Inner<Integer> must be qualified with a parameterized type, since it is not static\n" + 
13325
			"----------\n" + 
13326
			"6. WARNING in X.java (at line 8)\n" + 
13327
			"	d1 = d2;\n" + 
13328
			"	     ^^\n" + 
13329
			"Type safety: The expression of type X.Inner needs unchecked conversion to conform to X<String>.Inner<Integer>\n" + 
13330
			"----------\n" + 
13331
			"7. ERROR in X.java (at line 10)\n" + 
13332
			"	d1 = d3;\n" + 
13333
			"	     ^^\n" + 
13334
			"Type mismatch: cannot convert from X.Inner<Integer> to X<String>.Inner<Integer>\n" + 
13335
			"----------\n" + 
13336
			"8. ERROR in X.java (at line 11)\n" + 
13337
			"	d3 = d1;\n" + 
13338
			"	     ^^\n" + 
13339
			"Type mismatch: cannot convert from X<String>.Inner<Integer> to X.Inner<Integer>\n" + 
13340
			"----------\n" + 
13341
			"9. WARNING in X.java (at line 13)\n" + 
13342
			"	d3 = d2;\n" + 
13343
			"	     ^^\n" + 
13344
			"Type safety: The expression of type X.Inner needs unchecked conversion to conform to X.Inner<Integer>\n" + 
13345
			"----------\n");
13346
	}			
13347
	
13348
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 - variation
13349
	public void test0448() {
13350
		this.runConformTest(
13351
			new String[] {
13352
				"X.java",
13353
				"public class X<A> {\n" + 
13354
				"  static class Inner<B> { }\n" + 
13355
				"\n" + 
13356
				"  void method() {\n" + 
13357
				"    X.Inner<Integer> d = new X.Inner<Integer>();    \n" + 
13358
				"  }\n" + 
13359
				"}\n",
13360
			},
13361
			"");
13362
	}
13363
	
13364
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 - variation
13365
	// **
13366
	public void test0448a() {
13367
		this.runConformTest(
13368
			new String[] {
13369
				"X.java",
13370
				"public class X<T> {\n" + 
13371
				"	class Y {}\n" + 
13372
				"	X<?>.Y[] tab = new X<?>.Y[] {};\n" + 
13373
				"}"
13374
			}, 
13375
			"");
13376
	}
13377
13378
	
13379
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 - variation
13380
	public void test0449() {
13381
		this.runNegativeTest(
13382
			new String[] {
13383
				"X.java",
13384
				"public class X<A> {\n" + 
13385
				"  class Inner<B> { \n" + 
13386
				"  }\n" + 
13387
				"\n" + 
13388
				"  void method() {\n" + 
13389
				"    X<String>.Inner<Integer> d4 = new X.Inner<Integer>();\n" + 
13390
				"  }\n" + 
13391
				"}\n" ,
13392
			},
13393
			"----------\n" + 
13394
			"1. ERROR in X.java (at line 6)\n" + 
13395
			"	X<String>.Inner<Integer> d4 = new X.Inner<Integer>();\n" + 
13396
			"	                              ^^^^^^^^^^^^^^^^^^^^^^\n" + 
13397
			"Type mismatch: cannot convert from X.Inner<Integer> to X<String>.Inner<Integer>\n" + 
13398
			"----------\n" + 
13399
			"2. ERROR in X.java (at line 6)\n" + 
13400
			"	X<String>.Inner<Integer> d4 = new X.Inner<Integer>();\n" + 
13401
			"	                                  ^^^^^^^\n" + 
13402
			"The member type X.Inner<Integer> must be qualified with a parameterized type, since it is not static\n" + 
13403
			"----------\n");
13404
	}			
13405
	
13406
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 - variation
13407
	public void test0450() {
13408
		this.runNegativeTest(
13409
			new String[] {
13410
				"X.java",
13411
				"public class X<A> {\n" + 
13412
				"  static class Inner<B> { \n" + 
13413
				"  }\n" + 
13414
				"\n" + 
13415
				"  void method() {\n" + 
13416
				"    X<String>.Inner<Integer> d4 = new X<String>.Inner<Integer>();\n" + 
13417
				"  }\n" + 
13418
				"}\n" ,
13419
			},
13420
			"----------\n" + 
13421
			"1. ERROR in X.java (at line 6)\n" + 
13422
			"	X<String>.Inner<Integer> d4 = new X<String>.Inner<Integer>();\n" + 
13423
			"	^^^^^^^^^^^^^^^\n" + 
13424
			"The member type X<String>.Inner cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X<String>\n" + 
13425
			"----------\n" + 
13426
			"2. ERROR in X.java (at line 6)\n" + 
13427
			"	X<String>.Inner<Integer> d4 = new X<String>.Inner<Integer>();\n" + 
13428
			"	                                  ^^^^^^^^^^^^^^^\n" + 
13429
			"The member type X<String>.Inner cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X<String>\n" + 
13430
			"----------\n");
13431
	}		
13432
	
13433
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82159 - variation
13434
	// **
13435
	public void test0451() {
13436
		this.runNegativeTest(
13437
			new String[] {
13438
				"X.java",
13439
				"public class X<A> {\n" + 
13440
				"  class Inner<B> { \n" + 
13441
				"  }\n" + 
13442
				"\n" + 
13443
				"  void method() {\n" + 
13444
				"    X<String>.Inner<Integer> d4 = new X<String>.Inner<Integer>() {};\n" + 
13445
				"  }\n" + 
13446
				"}\n" ,
13447
			},
13448
			"----------\n" + 
13449
			"1. ERROR in X.java (at line 6)\n" + 
13450
			"	X<String>.Inner<Integer> d4 = new X<String>.Inner<Integer>() {};\n" + 
13451
			"	                                  ^^^^^^^^^^^^^^^\n" + 
13452
			"Cannot allocate the member type X<String>.Inner<Integer> using a parameterized compound name; use its simple name and an enclosing instance of type X<String>\n" + 
13453
			"----------\n");
13454
	}
13455
13456
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82187
13457
	public void test0452() {
13458
		this.runConformTest(
13459
			new String[] {
13460
				"X.java",
13461
				"import java.util.*;\n" + 
13462
				"\n" + 
13463
				"public class X {\n" + 
13464
				"	\n" + 
13465
				"	 public <E extends Object, S extends Collection<E>> S test01(S param){\n" + 
13466
				"	 	System.out.println(\"SUCCESS\");\n" + 
13467
				"	 	return null;\n" + 
13468
				"	 }\n" + 
13469
				"	 \n" + 
13470
				"	 public void test02() {\n" + 
13471
				"	 	test01(new Vector<String>());\n" + 
13472
				"	 }\n" + 
13473
				"\n" + 
13474
				"	 public static void main(String[] args) {\n" + 
13475
				"		new X().test02();\n" + 
13476
				"	}\n" + 
13477
				"}\n" ,
13478
			},
13479
			"SUCCESS");
13480
	}
13481
13482
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82250
13483
	public void test0453() {
13484
		this.runNegativeTest(
13485
			new String[] {
13486
				"X.java",
13487
				"public class X<T extends I & I> {}\n" + 
13488
				"interface I {}\n" ,
13489
			},
13490
			"----------\n" + 
13491
			"1. ERROR in X.java (at line 1)\n" + 
13492
			"	public class X<T extends I & I> {}\n" + 
13493
			"	                             ^\n" + 
13494
			"Duplicate bound I\n" + 
13495
			"----------\n"
13496
		);
13497
	}
13498
	
13499
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82504
13500
	public void test0454() {
13501
		this.runNegativeTest(
13502
			new String[] {
13503
				"X.java",
13504
				"public class X<T, U extends X> {\n" + 
13505
				"	Object[] objectArr;\n" + 
13506
				"	void foo(T t) {\n" + 
13507
				"		T x1= (T) objectArr;\n" + 
13508
				"		U x2= (U) objectArr;\n" + 
13509
				"		int[] x= (int[]) t;\n" + 
13510
				"	}\n" + 
13511
				"}\n",
13512
			},
13513
			"----------\n" + 
13514
			"1. WARNING in X.java (at line 1)\n" + 
13515
			"	public class X<T, U extends X> {\n" + 
13516
			"	                            ^\n" + 
13517
			"X is a raw type. References to generic type X<T,U> should be parameterized\n" + 
13518
			"----------\n" + 
13519
			"2. WARNING in X.java (at line 4)\n" + 
13520
			"	T x1= (T) objectArr;\n" + 
13521
			"	      ^^^^^^^^^^^^^\n" + 
13522
			"Type safety: Unchecked cast from Object[] to T\n" + 
13523
			"----------\n" + 
13524
			"3. ERROR in X.java (at line 5)\n" + 
13525
			"	U x2= (U) objectArr;\n" + 
13526
			"	      ^^^^^^^^^^^^^\n" + 
13527
			"Cannot cast from Object[] to U\n" + 
13528
			"----------\n");
13529
	}
13530
	
13531
	
13532
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81719
13533
	public void test0455() {
13534
		this.runConformTest(
13535
			new String[] {
13536
				"AbstractTest.java",
13537
				"public abstract class AbstractTest<T> {\n" + 
13538
				"  abstract void array(T[] a);\n" + 
13539
				"  abstract void type(T a);\n" + 
13540
				"  abstract T[] foo();\n" +
13541
				"}\n",
13542
			},
13543
			"");
13544
13545
		this.runConformTest(
13546
			new String[] {
13547
				"Test.java",
13548
				"public class Test<T> extends AbstractTest<T> {\n" + 
13549
				"  void array(T[] a) {}\n" + 
13550
				"  void type(T a) {}\n" + 
13551
				"  T[] foo() { return null; }\n" +
13552
				"}\n",
13553
			},
13554
			"",
13555
			null,
13556
			false, // do not flush output
13557
			null);		
13558
	}
13559
	
13560
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81721
13561
	public void test0456() {
13562
		this.runConformTest(
13563
			new String[] {
13564
				"X.java",
13565
				"interface I<T> {\n" + 
13566
				"	<S extends T> void doTest(S[] a);\n" + 
13567
				"}\n" + 
13568
				"\n" + 
13569
				"abstract class AbstractTest<U> implements I<U> {\n" + 
13570
				"	public <V extends U> void doTest(V[] a) {}\n" + 
13571
				"}\n" + 
13572
				"\n" + 
13573
				"public class X<M> extends AbstractTest<M> {}\n",
13574
			},
13575
			"");
13576
	}
13577
	
13578
	public void test0457() {
13579
		this.runNegativeTest(
13580
			new String[] {
13581
				"X.java",
13582
				"import java.util.List;\n" + 
13583
				"\n" + 
13584
				"public class X {\n" + 
13585
				"	\n" + 
13586
				" void add(List<? super X> l) { \n" + 
13587
				" 	l.add(new X()); \n" + 
13588
				" }\n" + 
13589
				" void add2(List<? extends X> l) { \n" + 
13590
				" 	l.add(new X()); \n" + 
13591
				" }\n" + 
13592
				" \n" + 
13593
				" static <T> void add3(List<T> l, List<T> l2) { \n" + 
13594
				" }\n" + 
13595
				" public static void main(String[] args) {\n" + 
13596
				"	List<X> lx = null;\n" + 
13597
				"	List<String> ls = null;\n" + 
13598
				"	add3(lx, ls);\n" + 
13599
				" } \n" + 
13600
				"}\n",
13601
			},
13602
			"----------\n" + 
13603
			"1. ERROR in X.java (at line 9)\n" + 
13604
			"	l.add(new X()); \n" + 
13605
			"	  ^^^\n" + 
13606
			"The method add(capture#2-of ? extends X) in the type List<capture#2-of ? extends X> is not applicable for the arguments (X)\n" + 
13607
			"----------\n" + 
13608
			"2. ERROR in X.java (at line 17)\n" + 
13609
			"	add3(lx, ls);\n" + 
13610
			"	^^^^\n" + 
13611
			"The method add3(List<T>, List<T>) in the type X is not applicable for the arguments (List<X>, List<String>)\n" + 
13612
			"----------\n");
13613
	}		
13614
13615
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82243
13616
	public void test0458() {
13617
		this.runNegativeTest(
13618
			new String[] {
13619
				"X.java",
13620
				"interface A<E>{\n" + 
13621
				"	E getOne();\n" + 
13622
				"}\n" + 
13623
				"\n" + 
13624
				"\n" + 
13625
				"abstract class B<T extends Number> implements A<T> {\n" + 
13626
				"	Number getTwo() {\n" + 
13627
				"		return getOne(); // succeeds\n" + 
13628
				"	}\n" + 
13629
				"}\n" + 
13630
				"\n" + 
13631
				"abstract class C extends B<Integer> {\n" + 
13632
				"}\n" + 
13633
				"\n" + 
13634
				"public class X {\n" + 
13635
				"	void foo(A a, B b, C c){\n" + 
13636
				"		Object o= a.getOne();\n" + 
13637
				"		Number n1= b.getOne(); // fails\n" + 
13638
				"		Number n2= b.getTwo(); // succeeds, but inlining fails\n" + 
13639
				"		Integer i = c.getOne(); // succeeds\n" + 
13640
				"	}\n" + 
13641
				"}\n",
13642
			},
13643
			"----------\n" + 
13644
			"1. WARNING in X.java (at line 16)\n" + 
13645
			"	void foo(A a, B b, C c){\n" + 
13646
			"	         ^\n" + 
13647
			"A is a raw type. References to generic type A<E> should be parameterized\n" + 
13648
			"----------\n" + 
13649
			"2. WARNING in X.java (at line 16)\n" + 
13650
			"	void foo(A a, B b, C c){\n" + 
13651
			"	              ^\n" + 
13652
			"B is a raw type. References to generic type B<T> should be parameterized\n" + 
13653
			"----------\n" + 
13654
			"3. ERROR in X.java (at line 18)\n" + 
13655
			"	Number n1= b.getOne(); // fails\n" + 
13656
			"	           ^^^^^^^^^^\n" + 
13657
			"Type mismatch: cannot convert from Object to Number\n" + 
13658
			"----------\n");
13659
	}		
13660
	
13661
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=78027 - variation (check unchecked warnings)
13662
	public void test0459() {
13663
		this.runNegativeTest(
13664
			new String[] {
13665
				"X.java",
13666
				"public class X \n" + 
13667
				"{\n" + 
13668
				"Zork z;\n" +
13669
				"}\n" + 
13670
				"\n" + 
13671
				"interface ITest<C extends X>\n" + 
13672
				"{ \n" + 
13673
				"}\n" + 
13674
				"\n" + 
13675
				"abstract class Test<C extends X> implements ITest<C>\n" + 
13676
				"{\n" + 
13677
				"  protected Manager<C> m_manager;\n" + 
13678
				"  \n" + 
13679
				"  public ITest<C> get()\n" + 
13680
				"  {\n" + 
13681
				"    return m_manager.getById(getClass(), new Integer(1));\n" + 
13682
				"  }\n" + 
13683
				"    \n" + 
13684
				"  public static class Manager<C extends X>\n" + 
13685
				"  {\n" + 
13686
				"    public <T extends ITest<C>> T getById(Class<T> cls, Integer id)\n" + 
13687
				"    {\n" + 
13688
				"      return null;\n" + 
13689
				"    }\n" + 
13690
				"  }\n" + 
13691
				"}\n"
13692
			},
13693
			"----------\n" + 
13694
			"1. ERROR in X.java (at line 3)\n" + 
13695
			"	Zork z;\n" + 
13696
			"	^^^^\n" + 
13697
			"Zork cannot be resolved to a type\n" + 
13698
			"----------\n" + 
13699
			"2. WARNING in X.java (at line 16)\n" + 
13700
			"	return m_manager.getById(getClass(), new Integer(1));\n" + 
13701
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13702
			"Type safety: Unchecked invocation getById(Class<capture#1-of ? extends Test>, Integer) of the generic method getById(Class<T>, Integer) of type Test.Manager<C>\n" + 
13703
			"----------\n" + 
13704
			"3. WARNING in X.java (at line 16)\n" + 
13705
			"	return m_manager.getById(getClass(), new Integer(1));\n" + 
13706
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13707
			"Type safety: The expression of type capture#1-of ? extends Test needs unchecked conversion to conform to ITest<C>\n" + 
13708
			"----------\n");
13709
	}
13710
	
13711
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82439
13712
	public void test0460() {
13713
		this.runNegativeTest(
13714
			new String[] {
13715
				"X.java",
13716
				"import java.util.*;\n" + 
13717
				"\n" + 
13718
				"public class X {\n" + 
13719
				"\n" + 
13720
				"	public <E extends Object, S extends Collection<E>> S test(S param) {\n" + 
13721
				"		\n" + 
13722
				"		Class<? extends Collection> c = param.getClass(); // ok\n" + 
13723
				"		Class<? extends Collection> d = getClazz(); // ko\n" + 
13724
				"		return null;\n" + 
13725
				"	}\n" + 
13726
				"	Class<? extends Object> getClazz() {\n" + 
13727
				"		return null;\n" + 
13728
				"	}\n" + 
13729
				"}\n" + 
13730
				"abstract class Z implements Collection<String> {\n" + 
13731
				"	void foo() {\n" + 
13732
				"		Class<? extends Collection> c = getClass(); // ok\n" + 
13733
				"	}\n" + 
13734
				"}\n"
13735
			},
13736
			"----------\n" + 
13737
			"1. WARNING in X.java (at line 7)\n" + 
13738
			"	Class<? extends Collection> c = param.getClass(); // ok\n" + 
13739
			"	                ^^^^^^^^^^\n" + 
13740
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
13741
			"----------\n" + 
13742
			"2. WARNING in X.java (at line 8)\n" + 
13743
			"	Class<? extends Collection> d = getClazz(); // ko\n" + 
13744
			"	                ^^^^^^^^^^\n" + 
13745
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
13746
			"----------\n" + 
13747
			"3. ERROR in X.java (at line 8)\n" + 
13748
			"	Class<? extends Collection> d = getClazz(); // ko\n" + 
13749
			"	                                ^^^^^^^^^^\n" + 
13750
			"Type mismatch: cannot convert from Class<capture#2-of ? extends Object> to Class<? extends Collection>\n" + 
13751
			"----------\n" + 
13752
			"4. WARNING in X.java (at line 17)\n" + 
13753
			"	Class<? extends Collection> c = getClass(); // ok\n" + 
13754
			"	                ^^^^^^^^^^\n" + 
13755
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
13756
			"----------\n");
13757
	}
13758
	
13759
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82844
13760
	public void test0461() {
13761
		this.runNegativeTest(
13762
			new String[] {
13763
				"X.java",
13764
				"public class X<T extends int[]> {\n" + 
13765
				"}\n"
13766
			},
13767
			"----------\n" + 
13768
			"1. ERROR in X.java (at line 1)\n" + 
13769
			"	public class X<T extends int[]> {\n" + 
13770
			"	                         ^^^^^\n" + 
13771
			"The array type int[] cannot be used as a type parameter bound\n" + 
13772
			"----------\n");
13773
	}
13774
	
13775
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79628
13776
	public void test0462() {
13777
		this.runConformTest(
13778
			new String[] {
13779
				"PropertiedObject.java",
13780
				"interface PropertiedObject<B extends PropertiedObject<B>> {}\n" + 
13781
				"interface Model extends PropertiedObject<Model> {}\n" + 
13782
				"interface View<T extends Model,U> extends PropertiedObject<View<?,?>> {}\n"
13783
			},
13784
			"");
13785
	}
13786
	
13787
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79144
13788
	public void test0463() {
13789
		this.runNegativeTest(
13790
			new String[] {
13791
				"X.java",
13792
				"import java.util.Set;\n" + 
13793
				"public class X {\n" + 
13794
				"   Zork z;\n" +
13795
				"	public Set<String>[] test() {\n" + 
13796
				"	   Set[] sets = new Set[10];\n" + 
13797
				"	   return sets;\n" + 
13798
				"	}\n" + 
13799
				"}\n"
13800
			},
13801
			"----------\n" + 
13802
			"1. ERROR in X.java (at line 3)\n" + 
13803
			"	Zork z;\n" + 
13804
			"	^^^^\n" + 
13805
			"Zork cannot be resolved to a type\n" + 
13806
			"----------\n" + 
13807
			"2. WARNING in X.java (at line 5)\n" + 
13808
			"	Set[] sets = new Set[10];\n" + 
13809
			"	^^^\n" + 
13810
			"Set is a raw type. References to generic type Set<E> should be parameterized\n" + 
13811
			"----------\n" + 
13812
			"3. WARNING in X.java (at line 6)\n" + 
13813
			"	return sets;\n" + 
13814
			"	       ^^^^\n" + 
13815
			"Type safety: The expression of type Set[] needs unchecked conversion to conform to Set<String>[]\n" + 
13816
			"----------\n");
13817
	}	
13818
	
13819
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=79144
13820
	public void test0464() {
13821
		this.runNegativeTest(
13822
			new String[] {
13823
				"X.java",
13824
				"import java.util.*;\n" + 
13825
				"\n" + 
13826
				"public class X {\n" + 
13827
				"    Zork z;\n" +
13828
				"    public static void main(String[] args) {\n" + 
13829
				"        List<Integer>[] nums = new List[] {Collections.singletonList(\"Uh oh\")};\n" + 
13830
				"        System.out.println(nums[0].get(0).intValue());\n" + 
13831
				"    } \n" + 
13832
				"}\n"
13833
			},
13834
			"----------\n" + 
13835
			"1. ERROR in X.java (at line 4)\n" + 
13836
			"	Zork z;\n" + 
13837
			"	^^^^\n" + 
13838
			"Zork cannot be resolved to a type\n" + 
13839
			"----------\n" + 
13840
			"2. WARNING in X.java (at line 6)\n" + 
13841
			"	List<Integer>[] nums = new List[] {Collections.singletonList(\"Uh oh\")};\n" + 
13842
			"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
13843
			"Type safety: The expression of type List[] needs unchecked conversion to conform to List<Integer>[]\n" + 
13844
			"----------\n");
13845
	}
13846
13847
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82547
13848
	public void test0465() {
13849
		this.runNegativeTest(
13850
			new String[] {
13851
				"Cla.java",
13852
				"class Cla<T> {\n" + 
13853
				"    T getT() {\n" + 
13854
				"        return null;\n" + 
13855
				"    }\n" + 
13856
				"    \n" + 
13857
				"    void m() {\n" + 
13858
				"        String s= new Cla<String>.getT();\n" + 
13859
				"    }\n" + 
13860
				"}\n"
13861
			},
13862
			"----------\n" + 
13863
			"1. ERROR in Cla.java (at line 7)\n" + 
13864
			"	String s= new Cla<String>.getT();\n" + 
13865
			"	              ^^^^^^^^^^^^^^^^\n" + 
13866
			"Cla.getT cannot be resolved to a type\n" + 
13867
			"----------\n");
13868
	}
13869
13870
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83096
13871
	public void test0466() {
13872
		this.runNegativeTest(
13873
			new String[] {
13874
				"X.java",
13875
				"public class X<A, A> { }\n"
13876
			},
13877
			"----------\n" + 
13878
			"1. ERROR in X.java (at line 1)\n" + 
13879
			"	public class X<A, A> { }\n" + 
13880
			"	                  ^\n" + 
13881
			"Duplicate type parameter A\n" + 
13882
			"----------\n"
13883
		);
13884
	}
13885
	
13886
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82671
13887
	public void test0467() {
13888
		this.runConformTest(
13889
			new String[] {
13890
				"test/Foo.java",
13891
				"package test; \n" + 
13892
				"public class Foo { \n" + 
13893
				"   protected String s; \n" + 
13894
				"   protected String dosomething(){ return \"done\"; } \n" + 
13895
				"   protected class Bar {} \n" +
13896
				"} \n",
13897
				"test02/FooBar.java",
13898
				"package test02; \n" + 
13899
				"import test.Foo; \n" + 
13900
				"public class FooBar<R> extends Foo { \n" + 
13901
				"   void fail() { \n" + 
13902
				"      FooBar f = new FooBar(); \n" + 
13903
				"      f.s = \"foo\"; \n" + 
13904
				"      this.s = \"foo\";\n" + 
13905
				"      f.dosomething(); \n" + 
13906
				"      this.dosomething();  \n" + 
13907
				"      Bar b1; \n" +
13908
				"      FooBar.Bar b2; \n" +
13909
				"      Foo.Bar b3; \n" +
13910
				"   } \n" + 
13911
				"}\n"
13912
			},
13913
			""
13914
		);
13915
	}	
13916
13917
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82671 - variation
13918
	public void test0468() {
13919
		this.runConformTest(
13920
			new String[] {
13921
				"test/Foo.java",
13922
				"package test; \n" + 
13923
				"public class Foo { \n" + 
13924
				"   String s; \n" + 
13925
				"   String dosomething(){ return \"done\"; } \n" + 
13926
				"   class Bar {} \n" +
13927
				"} \n",
13928
				"test/FooBar.java",
13929
				"package test; \n" + 
13930
				"import test.Foo; \n" + 
13931
				"public class FooBar<R> extends Foo { \n" + 
13932
				"   void fail() { \n" + 
13933
				"      FooBar f = new FooBar(); \n" + 
13934
				"      f.s = \"foo\"; \n" + 
13935
				"      this.s = \"foo\";\n" + 
13936
				"      f.dosomething(); \n" + 
13937
				"      this.dosomething();  \n" + 
13938
				"      Bar b1; \n" +
13939
				"      FooBar.Bar b2; \n" +
13940
				"      Foo.Bar b3; \n" +
13941
				"   } \n" + 
13942
				"}\n"
13943
			},
13944
			""
13945
		);
13946
	}	
13947
13948
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83083
13949
	public void test0469() {
13950
		this.runConformTest(
13951
			new String[] {
13952
				"a/C.java",
13953
				"package a; \n" + 
13954
				"import p.B; \n" + 
13955
				"public class C extends B { \n" + 
13956
				"	public void foo(Object obj) {} \n" + 
13957
				"} \n",
13958
				"p/B.java",
13959
				"package p; \n" + 
13960
				"public class B<E> extends A<E> {} \n",
13961
				"p/A.java",
13962
				"package p; \n" + 
13963
				"public class A<E> { \n" + 
13964
				"	public void foo(E e) {} \n" + 
13965
				"}\n",
13966
			},
13967
			""
13968
		);
13969
		this.runConformTest(
13970
			new String[] {
13971
				"a/C.java",
13972
				"package a; \n" + 
13973
				"import p.B; \n" + 
13974
				"public class C extends B { \n" + 
13975
				"	public void foo(Object obj) {} \n" + 
13976
				"} \n",
13977
				"p/A.java",
13978
				"package p; \n" + 
13979
				"public class A<E> { \n" + 
13980
				"	public void foo(E e) {} \n" + 
13981
				"}\n",
13982
			},
13983
			"",
13984
			null,
13985
			false, // do not flush output
13986
			null);			
13987
	}
13988
13989
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83225
13990
	public void test0470() {
13991
		this.runNegativeTest(
13992
			new String[] {
13993
				"X.java",
13994
				"public class X {\n" + 
13995
				"	public static <T> T choose(boolean b, T t1, T t2) {\n" + 
13996
				"		if (b)\n" + 
13997
				"			return t1;\n" + 
13998
				"		return t2;\n" + 
13999
				"	}\n" + 
14000
				"\n" + 
14001
				"	public static void foo() {\n" + 
14002
				"		Comparable s1 = choose(true, \"string\", new Integer(1));\n" + 
14003
				"		Number s2 = choose(true, new Integer(1), new Float(2));\n" + 
14004
				"		Comparable s3 = choose(true, new Integer(1), new Float(2));\n" + 
14005
				"		Cloneable s4 = choose(true, new Integer(1), new Float(2));\n" + 
14006
				"		Cloneable s5 = choose(true, \"string\", new Integer(1));\n" + 
14007
				"	}\n" + 
14008
				"}\n"
14009
			},
14010
			"----------\n" + 
14011
			"1. WARNING in X.java (at line 9)\n" + 
14012
			"	Comparable s1 = choose(true, \"string\", new Integer(1));\n" + 
14013
			"	^^^^^^^^^^\n" + 
14014
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
14015
			"----------\n" + 
14016
			"2. WARNING in X.java (at line 11)\n" + 
14017
			"	Comparable s3 = choose(true, new Integer(1), new Float(2));\n" + 
14018
			"	^^^^^^^^^^\n" + 
14019
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
14020
			"----------\n" + 
14021
			"3. ERROR in X.java (at line 12)\n" + 
14022
			"	Cloneable s4 = choose(true, new Integer(1), new Float(2));\n" + 
14023
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
14024
			"Type mismatch: cannot convert from Number&Comparable<?> to Cloneable\n" + 
14025
			"----------\n" + 
14026
			"4. ERROR in X.java (at line 13)\n" + 
14027
			"	Cloneable s5 = choose(true, \"string\", new Integer(1));\n" + 
14028
			"	               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
14029
			"Type mismatch: cannot convert from Object&Serializable&Comparable<?> to Cloneable\n" + 
14030
			"----------\n");
14031
	}
14032
	
14033
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82671 - variation
14034
	public void test0471() {
14035
		this.runNegativeTest(
14036
			new String[] {
14037
				"test/Foo.java",
14038
				"package test; \n" + 
14039
				"public class Foo<R> { \n" + 
14040
				"   protected R s; \n" + 
14041
				"   protected R dosomething(){ return s; } \n" + 
14042
				"   protected class Bar {} \n" +
14043
				"} \n",
14044
				"test02/FooBar.java",
14045
				"package test02; \n" + 
14046
				"import test.Foo; \n" + 
14047
				"public class FooBar<R> extends Foo<R> { \n" + 
14048
				"   void fail() { \n" + 
14049
				"      FooBar<String> f = new FooBar<String>(); \n" + 
14050
				"      f.s = \"foo\"; \n" + 
14051
				"      this.s = \"foo\";\n" + 
14052
				"      f.dosomething(); \n" + 
14053
				"      this.dosomething();  \n" + 
14054
				"      Bar b1; \n" +
14055
				"      FooBar<String>.Bar b2; \n" +
14056
				"      Foo<String>.Bar b3; \n" +
14057
				"   } \n" + 
14058
				"}\n"
14059
			},
14060
			"----------\n" + 
14061
			"1. ERROR in test02\\FooBar.java (at line 7)\n" + 
14062
			"	this.s = \"foo\";\n" + 
14063
			"	         ^^^^^\n" + 
14064
			"Type mismatch: cannot convert from String to R\n" + 
14065
			"----------\n"	);
14066
	}		
14067
14068
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82671 - variation
14069
	public void test0472() {
14070
		this.runNegativeTest(
14071
			new String[] {
14072
				"test/Foo.java",
14073
				"package test; \n" + 
14074
				"public class Foo<R> { \n" + 
14075
				"   private R s; \n" + 
14076
				"   private R dosomething(){ return s; } \n" + 
14077
				"   private class Bar {} \n" +
14078
				"} \n",
14079
				"test02/FooBar.java",
14080
				"package test02; \n" + 
14081
				"import test.Foo; \n" + 
14082
				"public class FooBar<R> extends Foo<R> { \n" + 
14083
				"   void fail() { \n" + 
14084
				"      FooBar<String> f = new FooBar<String>(); \n" + 
14085
				"      f.s = \"foo\"; \n" + 
14086
				"      this.s = \"foo\";\n" + 
14087
				"      f.dosomething(); \n" + 
14088
				"      this.dosomething();  \n" + 
14089
				"      Bar b1; \n" +
14090
				"      FooBar<String>.Bar b2; \n" +
14091
				"      Foo<String>.Bar b3; \n" +
14092
				"   } \n" + 
14093
				"}\n"
14094
			},
14095
			"----------\n" + 
14096
			"1. WARNING in test\\Foo.java (at line 4)\n" + 
14097
			"	private R dosomething(){ return s; } \n" + 
14098
			"	          ^^^^^^^^^^^^^\n" + 
14099
			"The method dosomething() from the type Foo<R> is never used locally\n" + 
14100
			"----------\n" + 
14101
			"2. WARNING in test\\Foo.java (at line 5)\n" + 
14102
			"	private class Bar {} \n" + 
14103
			"	              ^^^\n" + 
14104
			"The type Foo<R>.Bar is never used locally\n" + 
14105
			"----------\n" + 
14106
			"----------\n" + 
14107
			"1. ERROR in test02\\FooBar.java (at line 6)\n" + 
14108
			"	f.s = \"foo\"; \n" + 
14109
			"	  ^\n" + 
14110
			"The field Foo<String>.s is not visible\n" + 
14111
			"----------\n" + 
14112
			"2. ERROR in test02\\FooBar.java (at line 7)\n" + 
14113
			"	this.s = \"foo\";\n" + 
14114
			"	     ^\n" + 
14115
			"The field Foo<R>.s is not visible\n" + 
14116
			"----------\n" + 
14117
			"3. ERROR in test02\\FooBar.java (at line 8)\n" + 
14118
			"	f.dosomething(); \n" + 
14119
			"	  ^^^^^^^^^^^\n" + 
14120
			"The method dosomething() from the type Foo<String> is not visible\n" + 
14121
			"----------\n" + 
14122
			"4. ERROR in test02\\FooBar.java (at line 9)\n" + 
14123
			"	this.dosomething();  \n" + 
14124
			"	     ^^^^^^^^^^^\n" + 
14125
			"The method dosomething() from the type Foo<R> is not visible\n" + 
14126
			"----------\n" + 
14127
			"5. ERROR in test02\\FooBar.java (at line 10)\n" + 
14128
			"	Bar b1; \n" + 
14129
			"	^^^\n" + 
14130
			"The type Bar is not visible\n" + 
14131
			"----------\n" + 
14132
			"6. ERROR in test02\\FooBar.java (at line 11)\n" + 
14133
			"	FooBar<String>.Bar b2; \n" + 
14134
			"	^^^^^^^^^^^^^^^^^^\n" + 
14135
			"The type FooBar.Bar is not visible\n" + 
14136
			"----------\n" + 
14137
			"7. ERROR in test02\\FooBar.java (at line 12)\n" + 
14138
			"	Foo<String>.Bar b3; \n" + 
14139
			"	^^^^^^^^^^^^^^^\n" + 
14140
			"The type Foo.Bar is not visible\n" + 
14141
			"----------\n");
14142
	}	
14143
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=81594
14144
	public void test0473() {
14145
		this.runConformTest(
14146
			new String[] {
14147
				"X.java",
14148
				"import java.util.*;\n" + 
14149
				"public class X\n" + 
14150
				"{\n" + 
14151
				"	List<B> itsList;\n" + 
14152
				"	B itsB;\n" + 
14153
				"	MyTyped itsTyped;\n" + 
14154
				"	\n" + 
14155
				"	\n" + 
14156
				"	public void test()\n" + 
14157
				"	{\n" + 
14158
				"		method (itsList, itsB, itsTyped);\n" + 
14159
				"	}\n" + 
14160
				"	\n" + 
14161
				"	public <T> void method (List<? extends T> arg1, T arg2, Typed<? super T> arg3)\n" + 
14162
				"	{\n" + 
14163
				"	}\n" + 
14164
				"	\n" + 
14165
				"	interface A{}\n" + 
14166
				"	class B implements A{}\n" + 
14167
				"	class Typed<T>{}\n" + 
14168
				"	class MyTyped extends Typed<A>{}\n" + 
14169
				"\n" + 
14170
				"}\n"
14171
			},
14172
			"");
14173
	}	
14174
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=81594 - variation
14175
	public void test0474() {
14176
		this.runConformTest(
14177
			new String[] {
14178
				"X.java",
14179
				"public class X {\n" + 
14180
				"	Typed<B> itsList;\n" + 
14181
				"	Typed<A> itsTyped;\n" + 
14182
				"	public void test() {\n" + 
14183
				"		method(itsList, itsTyped);\n" + 
14184
				"	}\n" + 
14185
				"	public <T> void method(Typed<? extends T> arg1, Typed<? super T> arg3) {\n" + 
14186
				"	}\n" + 
14187
				"	interface A {\n" + 
14188
				"	}\n" + 
14189
				"	class B implements A {\n" + 
14190
				"	}\n" + 
14191
				"	class Typed<T> {\n" + 
14192
				"	}\n" + 
14193
				"}\n"
14194
			},
14195
			"");
14196
	}	
14197
	
14198
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398
14199
	public void test0475() {
14200
		this.runNegativeTest(
14201
			new String[] {
14202
				"X.java",
14203
				"import java.util.List;\n" + 
14204
				"\n" + 
14205
				"public class X {\n" + 
14206
				"    void method(List<? super Number> list) {\n" + 
14207
				"        list.add(new Object());   // should fail\n" + 
14208
				"        list.add(new Integer(3)); // correct\n" + 
14209
				"    }\n" + 
14210
				"}\n"
14211
			},
14212
			"----------\n" + 
14213
			"1. ERROR in X.java (at line 5)\n" + 
14214
			"	list.add(new Object());   // should fail\n" + 
14215
			"	     ^^^\n" + 
14216
			"The method add(capture#1-of ? super Number) in the type List<capture#1-of ? super Number> is not applicable for the arguments (Object)\n" + 
14217
			"----------\n");
14218
	}		
14219
	
14220
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398 - variation
14221
	public void test0476() {
14222
		this.runNegativeTest(
14223
			new String[] {
14224
				"X.java",
14225
				"import java.util.List;\n" + 
14226
				"\n" + 
14227
				"public class X {\n" + 
14228
				"    void method(List<? super Number> list, List<Object> lo) {\n" + 
14229
				"    	list = lo;\n" + 
14230
				"    	lo = list;\n" + 
14231
				"    }\n" + 
14232
				"}\n"
14233
			},
14234
			"----------\n" + 
14235
			"1. ERROR in X.java (at line 6)\n" + 
14236
			"	lo = list;\n" + 
14237
			"	     ^^^^\n" + 
14238
			"Type mismatch: cannot convert from List<capture#2-of ? super Number> to List<Object>\n" + 
14239
			"----------\n");
14240
	}			
14241
	
14242
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398 - variation
14243
	public void test0477() {
14244
		this.runNegativeTest(
14245
			new String[] {
14246
				"X.java",
14247
				"import java.util.*;\n" + 
14248
				"public class X<T extends Number> {\n" + 
14249
				"	List<? super T> lhs;\n" + 
14250
				"	List<? extends Number> rhs;\n" + 
14251
				"	{\n" + 
14252
				"		lhs.add(rhs.get(0));\n" + 
14253
				"	}\n" + 
14254
				"}\n"
14255
			},
14256
			"----------\n" + 
14257
			"1. ERROR in X.java (at line 6)\n" + 
14258
			"	lhs.add(rhs.get(0));\n" + 
14259
			"	    ^^^\n" + 
14260
			"The method add(capture#1-of ? super T) in the type List<capture#1-of ? super T> is not applicable for the arguments (capture#2-of ? extends Number)\n" + 
14261
			"----------\n");
14262
	}		
14263
	
14264
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398 - variation
14265
	public void test0478() {
14266
		this.runNegativeTest(
14267
			new String[] {
14268
				"X.java",
14269
				"import java.util.*;\n" + 
14270
				"public class X<U extends Number> {\n" + 
14271
				"	List<? super Number> lhs;\n" + 
14272
				"	List<? super U> rhs;\n" + 
14273
				"	{\n" + 
14274
				"		lhs.add(rhs.get(0));\n" + 
14275
				"	}\n" + 
14276
				"}\n"
14277
			},
14278
			"----------\n" + 
14279
			"1. ERROR in X.java (at line 6)\n" + 
14280
			"	lhs.add(rhs.get(0));\n" + 
14281
			"	    ^^^\n" + 
14282
			"The method add(capture#1-of ? super Number) in the type List<capture#1-of ? super Number> is not applicable for the arguments (capture#2-of ? super U)\n" + 
14283
			"----------\n");
14284
	}	
14285
	
14286
	
14287
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398 - variation
14288
	public void test0479() {
14289
		this.runConformTest(
14290
			new String[] {
14291
				"X.java",
14292
				"import java.util.*;\n" + 
14293
				"public class X<U extends Number> {\n" + 
14294
				"	List<? super Number> lhs;\n" + 
14295
				"	List<? extends U> rhs;\n" + 
14296
				"	{\n" + 
14297
				"		lhs.add(rhs.get(0));\n" + 
14298
				"	}\n" + 
14299
				"}\n"
14300
			},
14301
			"");
14302
	}	
14303
14304
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398 - variation
14305
	public void test0480() {
14306
		this.runNegativeTest(
14307
			new String[] {
14308
				"X.java",
14309
				"import java.util.*;\n" + 
14310
				"public class X<U extends Number> {\n" + 
14311
				"	List<? super Integer> lhs;\n" + 
14312
				"	List<? extends Number> rhs;\n" + 
14313
				"	{\n" + 
14314
				"		lhs.add(rhs.get(0));\n" + 
14315
				"	}\n" + 
14316
				"}\n"
14317
			},
14318
			"----------\n" + 
14319
			"1. ERROR in X.java (at line 6)\n" + 
14320
			"	lhs.add(rhs.get(0));\n" + 
14321
			"	    ^^^\n" + 
14322
			"The method add(capture#1-of ? super Integer) in the type List<capture#1-of ? super Integer> is not applicable for the arguments (capture#2-of ? extends Number)\n" + 
14323
			"----------\n");
14324
	}			
14325
14326
14327
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83398 - variation
14328
	public void test0481() {
14329
		this.runNegativeTest(
14330
			new String[] {
14331
				"X.java",
14332
				"import java.util.*;\n" + 
14333
				"public class X<U extends Number> {\n" + 
14334
				"	List<? super Number> lhs;\n" + 
14335
				"	List<? super Integer> rhs;\n" + 
14336
				"	{\n" + 
14337
				"		lhs.add(rhs.get(0));\n" + 
14338
				"	}\n" + 
14339
				"}\n"
14340
			},
14341
			"----------\n" + 
14342
			"1. ERROR in X.java (at line 6)\n" + 
14343
			"	lhs.add(rhs.get(0));\n" + 
14344
			"	    ^^^\n" + 
14345
			"The method add(capture#1-of ? super Number) in the type List<capture#1-of ? super Number> is not applicable for the arguments (capture#2-of ? super Integer)\n" + 
14346
			"----------\n");
14347
	}		
14348
	
14349
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83799
14350
	public void test0482() {
14351
		this.runConformTest(
14352
			new String[] {
14353
				"X.java",
14354
				"public final class X {\n" + 
14355
				"	public <T> void testEquals(final String x, T one, T two) {\n" + 
14356
				"	}\n" + 
14357
				"\n" + 
14358
				"	public <T1, T2> void testEqualsAlt(final String x, T1 one, T2 two) {\n" + 
14359
				"	}\n" + 
14360
				"\n" + 
14361
				"	public interface Fooey {\n" + 
14362
				"	}\n" + 
14363
				"\n" + 
14364
				"	public interface Bar extends Fooey {\n" + 
14365
				"	}\n" + 
14366
				"\n" + 
14367
				"	public interface GenericFooey<T> {\n" + 
14368
				"	}\n" + 
14369
				"\n" + 
14370
				"	public interface GenericBar<T> extends GenericFooey<T> {\n" + 
14371
				"	}\n" + 
14372
				"\n" + 
14373
				"	public void testGeneric() {\n" + 
14374
				"		testEquals(\"Should work\", new GenericBar<Long>() {\n" + 
14375
				"		}, new GenericBar<Long>() {\n" + 
14376
				"		});\n" + 
14377
				"		final GenericBar<Long> child = new GenericBar<Long>() {\n" + 
14378
				"		};\n" + 
14379
				"		final GenericFooey<Long> parent = child;\n" + 
14380
				"		testEquals(\"Doesn\'t work but should\", child, parent); // this\n" + 
14381
				"		// fails\n" + 
14382
				"		// but should work it\'s identical to next line.\n" + 
14383
				"		testEquals(\"Doesn\'t work but should\", (GenericFooey<Long>) child, parent);\n" + 
14384
				"		testEqualsAlt(\"Should work\", child, parent);\n" + 
14385
				"	}\n" + 
14386
				"	public void test() {\n" + 
14387
				"		testEquals(\"Should work\", new Bar() {\n" + 
14388
				"		}, new Bar() {\n" + 
14389
				"		});\n" + 
14390
				"		final Bar child = new Bar() {\n" + 
14391
				"		};\n" + 
14392
				"		final Fooey parent = child;\n" + 
14393
				"		testEquals(\"Doesn\'t work but should\", child, parent);\n" + 
14394
				"		testEquals(\"Doesn\'t work but should\", (Fooey) child, parent);\n" + 
14395
				"		testEqualsAlt(\"Should work\", child, parent);\n" + 
14396
				"	}\n" + 
14397
				"}\n"
14398
			},
14399
			"");
14400
	}
14401
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83904
14402
	public void test0483() {
14403
		this.runNegativeTest(
14404
			new String[] {
14405
				"X.java",
14406
				"class Y<T extends Number> {\n" + 
14407
				"}\n" + 
14408
				"\n" + 
14409
				"public class X {\n" + 
14410
				"    public static void main(String argv[]) {\n" + 
14411
				"        m(new Y<Short>(), new Y<Integer>());\n" + 
14412
				"    }\n" + 
14413
				"\n" + 
14414
				"    public static <T extends Number> void m(Y<T> x, Y<T> y) {\n" + 
14415
				"    }\n" + 
14416
				"}\n" + 
14417
				"\n"
14418
			},
14419
			"----------\n" + 
14420
			"1. ERROR in X.java (at line 6)\n" + 
14421
			"	m(new Y<Short>(), new Y<Integer>());\n" + 
14422
			"	^\n" + 
14423
			"The method m(Y<T>, Y<T>) in the type X is not applicable for the arguments (Y<Short>, Y<Integer>)\n" + 
14424
			"----------\n");
14425
	}			
14426
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82349
14427
	public void test0484() {
14428
		this.runConformTest(
14429
			new String[] {
14430
				"X.java",
14431
				"class Base<T> {\n" + 
14432
				"	public class Inner {\n" + 
14433
				"	}\n" + 
14434
				"	Inner a;\n" + 
14435
				"}\n" + 
14436
				"\n" + 
14437
				"public class X extends Base<Integer> {\n" + 
14438
				"	class DerivedInner extends Inner {\n" + 
14439
				"	}\n" + 
14440
				"	X() {\n" + 
14441
				"		a = new DerivedInner();\n" + 
14442
				"	}\n" + 
14443
				"}\n"
14444
			},
14445
			"");
14446
	}		
14447
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82349 - variation
14448
	public void test0485() {
14449
		this.runConformTest(
14450
			new String[] {
14451
				"X.java",
14452
				"class Base<T> {\n" + 
14453
				"	public class Inner<U> {\n" + 
14454
				"	}\n" + 
14455
				"	Inner a;\n" + 
14456
				"}\n" + 
14457
				"\n" + 
14458
				"public class X extends Base<Integer> {\n" + 
14459
				"	class DerivedInner extends Inner {\n" + 
14460
				"	}\n" + 
14461
				"	X() {\n" + 
14462
				"		a = new DerivedInner();\n" + 
14463
				"	}\n" + 
14464
				"}\n"
14465
			},
14466
			"");
14467
	}		
14468
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=82349 - variation
14469
	public void test0486() {
14470
		this.runConformTest(
14471
			new String[] {
14472
				"X.java",
14473
				"class Base<T> {\n" + 
14474
				"	public class Inner<U> {\n" + 
14475
				"	}\n" + 
14476
				"	Inner a;\n" + 
14477
				"}\n" + 
14478
				"\n" + 
14479
				"public class X extends Base<Integer> {\n" + 
14480
				"	class DerivedInner extends Inner<Float> {\n" + 
14481
				"	}\n" + 
14482
				"	X() {\n" + 
14483
				"		a = new DerivedInner();\n" + 
14484
				"	}\n" + 
14485
				"}\n"
14486
			},
14487
			"");
14488
	}		
14489
	public void test0487() {
14490
		this.runNegativeTest(
14491
			new String[] {
14492
				"X.java",
14493
				"import java.util.*;\n" + 
14494
				"\n" + 
14495
				"public class X {\n" + 
14496
				"	void foo(List<String> ls) {\n" + 
14497
				"		List<?> l = ls;\n" + 
14498
				"		bar(l, \"\"); \n" + 
14499
				"	}\n" + 
14500
				"	<T> void bar(List<? super T> l, T t) {\n" + 
14501
				"	}\n" + 
14502
				"}\n"
14503
			},
14504
			"----------\n" + 
14505
			"1. ERROR in X.java (at line 6)\n" + 
14506
			"	bar(l, \"\"); \n" + 
14507
			"	^^^\n" + 
14508
			"The method bar(List<? super T>, T) in the type X is not applicable for the arguments (List<capture#1-of ?>, String)\n" + 
14509
			"----------\n");
14510
	}
14511
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496
14512
	public void test0488() {
14513
		this.runNegativeTest(
14514
			new String[] {
14515
				"X.java",
14516
				"public class X {\n" + 
14517
				"    public static void main(String[] args) {\n" + 
14518
				"        Foo<?> f1 = new Foo<Integer>();\n" + 
14519
				"        Foo<?> f2 = new Foo<String>();\n" + 
14520
				"        f1.bar = f2.bar;\n" + 
14521
				"    }\n" + 
14522
				"    static class Foo<T> {\n" + 
14523
				"       Bar<T> bar = new Bar<T>();\n" + 
14524
				"    }\n" + 
14525
				"    static class Bar<T> {\n" + 
14526
				"        T t;\n" + 
14527
				"    }\n" + 
14528
				"}\n"
14529
			},
14530
			"----------\n" + 
14531
			"1. ERROR in X.java (at line 5)\n" + 
14532
			"	f1.bar = f2.bar;\n" + 
14533
			"	         ^^^^^^\n" + 
14534
			"Type mismatch: cannot convert from X.Bar<capture#2-of ?> to X.Bar<capture#1-of ?>\n" + 
14535
			"----------\n");
14536
	}		
14537
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496
14538
	public void test0489() {
14539
		this.runNegativeTest(
14540
			new String[] {
14541
				"X.java",
14542
				"public class X {\n" + 
14543
				"    public static void main(String[] args) {\n" + 
14544
				"        Foo<?> f1 = new Foo<Integer>();\n" + 
14545
				"        f1.bar = f1.bar;\n" + 
14546
				"    }\n" + 
14547
				"    static class Foo<T> {\n" + 
14548
				"       Bar<T> bar = new Bar<T>();\n" + 
14549
				"    }\n" + 
14550
				"    static class Bar<T> {\n" + 
14551
				"        T t;\n" + 
14552
				"    }\n" + 
14553
				"}\n"
14554
			},
14555
			"----------\n" + 
14556
			"1. ERROR in X.java (at line 4)\n" + 
14557
			"	f1.bar = f1.bar;\n" + 
14558
			"	         ^^^^^^\n" + 
14559
			"Type mismatch: cannot convert from X.Bar<capture#2-of ?> to X.Bar<capture#1-of ?>\n" + 
14560
			"----------\n");
14561
	}		
14562
	public void test0490() {
14563
		this.runNegativeTest(
14564
			new String[] {
14565
				"X.java",
14566
				"public class X<T> {\n" + 
14567
				"	T t;\n" + 
14568
				"	void foo(X<?> lhs, X<?> rhs) {\n" + 
14569
				"		lhs = rhs;\n" + 
14570
				"		lhs.t = rhs.t;\n" + 
14571
				"	}\n" + 
14572
				"	void bar(X<X<?>> lhs, X<X<?>> rhs) {\n" + 
14573
				"		lhs = rhs;\n" + 
14574
				"		lhs.t = rhs.t;\n" + 
14575
				"	}}\n" + 
14576
				"\n"
14577
			},
14578
			"----------\n" + 
14579
			"1. ERROR in X.java (at line 5)\n" + 
14580
			"	lhs.t = rhs.t;\n" + 
14581
			"	        ^^^^^\n" + 
14582
			"Type mismatch: cannot convert from capture#4-of ? to capture#3-of ?\n" + 
14583
			"----------\n");
14584
	}		
14585
	
14586
	public void test0491() {
14587
		this.runNegativeTest(
14588
			new String[] {
14589
				"X.java",
14590
				"public class X<T> {\n" + 
14591
				"	T t;\n" + 
14592
				"	void foo(X<?> lhs, X<?> rhs) {\n" + 
14593
				"		lhs = rhs;\n" + 
14594
				"		lhs.t = rhs.t;\n" + 
14595
				"	}\n" + 
14596
				"	void bar(X<X<?>> lhs, X<X<?>> rhs) {\n" + 
14597
				"		lhs = rhs;\n" + 
14598
				"		lhs.t = rhs.t;\n" + 
14599
				"	}\n" + 
14600
				"	void baz(X<? super Number> lhs, X<? extends Number> rhs) {\n" + 
14601
				"		lhs = rhs;\n" + 
14602
				"		lhs.t = rhs.t;\n" + 
14603
				"	}\n" + 
14604
				"	void baz2(X<? extends Number> lhs, X<? extends Number> rhs) {\n" + 
14605
				"		lhs = rhs;\n" + 
14606
				"		lhs.t = rhs.t;\n" + 
14607
				"	}\n" + 
14608
				"	void baz3(X<? extends Number> lhs, X<? super Number> rhs) {\n" + 
14609
				"		lhs = rhs;\n" + 
14610
				"		lhs.t = rhs.t;\n" + 
14611
				"	}\n" + 
14612
				"	void baz4(X<? super Number> lhs, X<? super Number> rhs) {\n" + 
14613
				"		lhs = rhs;\n" + 
14614
				"		lhs.t = rhs.t;\n" + 
14615
				"	}\n" + 
14616
				"}\n"
14617
			},
14618
			"----------\n" + 
14619
			"1. ERROR in X.java (at line 5)\n" + 
14620
			"	lhs.t = rhs.t;\n" + 
14621
			"	        ^^^^^\n" + 
14622
			"Type mismatch: cannot convert from capture#4-of ? to capture#3-of ?\n" + 
14623
			"----------\n" + 
14624
			"2. ERROR in X.java (at line 12)\n" + 
14625
			"	lhs = rhs;\n" + 
14626
			"	      ^^^\n" + 
14627
			"Type mismatch: cannot convert from X<capture#8-of ? extends Number> to X<? super Number>\n" + 
14628
			"----------\n" + 
14629
			"3. ERROR in X.java (at line 17)\n" + 
14630
			"	lhs.t = rhs.t;\n" + 
14631
			"	        ^^^^^\n" + 
14632
			"Type mismatch: cannot convert from capture#14-of ? extends Number to capture#13-of ? extends Number\n" + 
14633
			"----------\n" + 
14634
			"4. ERROR in X.java (at line 20)\n" + 
14635
			"	lhs = rhs;\n" + 
14636
			"	      ^^^\n" + 
14637
			"Type mismatch: cannot convert from X<capture#16-of ? super Number> to X<? extends Number>\n" + 
14638
			"----------\n" + 
14639
			"5. ERROR in X.java (at line 21)\n" + 
14640
			"	lhs.t = rhs.t;\n" + 
14641
			"	        ^^^^^\n" + 
14642
			"Type mismatch: cannot convert from capture#18-of ? super Number to capture#17-of ? extends Number\n" + 
14643
			"----------\n" + 
14644
			"6. ERROR in X.java (at line 25)\n" + 
14645
			"	lhs.t = rhs.t;\n" + 
14646
			"	        ^^^^^\n" + 
14647
			"Type mismatch: cannot convert from capture#22-of ? super Number to capture#21-of ? super Number\n" + 
14648
			"----------\n");
14649
	}		
14650
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=81576
14651
	public void test0492() {
14652
		this.runConformTest(
14653
			new String[] {
14654
				"SuperType.java",//====================================
14655
				"public class SuperType<T> {\n" + 
14656
				"	protected InnerType valueWrapper;\n" + 
14657
				"	protected class InnerType {\n" + 
14658
				"		private T value;\n" + 
14659
				"		protected InnerType(T value) {\n" + 
14660
				"			this.value = value;\n" + 
14661
				"		}\n" + 
14662
				"	}\n" + 
14663
				"	public SuperType(T value) {\n" + 
14664
				"		/*\n" + 
14665
				"		 * This constructor exists only to show that the usage of the inner\n" + 
14666
				"		 * class within its enclosing class makes no problems\n" + 
14667
				"		 */\n" + 
14668
				"		this.valueWrapper = new InnerType(value);\n" + 
14669
				"	}\n" + 
14670
				"	protected SuperType() {\n" + 
14671
				"		// Provided for the convenience of subclasses\n" + 
14672
				"	}\n" + 
14673
				"}\n",
14674
				"SubType.java",//====================================
14675
				"public class SubType<T> extends SuperType<T> {\n" + 
14676
				"\n" + 
14677
				"	public SubType(T value) {\n" + 
14678
				"\n" + 
14679
				"		/* The constructor SuperType <T>.InnerType(T) is undefined */\n" + 
14680
				"		InnerType localValueWrapper = new InnerType(value);\n" + 
14681
				"\n" + 
14682
				"		/*\n" + 
14683
				"		 * Type mismatch: cannot convert from SuperType <T>.InnerType to\n" + 
14684
				"		 * SuperType <T>.InnerType\n" + 
14685
				"		 * \n" + 
14686
				"		 * Type safety: The expression of raw type SuperType.InnerType is\n" + 
14687
				"		 * converted to SuperType <T>.InnerType. References to generic type\n" + 
14688
				"		 * SuperType <T>.InnerType should be parametrized.\n" + 
14689
				"		 */\n" + 
14690
				"		localValueWrapper = super.valueWrapper;\n" + 
14691
				"	}\n" + 
14692
				"\n" + 
14693
				"}\n"			
14694
			},
14695
			"");
14696
	}		
14697
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=83611
14698
	public void test0493() {
14699
		this.runConformTest(
14700
			new String[] {
14701
				"X.java",
14702
				"public class X {\n" + 
14703
				"	public class M<T> { M(Class<T> templateClass) {} }\n" + 
14704
				"}\n",
14705
				"Y.java",
14706
				"public class Y extends X {\n" + 
14707
				"	void test() { M<X> m = new M<X>(X.class); }\n" + 
14708
				"}\n"			
14709
			},
14710
			""
14711
		);
14712
		this.runConformTest(
14713
			new String[] {
14714
				"Y.java",
14715
				"public class Y extends X {\n" + 
14716
				"	void test() { M<X> m = new M<X>(X.class); }\n" + 
14717
				"}\n"			
14718
			},
14719
			"",
14720
			null,
14721
			false,
14722
			null
14723
		);
14724
	}
14725
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83615
14726
	public void test0494() {
14727
		this.runNegativeTest(
14728
			new String[] {
14729
				"X.java",//====================================
14730
				"public class X {\n" + 
14731
				"\n" + 
14732
				"	public static void main(String[] args) {\n" + 
14733
				"		Number n= null;\n" + 
14734
				"		Integer i= null;\n" + 
14735
				"		new X().nextTry(i, n);\n" + 
14736
				"		new X().nextTry2(n, i);\n" + 
14737
				"	}	\n" + 
14738
				"	\n" + 
14739
				"	<I, N extends I> void nextTry(I i, N n) {}\n" + 
14740
				"	\n" + 
14741
				"	<N, I extends N> void nextTry2(N n, I i) {}	\n" + 
14742
				"}\n"			
14743
			},
14744
			"----------\n" + 
14745
			"1. ERROR in X.java (at line 6)\n" + 
14746
			"	new X().nextTry(i, n);\n" + 
14747
			"	        ^^^^^^^\n" + 
14748
			"Bound mismatch: The generic method nextTry(I, N) of type X is not applicable for the arguments (Integer, Number). The inferred type Number is not a valid substitute for the bounded parameter <N extends I>\n" + 
14749
			"----------\n");
14750
	}	
14751
	
14752
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84422
14753
	public void test0495() {
14754
		this.runConformTest(
14755
			new String[] {
14756
				"X.java",//====================================
14757
				"import java.util.*;\n" + 
14758
				"\n" + 
14759
				"public class X {\n" + 
14760
				"	List l= null; \n" + 
14761
				"\n" + 
14762
				"	void add(String s) {\n" + 
14763
				"		l.add(s);\n" + 
14764
				"	}\n" + 
14765
				"	\n" + 
14766
				"	void addAll(String[] ss) {\n" + 
14767
				"		l.addAll(Arrays.asList(ss));\n" + 
14768
				"	}\n" + 
14769
				"	\n" + 
14770
				"	String[] get() {\n" + 
14771
				"		return (String[])l.toArray(new String[l.size()]);\n" + 
14772
				"	}\n" + 
14773
				"}\n"
14774
			},
14775
			"");
14776
	}		
14777
	
14778
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84593
14779
	public void test0496() {
14780
		this.runConformTest(
14781
			new String[] {
14782
				"X.java",//====================================
14783
				"class Super<S> {\n" + 
14784
				"	class A<E> { }\n" + 
14785
				"	<T> void take(A<S> o) {\n" +
14786
				"		System.out.println(\"SUCCESS\");\n" +
14787
				"	}\n" + 
14788
				"}\n" + 
14789
				"class Sub extends Super<Double> {\n" + 
14790
				"	void test() {\n" + 
14791
				"		take(new A());\n" + 
14792
				"	}\n" + 
14793
				"}\n" + 
14794
				"public class X {\n" + 
14795
				"	public static void main(String[] args) {\n" + 
14796
				"		new Sub().test();\n" + 
14797
				"	}\n" + 
14798
				"}\n"
14799
			},
14800
			"SUCCESS");
14801
	}		
14802
	
14803
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84593 - variation - uncheck warnings
14804
	public void test0497() {
14805
		this.runNegativeTest(
14806
			new String[] {
14807
				"X.java",//====================================
14808
				"class Super<S> {\n" + 
14809
				"	class A<E> { }\n" + 
14810
				"	<T> void take(A<S> o) {\n" +
14811
				"	}\n" + 
14812
				"}\n" + 
14813
				"class Sub extends Super<Double> {\n" + 
14814
				"	void test() {\n" + 
14815
				"		take(new A());\n" + 
14816
				"	}\n" + 
14817
				"}\n" + 
14818
				"public class X {\n" + 
14819
				"	public static void main(String[] args) {\n" + 
14820
				"		new Sub().test();\n" + 
14821
				"		Zork z;\n" +
14822
				"	}\n" + 
14823
				"}\n"
14824
			},
14825
			"----------\n" + 
14826
			"1. WARNING in X.java (at line 8)\n" + 
14827
			"	take(new A());\n" + 
14828
			"	     ^^^^^^^\n" + 
14829
			"Type safety: The expression of type Super.A needs unchecked conversion to conform to Super<Double>.A<Double>\n" + 
14830
			"----------\n" + 
14831
			"2. WARNING in X.java (at line 8)\n" + 
14832
			"	take(new A());\n" + 
14833
			"	         ^\n" + 
14834
			"Super.A is a raw type. References to generic type Super<S>.A<E> should be parameterized\n" + 
14835
			"----------\n" + 
14836
			"3. ERROR in X.java (at line 14)\n" + 
14837
			"	Zork z;\n" + 
14838
			"	^^^^\n" + 
14839
			"Zork cannot be resolved to a type\n" + 
14840
			"----------\n");
14841
	}
14842
	
14843
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84743 - variation in -source 1.4 mode but 1.5 compliance (ignore covariance)
14844
public void test0498(){
14845
	Map customOptions = getCompilerOptions();
14846
	customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
14847
	this.runNegativeTest(
14848
		new String[] {
14849
			"X.java",
14850
			"interface I {\n" + 
14851
			"   String foo();\n" + 
14852
			"}\n" + 
14853
			"interface J {\n" + 
14854
			"   Object foo();\n" + 
14855
			"}\n" + 
14856
			" \n" + 
14857
			"public class X implements I {\n" + 
14858
			"   public String foo() {\n" + 
14859
			" 	return \"\";\n" + 
14860
			"   }\n" + 
14861
			"   public static void main(String[] args) {\n" + 
14862
			"         I i = new X();\n" + 
14863
			"         try {\n" + 
14864
			"	        J j = (J) i;\n" + 
14865
			"         } catch(ClassCastException e) {\n" + 
14866
			"	        System.out.println(\"SUCCESS\");\n" + 
14867
			"         }\n" + 
14868
			"  }\n" + 
14869
			"}\n"
14870
		},
14871
		"----------\n" + 
14872
		"1. ERROR in X.java (at line 15)\n" + 
14873
		"	J j = (J) i;\n" + 
14874
		"	      ^^^^^\n" + 
14875
		"Cannot cast from I to J\n" + 
14876
		"----------\n",
14877
		null,
14878
		true,
14879
		customOptions);
14880
}
14881
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85157
14882
public void test0499(){
14883
	this.runNegativeTest(
14884
		new String[] {
14885
			"X.java",
14886
			"public class X {\n" + 
14887
			"		 public static void main(String argv[]) {\n" + 
14888
			"		 		 String[] tab1 = new String[0];\n" + 
14889
			"		 		 Integer[] tab2 = new Integer[0];\n" + 
14890
			"		 		 boolean cond = true;\n" + 
14891
			"		 		 Integer[] var = cond ? tab1 : tab2;\n" + 
14892
			"		 		 System.out.println(var);\n" + 
14893
			"		 }\n" + 
14894
			"}\n"
14895
		},
14896
		"----------\n" + 
14897
		"1. ERROR in X.java (at line 6)\n" + 
14898
		"	Integer[] var = cond ? tab1 : tab2;\n" + 
14899
		"	                ^^^^^^^^^^^^^^^^^^\n" + 
14900
		"Type mismatch: cannot convert from Object&Serializable&Comparable<? extends Object&Serializable&Comparable<?>>[] to Integer[]\n" + 
14901
		"----------\n");
14902
}	
14903
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84251
14904
public void test0500(){
14905
	this.runConformTest(
14906
		new String[] {
14907
			"X.java",
14908
			"import java.util.ArrayList;\n" + 
14909
			"import java.util.Collection;\n" + 
14910
			"\n" + 
14911
			"interface Sink<T> { \n" + 
14912
			"	void flush(T t);\n" + 
14913
			"}\n" + 
14914
			"class SimpleSinkImpl<T> implements Sink<T> {\n" + 
14915
			"	public void flush(T t) {}\n" + 
14916
			"}\n" + 
14917
			"public class X {\n" + 
14918
			"\n" + 
14919
			"    private <T> T writeAll(Collection<T> coll, Sink<? super T> snk) { \n" + 
14920
			"        T last = null;\n" + 
14921
			"        for (T t : coll) { \n" + 
14922
			"            last = t;\n" + 
14923
			"            snk.flush(last);\n" + 
14924
			"        }\n" + 
14925
			"        return last;\n" + 
14926
			"    }\n" + 
14927
			"\n" + 
14928
			"    public void test01() {\n" + 
14929
			"        Sink<Object> s = new SimpleSinkImpl<Object>();\n" + 
14930
			"        Collection<String> cs = new ArrayList<String>();\n" + 
14931
			"        cs.add(\"hello!\");\n" + 
14932
			"        cs.add(\"goodbye\");\n" + 
14933
			"        cs.add(\"see you\");\n" + 
14934
			"        \n" + 
14935
			"        String str = this.writeAll(cs, s);  \n" + 
14936
			"    }\n" + 
14937
			"\n" + 
14938
			"    public static void main(String[] args) {\n" + 
14939
			"        X test = new X();\n" + 
14940
			"        \n" + 
14941
			"        test.test01();\n" + 
14942
			"    }\n" + 
14943
			"}\n"
14944
		},
14945
		"");
14946
}
14947
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85303 - variation
14948
	public void test0501() {
14949
		this.runConformTest(
14950
			new String[] {
14951
				"X.java",
14952
				"public class X <T extends AX> {\n" + 
14953
				"    T t;\n" + 
14954
				"    X(T t){\n" + 
14955
				"        this.t = t;\n" + 
14956
				"    }\n" + 
14957
				"    public static void main(String[] args) {\n" + 
14958
				"		X<? extends BX> x = new X<BX<String>>(new BX<String>());\n" + 
14959
				"		System.out.print(x.t.ax);\n" + 
14960
				"		System.out.print(x.t.bx);\n" + 
14961
				"	}\n" + 
14962
				"}\n" + 
14963
				"\n" + 
14964
				"class AX<P> {\n" + 
14965
				"	P ax;\n" + 
14966
				"}\n" + 
14967
				"\n" + 
14968
				"class BX<Q> extends AX<Q> {\n" + 
14969
				"	Q bx;\n" + 
14970
				"}\n",
14971
			},
14972
			"nullnull");		
14973
		String expectedOutput =
14974
			"  // Method descriptor #25 ([Ljava/lang/String;)V\n" + 
14975
			"  // Stack: 4, Locals: 2\n" + 
14976
			"  public static void main(java.lang.String[] args);\n" + 
14977
			"     0  new X [1]\n" + 
14978
			"     3  dup\n" + 
14979
			"     4  new BX [26]\n" + 
14980
			"     7  dup\n" + 
14981
			"     8  invokespecial BX() [28]\n" + 
14982
			"    11  invokespecial X(AX) [29]\n" + 
14983
			"    14  astore_1 [x]\n" + 
14984
			"    15  getstatic java.lang.System.out : java.io.PrintStream [31]\n" + 
14985
			"    18  aload_1 [x]\n" + 
14986
			"    19  getfield X.t : AX [16]\n" + 
14987
			"    22  checkcast BX [26]\n" + 
14988
			"    25  getfield BX.ax : java.lang.Object [37]\n" + 
14989
			"    28  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [41]\n" + 
14990
			"    31  getstatic java.lang.System.out : java.io.PrintStream [31]\n" + 
14991
			"    34  aload_1 [x]\n" + 
14992
			"    35  getfield X.t : AX [16]\n" + 
14993
			"    38  checkcast BX [26]\n" + 
14994
			"    41  getfield BX.bx : java.lang.Object [47]\n" + 
14995
			"    44  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [41]\n" + 
14996
			"    47  return\n" + 
14997
			"      Line numbers:\n" + 
14998
			"        [pc: 0, line: 7]\n" + 
14999
			"        [pc: 15, line: 8]\n" + 
15000
			"        [pc: 31, line: 9]\n" + 
15001
			"        [pc: 47, line: 10]\n" + 
15002
			"      Local variable table:\n" + 
15003
			"        [pc: 0, pc: 48] local: args index: 0 type: java.lang.String[]\n" + 
15004
			"        [pc: 15, pc: 48] local: x index: 1 type: X\n" + 
15005
			"      Local variable type table:\n" + 
15006
			"        [pc: 15, pc: 48] local: x index: 1 type: X<? extends BX>\n";
15007
		
15008
		try {
15009
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
15010
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
15011
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
15012
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
15013
			int index = result.indexOf(expectedOutput);
15014
			if (index == -1 || expectedOutput.length() == 0) {
15015
				System.out.println(Util.displayString(result, 3));
15016
			}
15017
			if (index == -1) {
15018
				assertEquals("Wrong contents", expectedOutput, result);
15019
			}
15020
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
15021
			assertTrue(false);
15022
		} catch (IOException e) {
15023
			assertTrue(false);
15024
		}
15025
	}
15026
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85303 - variation
15027
	public void test0502() {
15028
		this.runConformTest(
15029
			new String[] {
15030
				"X.java",
15031
				"public class X <T extends AX> {\n" + 
15032
				"    T t;\n" + 
15033
				"    X(T t){\n" + 
15034
				"        this.t = t;\n" + 
15035
				"    }\n" + 
15036
				"    public static void main(String[] args) {\n" + 
15037
				"		X<? extends BX> x = new X<BX<String>>(new BX<String>());\n" + 
15038
				"		System.out.print(x.self().t.ax);\n" + 
15039
				"		System.out.print(x.self().t.bx);\n" + 
15040
				"	}\n" + 
15041
				"	X<T> self() {\n" + 
15042
				"		return this;\n" + 
15043
				"	}\n" + 
15044
				"}\n" + 
15045
				"\n" + 
15046
				"class AX<P> {\n" + 
15047
				"	P ax;\n" + 
15048
				"}\n" + 
15049
				"\n" + 
15050
				"class BX<Q> extends AX<Q> {\n" + 
15051
				"	Q bx;\n" + 
15052
				"}\n",
15053
			},
15054
			"nullnull");		
15055
		String expectedOutput =
15056
			"  // Method descriptor #25 ([Ljava/lang/String;)V\n" + 
15057
			"  // Stack: 4, Locals: 2\n" + 
15058
			"  public static void main(java.lang.String[] args);\n" + 
15059
			"     0  new X [1]\n" + 
15060
			"     3  dup\n" + 
15061
			"     4  new BX [26]\n" + 
15062
			"     7  dup\n" + 
15063
			"     8  invokespecial BX() [28]\n" + 
15064
			"    11  invokespecial X(AX) [29]\n" + 
15065
			"    14  astore_1 [x]\n" + 
15066
			"    15  getstatic java.lang.System.out : java.io.PrintStream [31]\n" + 
15067
			"    18  aload_1 [x]\n" + 
15068
			"    19  invokevirtual X.self() : X [37]\n" + 
15069
			"    22  getfield X.t : AX [16]\n" + 
15070
			"    25  checkcast BX [26]\n" + 
15071
			"    28  getfield BX.ax : java.lang.Object [41]\n" + 
15072
			"    31  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [45]\n" + 
15073
			"    34  getstatic java.lang.System.out : java.io.PrintStream [31]\n" + 
15074
			"    37  aload_1 [x]\n" + 
15075
			"    38  invokevirtual X.self() : X [37]\n" + 
15076
			"    41  getfield X.t : AX [16]\n" + 
15077
			"    44  checkcast BX [26]\n" + 
15078
			"    47  getfield BX.bx : java.lang.Object [51]\n" + 
15079
			"    50  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [45]\n" + 
15080
			"    53  return\n" + 
15081
			"      Line numbers:\n" + 
15082
			"        [pc: 0, line: 7]\n" + 
15083
			"        [pc: 15, line: 8]\n" + 
15084
			"        [pc: 34, line: 9]\n" + 
15085
			"        [pc: 53, line: 10]\n" + 
15086
			"      Local variable table:\n" + 
15087
			"        [pc: 0, pc: 54] local: args index: 0 type: java.lang.String[]\n" + 
15088
			"        [pc: 15, pc: 54] local: x index: 1 type: X\n" + 
15089
			"      Local variable type table:\n" + 
15090
			"        [pc: 15, pc: 54] local: x index: 1 type: X<? extends BX>\n";
15091
		
15092
		try {
15093
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
15094
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
15095
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
15096
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
15097
			int index = result.indexOf(expectedOutput);
15098
			if (index == -1 || expectedOutput.length() == 0) {
15099
				System.out.println(Util.displayString(result, 3));
15100
			}
15101
			if (index == -1) {
15102
				assertEquals("Wrong contents", expectedOutput, result);
15103
			}
15104
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
15105
			assertTrue(false);
15106
		} catch (IOException e) {
15107
			assertTrue(false);
15108
		}
15109
	}	
15110
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85303 - variation
15111
	public void test0503() {
15112
		this.runConformTest(
15113
			new String[] {
15114
				"X.java",
15115
				"class XA {}\n" + 
15116
				"interface XB {\n" + 
15117
				"	XB CONST = new XB(){ public String toString() { return \"SUCCESS\"; }};\n" + 
15118
				"}\n" + 
15119
				"class XAB extends XA implements XB {}\n" + 
15120
				"\n" + 
15121
				"public class X <E extends XA&XB> {\n" + 
15122
				"	E e;\n" + 
15123
				"  public static void main(String[] args) {\n" + 
15124
				"	  System.out.print(new X<XAB>().e.CONST);\n" + 
15125
				"	  new X<XAB>().foo();\n" + 
15126
				"  }\n" + 
15127
				"  public void foo() {\n" + 
15128
				"    System.out.print(this.e.CONST);\n" + 
15129
				"  }\n" + 
15130
				"}\n",
15131
			},
15132
			"SUCCESSSUCCESS");		
15133
		String expectedOutput =
15134
			"// Signature: <E:LXA;:LXB;>Ljava/lang/Object;\n" + 
15135
			"public class X {\n" + 
15136
			"  \n" + 
15137
			"  // Field descriptor #6 LXA;\n" + 
15138
			"  // Signature: TE;\n" + 
15139
			"  XA e;\n" + 
15140
			"  \n" + 
15141
			"  // Method descriptor #10 ()V\n" + 
15142
			"  // Stack: 1, Locals: 1\n" + 
15143
			"  public X();\n" + 
15144
			"    0  aload_0 [this]\n" + 
15145
			"    1  invokespecial java.lang.Object() [12]\n" + 
15146
			"    4  return\n" + 
15147
			"      Line numbers:\n" + 
15148
			"        [pc: 0, line: 7]\n" + 
15149
			"      Local variable table:\n" + 
15150
			"        [pc: 0, pc: 5] local: this index: 0 type: X\n" + 
15151
			"      Local variable type table:\n" + 
15152
			"        [pc: 0, pc: 5] local: this index: 0 type: X<E>\n" + 
15153
			"  \n" + 
15154
			"  // Method descriptor #21 ([Ljava/lang/String;)V\n" + 
15155
			"  // Stack: 3, Locals: 1\n" + 
15156
			"  public static void main(java.lang.String[] args);\n" + 
15157
			"     0  getstatic java.lang.System.out : java.io.PrintStream [22]\n" + 
15158
			"     3  new X [1]\n" + 
15159
			"     6  dup\n" + 
15160
			"     7  invokespecial X() [28]\n" + 
15161
			"    10  getfield X.e : XA [29]\n" + 
15162
			"    13  checkcast XAB [31]\n" + 
15163
			"    16  pop\n" + 
15164
			"    17  getstatic XAB.CONST : XB [33]\n" + 
15165
			"    20  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [37]\n" + 
15166
			"    23  new X [1]\n" + 
15167
			"    26  dup\n" + 
15168
			"    27  invokespecial X() [28]\n" + 
15169
			"    30  invokevirtual X.foo() : void [43]\n" + 
15170
			"    33  return\n" + 
15171
			"      Line numbers:\n" + 
15172
			"        [pc: 0, line: 10]\n" + 
15173
			"        [pc: 23, line: 11]\n" + 
15174
			"        [pc: 33, line: 12]\n" + 
15175
			"      Local variable table:\n" + 
15176
			"        [pc: 0, pc: 34] local: args index: 0 type: java.lang.String[]\n" + 
15177
			"  \n" + 
15178
			"  // Method descriptor #10 ()V\n" + 
15179
			"  // Stack: 2, Locals: 1\n" + 
15180
			"  public void foo();\n" + 
15181
			"     0  getstatic java.lang.System.out : java.io.PrintStream [22]\n" + 
15182
			"     3  getstatic XB.CONST : XB [48]\n" + 
15183
			"     6  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [37]\n" + 
15184
			"     9  return\n" + 
15185
			"      Line numbers:\n" + 
15186
			"        [pc: 0, line: 14]\n" + 
15187
			"        [pc: 9, line: 15]\n" + 
15188
			"      Local variable table:\n" + 
15189
			"        [pc: 0, pc: 10] local: this index: 0 type: X\n" + 
15190
			"      Local variable type table:\n" + 
15191
			"        [pc: 0, pc: 10] local: this index: 0 type: X<E>\n";
15192
		
15193
		try {
15194
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
15195
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
15196
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
15197
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
15198
			int index = result.indexOf(expectedOutput);
15199
			if (index == -1 || expectedOutput.length() == 0) {
15200
				System.out.println(Util.displayString(result, 3));
15201
			}
15202
			if (index == -1) {
15203
				assertEquals("Wrong contents", expectedOutput, result);
15204
			}
15205
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
15206
			assertTrue(false);
15207
		} catch (IOException e) {
15208
			assertTrue(false);
15209
		}
15210
	}		
15211
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85303 - variation
15212
	public void test0504() {
15213
		this.runConformTest(
15214
			new String[] {
15215
				"X.java",
15216
				"class XA {}\n" + 
15217
				"interface XB {\n" + 
15218
				"	XB CONST = new XB(){ public String toString() { return \"SUCCESS\"; }};\n" + 
15219
				"}\n" + 
15220
				"class XAB extends XA implements XB {}\n" + 
15221
				"\n" + 
15222
				"public class X <E extends XA&XB> {\n" + 
15223
				"  E e() { return null; }\n" + 
15224
				"  public static void main(String[] args) {\n" + 
15225
				"	  System.out.print(new X<XAB>().e().CONST);\n" + 
15226
				"	  new X<XAB>().foo();\n" + 
15227
				"  }\n" + 
15228
				"  public void foo() {\n" + 
15229
				"    System.out.print(this.e().CONST);\n" + 
15230
				"  }\n" + 
15231
				"}\n",
15232
			},
15233
			"SUCCESSSUCCESS");		
15234
		String expectedOutput =
15235
			"// Signature: <E:LXA;:LXB;>Ljava/lang/Object;\n" + 
15236
			"public class X {\n" + 
15237
			"  \n" + 
15238
			"  // Method descriptor #6 ()V\n" + 
15239
			"  // Stack: 1, Locals: 1\n" + 
15240
			"  public X();\n" + 
15241
			"    0  aload_0 [this]\n" + 
15242
			"    1  invokespecial java.lang.Object() [8]\n" + 
15243
			"    4  return\n" + 
15244
			"      Line numbers:\n" + 
15245
			"        [pc: 0, line: 7]\n" + 
15246
			"      Local variable table:\n" + 
15247
			"        [pc: 0, pc: 5] local: this index: 0 type: X\n" + 
15248
			"      Local variable type table:\n" + 
15249
			"        [pc: 0, pc: 5] local: this index: 0 type: X<E>\n" + 
15250
			"  \n" + 
15251
			"  // Method descriptor #17 ()LXA;\n" + 
15252
			"  // Signature: ()TE;\n" + 
15253
			"  // Stack: 1, Locals: 1\n" + 
15254
			"  XA e();\n" + 
15255
			"    0  aconst_null\n" + 
15256
			"    1  areturn\n" + 
15257
			"      Line numbers:\n" + 
15258
			"        [pc: 0, line: 8]\n" + 
15259
			"      Local variable table:\n" + 
15260
			"        [pc: 0, pc: 2] local: this index: 0 type: X\n" + 
15261
			"      Local variable type table:\n" + 
15262
			"        [pc: 0, pc: 2] local: this index: 0 type: X<E>\n" + 
15263
			"  \n" + 
15264
			"  // Method descriptor #21 ([Ljava/lang/String;)V\n" + 
15265
			"  // Stack: 3, Locals: 1\n" + 
15266
			"  public static void main(java.lang.String[] args);\n" + 
15267
			"     0  getstatic java.lang.System.out : java.io.PrintStream [22]\n" + 
15268
			"     3  new X [1]\n" + 
15269
			"     6  dup\n" + 
15270
			"     7  invokespecial X() [28]\n" + 
15271
			"    10  invokevirtual X.e() : XA [29]\n" + 
15272
			"    13  checkcast XAB [31]\n" + 
15273
			"    16  pop\n" + 
15274
			"    17  getstatic XAB.CONST : XB [33]\n" + 
15275
			"    20  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [37]\n" + 
15276
			"    23  new X [1]\n" + 
15277
			"    26  dup\n" + 
15278
			"    27  invokespecial X() [28]\n" + 
15279
			"    30  invokevirtual X.foo() : void [43]\n" + 
15280
			"    33  return\n" + 
15281
			"      Line numbers:\n" + 
15282
			"        [pc: 0, line: 10]\n" + 
15283
			"        [pc: 23, line: 11]\n" + 
15284
			"        [pc: 33, line: 12]\n" + 
15285
			"      Local variable table:\n" + 
15286
			"        [pc: 0, pc: 34] local: args index: 0 type: java.lang.String[]\n" + 
15287
			"  \n" + 
15288
			"  // Method descriptor #6 ()V\n" + 
15289
			"  // Stack: 2, Locals: 1\n" + 
15290
			"  public void foo();\n" + 
15291
			"     0  getstatic java.lang.System.out : java.io.PrintStream [22]\n" + 
15292
			"     3  aload_0 [this]\n" + 
15293
			"     4  invokevirtual X.e() : XA [29]\n" + 
15294
			"     7  pop\n" + 
15295
			"     8  getstatic XB.CONST : XB [48]\n" + 
15296
			"    11  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [37]\n" + 
15297
			"    14  return\n" + 
15298
			"      Line numbers:\n" + 
15299
			"        [pc: 0, line: 14]\n" + 
15300
			"        [pc: 14, line: 15]\n" + 
15301
			"      Local variable table:\n" + 
15302
			"        [pc: 0, pc: 15] local: this index: 0 type: X\n" + 
15303
			"      Local variable type table:\n" + 
15304
			"        [pc: 0, pc: 15] local: this index: 0 type: X<E>\n";
15305
		
15306
		try {
15307
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
15308
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
15309
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
15310
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
15311
			int index = result.indexOf(expectedOutput);
15312
			if (index == -1 || expectedOutput.length() == 0) {
15313
				System.out.println(Util.displayString(result, 3));
15314
			}
15315
			if (index == -1) {
15316
				assertEquals("Wrong contents", expectedOutput, result);
15317
			}
15318
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
15319
			assertTrue(false);
15320
		} catch (IOException e) {
15321
			assertTrue(false);
15322
		}
15323
	}			
15324
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85303 - variation
15325
	public void test0505() {
15326
		this.runConformTest(
15327
			new String[] {
15328
				"X.java",
15329
				"class XA {}\n" + 
15330
				"interface XB {\n" + 
15331
				"	XB CONST = new XB(){ public String toString() { return \"SUCCESS\"; }};\n" + 
15332
				"}\n" + 
15333
				"class XAB extends XA implements XB {}\n" + 
15334
				"\n" + 
15335
				"public class X <E extends XA&XB> {\n" + 
15336
				"  E e;\n" + 
15337
				"  public static void main(String[] args) {\n" + 
15338
				"	  new X<XAB>().foo();\n" + 
15339
				"  }\n" + 
15340
				"  public void foo() {\n" + 
15341
				"	new Object() {\n" + 
15342
				"		void run() {\n" + 
15343
				"			System.out.print(e.CONST);\n" + 
15344
				"		}\n" + 
15345
				"	}.run();\n" + 
15346
				"    System.out.print(e.CONST);\n" + 
15347
				"  }\n" + 
15348
				"}\n",
15349
			},
15350
			"SUCCESSSUCCESS");		
15351
		String expectedOutput =
15352
			"// Signature: <E:LXA;:LXB;>Ljava/lang/Object;\n" + 
15353
			"public class X {\n" + 
15354
			"  \n" + 
15355
			"  // Field descriptor #6 LXA;\n" + 
15356
			"  // Signature: TE;\n" + 
15357
			"  XA e;\n" + 
15358
			"  \n" + 
15359
			"  // Method descriptor #10 ()V\n" + 
15360
			"  // Stack: 1, Locals: 1\n" + 
15361
			"  public X();\n" + 
15362
			"    0  aload_0 [this]\n" + 
15363
			"    1  invokespecial java.lang.Object() [12]\n" + 
15364
			"    4  return\n" + 
15365
			"      Line numbers:\n" + 
15366
			"        [pc: 0, line: 7]\n" + 
15367
			"      Local variable table:\n" + 
15368
			"        [pc: 0, pc: 5] local: this index: 0 type: X\n" + 
15369
			"      Local variable type table:\n" + 
15370
			"        [pc: 0, pc: 5] local: this index: 0 type: X<E>\n" + 
15371
			"  \n" + 
15372
			"  // Method descriptor #21 ([Ljava/lang/String;)V\n" + 
15373
			"  // Stack: 2, Locals: 1\n" + 
15374
			"  public static void main(java.lang.String[] args);\n" + 
15375
			"     0  new X [1]\n" + 
15376
			"     3  dup\n" + 
15377
			"     4  invokespecial X() [22]\n" + 
15378
			"     7  invokevirtual X.foo() : void [23]\n" + 
15379
			"    10  return\n" + 
15380
			"      Line numbers:\n" + 
15381
			"        [pc: 0, line: 10]\n" + 
15382
			"        [pc: 10, line: 11]\n" + 
15383
			"      Local variable table:\n" + 
15384
			"        [pc: 0, pc: 11] local: args index: 0 type: java.lang.String[]\n" + 
15385
			"  \n" + 
15386
			"  // Method descriptor #10 ()V\n" + 
15387
			"  // Stack: 3, Locals: 1\n" + 
15388
			"  public void foo();\n" + 
15389
			"     0  new X$1 [28]\n" + 
15390
			"     3  dup\n" + 
15391
			"     4  aload_0 [this]\n" + 
15392
			"     5  invokespecial X$1(X) [30]\n" + 
15393
			"     8  invokevirtual X$1.run() : void [33]\n" + 
15394
			"    11  getstatic java.lang.System.out : java.io.PrintStream [36]\n" + 
15395
			"    14  aload_0 [this]\n" + 
15396
			"    15  getfield X.e : XA [42]\n" + 
15397
			"    18  checkcast XB [44]\n" + 
15398
			"    21  pop\n" + 
15399
			"    22  getstatic XB.CONST : XB [46]\n" + 
15400
			"    25  invokevirtual java.io.PrintStream.print(java.lang.Object) : void [50]\n" + 
15401
			"    28  return\n" + 
15402
			"      Line numbers:\n" + 
15403
			"        [pc: 0, line: 13]\n" + 
15404
			"        [pc: 8, line: 17]\n" + 
15405
			"        [pc: 11, line: 18]\n" + 
15406
			"        [pc: 28, line: 19]\n" + 
15407
			"      Local variable table:\n" + 
15408
			"        [pc: 0, pc: 29] local: this index: 0 type: X\n" + 
15409
			"      Local variable type table:\n" + 
15410
			"        [pc: 0, pc: 29] local: this index: 0 type: X<E>\n";
15411
		
15412
		try {
15413
			File f = new File(OUTPUT_DIR + File.separator + "X.class");
15414
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
15415
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
15416
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
15417
			int index = result.indexOf(expectedOutput);
15418
			if (index == -1 || expectedOutput.length() == 0) {
15419
				System.out.println(Util.displayString(result, 3));
15420
			}
15421
			if (index == -1) {
15422
				assertEquals("Wrong contents", expectedOutput, result);
15423
			}
15424
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
15425
			assertTrue(false);
15426
		} catch (IOException e) {
15427
			assertTrue(false);
15428
		}
15429
	}				
15430
	
15431
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85477
15432
	public void test0506() {
15433
		this.runNegativeTest(
15434
			new String[] {
15435
				"X.java",//====================================
15436
				"import java.util.Collections;\n" + 
15437
				"import java.util.Comparator;\n" + 
15438
				"import java.util.List;\n" + 
15439
				"\n" + 
15440
				"public final class X<E> {\n" + 
15441
				"	public void test(List list,final Comparator comparator, X x) {\n" + 
15442
				"		foo(list, comparator);\n" + 
15443
				"		bar(list, comparator);\n" + 
15444
				"		\n" + 
15445
				"		x.foo(list, comparator);\n" + 
15446
				"		x.bar(list, comparator);\n" + 
15447
				"	}\n" + 
15448
				"\n" + 
15449
				"	<T> void foo(List<T> lt, Comparator<? super T> ct) {\n" + 
15450
				"	}\n" + 
15451
				"	static <T> void bar(List<T> lt, Comparator<? super T> ct) {\n" + 
15452
				"	}\n" + 
15453
				" Zork z;\n" +
15454
				"}\n"
15455
			},
15456
			"----------\n" + 
15457
			"1. WARNING in X.java (at line 6)\n" + 
15458
			"	public void test(List list,final Comparator comparator, X x) {\n" + 
15459
			"	                 ^^^^\n" + 
15460
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
15461
			"----------\n" + 
15462
			"2. WARNING in X.java (at line 6)\n" + 
15463
			"	public void test(List list,final Comparator comparator, X x) {\n" + 
15464
			"	                                 ^^^^^^^^^^\n" + 
15465
			"Comparator is a raw type. References to generic type Comparator<T> should be parameterized\n" + 
15466
			"----------\n" + 
15467
			"3. WARNING in X.java (at line 6)\n" + 
15468
			"	public void test(List list,final Comparator comparator, X x) {\n" + 
15469
			"	                                                        ^\n" + 
15470
			"X is a raw type. References to generic type X<E> should be parameterized\n" + 
15471
			"----------\n" + 
15472
			"4. WARNING in X.java (at line 7)\n" + 
15473
			"	foo(list, comparator);\n" + 
15474
			"	^^^^^^^^^^^^^^^^^^^^^\n" + 
15475
			"Type safety: Unchecked invocation foo(List, Comparator) of the generic method foo(List<T>, Comparator<? super T>) of type X<E>\n" + 
15476
			"----------\n" + 
15477
			"5. WARNING in X.java (at line 7)\n" + 
15478
			"	foo(list, comparator);\n" + 
15479
			"	    ^^^^\n" + 
15480
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + 
15481
			"----------\n" + 
15482
			"6. WARNING in X.java (at line 7)\n" + 
15483
			"	foo(list, comparator);\n" + 
15484
			"	          ^^^^^^^^^^\n" + 
15485
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" + 
15486
			"----------\n" + 
15487
			"7. WARNING in X.java (at line 8)\n" + 
15488
			"	bar(list, comparator);\n" + 
15489
			"	^^^^^^^^^^^^^^^^^^^^^\n" + 
15490
			"Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X<E>\n" + 
15491
			"----------\n" + 
15492
			"8. WARNING in X.java (at line 8)\n" + 
15493
			"	bar(list, comparator);\n" + 
15494
			"	    ^^^^\n" + 
15495
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + 
15496
			"----------\n" + 
15497
			"9. WARNING in X.java (at line 8)\n" + 
15498
			"	bar(list, comparator);\n" + 
15499
			"	          ^^^^^^^^^^\n" + 
15500
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" + 
15501
			"----------\n" + 
15502
			"10. WARNING in X.java (at line 10)\n" + 
15503
			"	x.foo(list, comparator);\n" + 
15504
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15505
			"Type safety: The method foo(List, Comparator) belongs to the raw type X. References to generic type X<E> should be parameterized\n" + 
15506
			"----------\n" + 
15507
			"11. WARNING in X.java (at line 11)\n" + 
15508
			"	x.bar(list, comparator);\n" + 
15509
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15510
			"The static method bar(List, Comparator) from the type X should be accessed in a static way\n" + 
15511
			"----------\n" + 
15512
			"12. WARNING in X.java (at line 11)\n" + 
15513
			"	x.bar(list, comparator);\n" + 
15514
			"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15515
			"Type safety: Unchecked invocation bar(List, Comparator) of the generic method bar(List<T>, Comparator<? super T>) of type X\n" + 
15516
			"----------\n" + 
15517
			"13. WARNING in X.java (at line 11)\n" + 
15518
			"	x.bar(list, comparator);\n" + 
15519
			"	      ^^^^\n" + 
15520
			"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + 
15521
			"----------\n" + 
15522
			"14. WARNING in X.java (at line 11)\n" + 
15523
			"	x.bar(list, comparator);\n" + 
15524
			"	            ^^^^^^^^^^\n" + 
15525
			"Type safety: The expression of type Comparator needs unchecked conversion to conform to Comparator<? super T>\n" + 
15526
			"----------\n" + 
15527
			"15. ERROR in X.java (at line 18)\n" + 
15528
			"	Zork z;\n" + 
15529
			"	^^^^\n" + 
15530
			"Zork cannot be resolved to a type\n" + 
15531
			"----------\n");
15532
	}	
15533
	// array bound for wildcard
15534
	public void test0507() {
15535
		this.runConformTest(
15536
			new String[] {
15537
				"X.java",//====================================
15538
				"import java.io.Serializable;\n" + 
15539
				"import java.util.List;\n" + 
15540
				"\n" + 
15541
				"public class X {\n" + 
15542
				"	void foo1(List<? extends int[]> l) {\n" + 
15543
				"		int i = l.get(0).length;\n" + 
15544
				"	}\n" + 
15545
				"	void foo2(List<? extends int[]> l) {\n" + 
15546
				"		Object o = l.get(0).toString();\n" + 
15547
				"	}\n" + 
15548
				"	void foo3(List<? extends int[]> l, Serializable s) {\n" + 
15549
				"		boolean b = true;\n" + 
15550
				"		Serializable s2 = b ? l.get(0) : s;\n" + 
15551
				"	}\n" + 
15552
				"}\n"
15553
			},
15554
			"");
15555
	}		
15556
	// array bound for wildcard
15557
	public void test0508() {
15558
		this.runNegativeTest(
15559
			new String[] {
15560
				"X.java",//====================================
15561
				"import java.io.Serializable;\n" + 
15562
				"import java.util.List;\n" + 
15563
				"\n" + 
15564
				"public class X {\n" + 
15565
				"	void foo1(List<? super int[]> l) {\n" + 
15566
				"		int i = l.get(0).length;\n" + 
15567
				"	}\n" + 
15568
				"	void foo2(List<? super int[]> l) {\n" + 
15569
				"		Object o = l.get(0).toString();\n" + 
15570
				"	}\n" + 
15571
				"	void foo3(List<? super int[]> l, Serializable s) {\n" + 
15572
				"		boolean b = true;\n" + 
15573
				"		Serializable s2 = b ? l.get(0) : s;\n" + 
15574
				"	}\n" + 
15575
				"}\n"
15576
			},
15577
			"----------\n" + 
15578
			"1. ERROR in X.java (at line 6)\n" + 
15579
			"	int i = l.get(0).length;\n" + 
15580
			"	                 ^^^^^^\n" + 
15581
			"length cannot be resolved or is not a field\n" + 
15582
			"----------\n" + 
15583
			"2. ERROR in X.java (at line 13)\n" + 
15584
			"	Serializable s2 = b ? l.get(0) : s;\n" + 
15585
			"	                  ^^^^^^^^^^^^^^^^\n" + 
15586
			"Type mismatch: cannot convert from Object to Serializable\n" + 
15587
			"----------\n");
15588
	}		
15589
	// type parameter hiding
15590
	public void test0509() {
15591
		this.runNegativeTest(
15592
			new String[] {
15593
				"X.java",//====================================
15594
				"import java.util.*;\n" + 
15595
				"public class X {\n" + 
15596
				"	public static void main(String[] args) {\n" + 
15597
				"        List<MyTigerSimpleObject> list = new ArrayList<MyTigerSimpleObject>();\n" + 
15598
				"        list.add(new MyTigerSimpleObject(\"a\"));\n" + 
15599
				"        list.add(new MyTigerSimpleObject(\"b\"));\n" + 
15600
				"        \n" + 
15601
				"        for (MyTigerSimpleObject so : list)\n" + 
15602
				"            System.out.println(so.getSomeAttribute());		\n" + 
15603
				"	}\n" + 
15604
				"}\n" + 
15605
				"class MyTigerSimpleObject<E> {\n" + 
15606
				"	MyTigerSimpleObject(String s) {}\n" + 
15607
				"	E getSomeAttribute() { return null; }\n" + 
15608
				"}\n" + 
15609
				"\n" + 
15610
				"class TigerList<MyTigerSimpleObject> extends ArrayList<MyTigerSimpleObject> {\n" + 
15611
				"    public void listAll() {\n" + 
15612
				"        for (MyTigerSimpleObject so : this)\n" + 
15613
				"            System.out.println(so.getSomeAttribute());\n" + 
15614
				"    }\n" + 
15615
				"	\n" + 
15616
				"}\n"
15617
			},
15618
			"----------\n" + 
15619
			"1. WARNING in X.java (at line 4)\n" + 
15620
			"	List<MyTigerSimpleObject> list = new ArrayList<MyTigerSimpleObject>();\n" + 
15621
			"	     ^^^^^^^^^^^^^^^^^^^\n" + 
15622
			"MyTigerSimpleObject is a raw type. References to generic type MyTigerSimpleObject<E> should be parameterized\n" + 
15623
			"----------\n" + 
15624
			"2. WARNING in X.java (at line 4)\n" + 
15625
			"	List<MyTigerSimpleObject> list = new ArrayList<MyTigerSimpleObject>();\n" + 
15626
			"	                                               ^^^^^^^^^^^^^^^^^^^\n" + 
15627
			"MyTigerSimpleObject is a raw type. References to generic type MyTigerSimpleObject<E> should be parameterized\n" + 
15628
			"----------\n" + 
15629
			"3. WARNING in X.java (at line 5)\n" + 
15630
			"	list.add(new MyTigerSimpleObject(\"a\"));\n" + 
15631
			"	             ^^^^^^^^^^^^^^^^^^^\n" + 
15632
			"MyTigerSimpleObject is a raw type. References to generic type MyTigerSimpleObject<E> should be parameterized\n" + 
15633
			"----------\n" + 
15634
			"4. WARNING in X.java (at line 6)\n" + 
15635
			"	list.add(new MyTigerSimpleObject(\"b\"));\n" + 
15636
			"	             ^^^^^^^^^^^^^^^^^^^\n" + 
15637
			"MyTigerSimpleObject is a raw type. References to generic type MyTigerSimpleObject<E> should be parameterized\n" + 
15638
			"----------\n" + 
15639
			"5. WARNING in X.java (at line 8)\n" + 
15640
			"	for (MyTigerSimpleObject so : list)\n" + 
15641
			"	     ^^^^^^^^^^^^^^^^^^^\n" + 
15642
			"MyTigerSimpleObject is a raw type. References to generic type MyTigerSimpleObject<E> should be parameterized\n" + 
15643
			"----------\n" + 
15644
			"6. WARNING in X.java (at line 17)\n" + 
15645
			"	class TigerList<MyTigerSimpleObject> extends ArrayList<MyTigerSimpleObject> {\n" + 
15646
			"	      ^^^^^^^^^\n" + 
15647
			"The serializable class TigerList does not declare a static final serialVersionUID field of type long\n" + 
15648
			"----------\n" + 
15649
			"7. WARNING in X.java (at line 17)\n" + 
15650
			"	class TigerList<MyTigerSimpleObject> extends ArrayList<MyTigerSimpleObject> {\n" + 
15651
			"	                ^^^^^^^^^^^^^^^^^^^\n" + 
15652
			"The type parameter MyTigerSimpleObject is hiding the type MyTigerSimpleObject<E>\n" + 
15653
			"----------\n" + 
15654
			"8. ERROR in X.java (at line 20)\n" + 
15655
			"	System.out.println(so.getSomeAttribute());\n" + 
15656
			"	                      ^^^^^^^^^^^^^^^^\n" + 
15657
			"The method getSomeAttribute() is undefined for the type MyTigerSimpleObject\n" + 
15658
			"----------\n");
15659
	}			
15660
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84355
15661
	public void test0510() {
15662
		this.runConformTest(
15663
			new String[] {
15664
				"X.java",//====================================
15665
				"import java.io.Serializable;\n" + 
15666
				"\n" + 
15667
				"public class X {\n" + 
15668
				"	public X() {\n" + 
15669
				"		String[] strings = new String[]{\"test\"};\n" + 
15670
				"\n" + 
15671
				"		// this fails\n" + 
15672
				"		Object obj = ClassB.doSomething((String) strings[0]);\n" + 
15673
				"\n" + 
15674
				"		// this works fine\n" + 
15675
				"		String intermediate = ClassB.doSomething((String) strings[0]);\n" + 
15676
				"		Object obj1 = intermediate;\n" + 
15677
				"	}\n" + 
15678
				"}\n" + 
15679
				"\n" + 
15680
				"class ClassB {\n" + 
15681
				"	public static <T extends Serializable> T doSomething(String value) {\n" + 
15682
				"		return (T) value;\n" + 
15683
				"	}\n" + 
15684
				"}\n"
15685
			},
15686
			"");
15687
	}		
15688
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82407
15689
	public void test0511() {
15690
		this.runConformTest(
15691
			new String[] {
15692
				"X.java",//====================================
15693
				"import java.util.HashMap;\n" + 
15694
				"\n" + 
15695
				"public class X {\n" + 
15696
				"\n" + 
15697
				"	static HashMap<Character, Character> substitutionList(String s1, String s2) {\n" + 
15698
				"\n" + 
15699
				"		HashMap<Character, Character> subst = new HashMap<Character, Character>();\n" + 
15700
				"\n" + 
15701
				"		for (int i = 0; i < s1.length(); i++) {\n" + 
15702
				"			char key = s1.charAt(i);\n" + 
15703
				"			char value = s2.charAt(i);\n" + 
15704
				"			if (subst.containsKey(key)) {\n" + 
15705
				"				if (value != subst.get(key)) {\n" + 
15706
				"					return null;\n" + 
15707
				"				}\n" + 
15708
				"			} else if (subst.containsValue(value)) {\n" + 
15709
				"				return null;\n" + 
15710
				"			} else {\n" + 
15711
				"				subst.put(key, value);\n" + 
15712
				"			}\n" + 
15713
				"		}\n" + 
15714
				"\n" + 
15715
				"		return subst;\n" + 
15716
				"	}\n" + 
15717
				"\n" + 
15718
				"	public static void main(String[] args) {\n" + 
15719
				"		System.out.println(\"SUCCESS\");\n" + 
15720
				"	}\n" + 
15721
				"}\n"
15722
			},
15723
			"SUCCESS");
15724
	}		
15725
	public void test0512() {
15726
		this.runConformTest(
15727
			new String[] {
15728
				"X.java",//====================================
15729
				"public class X { \n" + 
15730
				"    public static void main(String argv[]) {\n" + 
15731
				"		\n" + 
15732
				"		new X().new M<Exception>(null) {\n" + 
15733
				"			void run() {\n" + 
15734
				"				Exception e = ex;\n" + 
15735
				"				System.out.println(\"SUCCESS\");\n" + 
15736
				"			}\n" + 
15737
				"		}.run();\n" + 
15738
				"    }\n" + 
15739
				"    class M<E extends Throwable> {\n" + 
15740
				"        E ex;\n" + 
15741
				"        M(E ex) {\n" + 
15742
				"            this.ex = ex;\n" + 
15743
				"        }\n" + 
15744
				"    }\n" + 
15745
				"}\n"
15746
			},
15747
			"SUCCESS");
15748
	}			
15749
	public void test0513() {
15750
		this.runNegativeTest(
15751
			new String[] {
15752
				"X.java",//====================================
15753
				"public class X { \n" + 
15754
				"    public static void main(String argv[]) {\n" + 
15755
				"		\n" + 
15756
				"		new X().new M(null) {\n" + 
15757
				"			void run() {\n" + 
15758
				"				Exception e = ex;\n" + 
15759
				"				System.out.println(\"SUCCESS\");\n" + 
15760
				"			}\n" + 
15761
				"		}.run();\n" + 
15762
				"    }\n" + 
15763
				"    class M<E extends Throwable> {\n" + 
15764
				"        E ex;\n" + 
15765
				"        M(E ex) {\n" + 
15766
				"            this.ex = ex;\n" + 
15767
				"        }\n" + 
15768
				"    }\n" + 
15769
				"}\n"
15770
			},
15771
			"----------\n" + 
15772
			"1. WARNING in X.java (at line 4)\n" + 
15773
			"	new X().new M(null) {\n" + 
15774
			"			void run() {\n" + 
15775
			"				Exception e = ex;\n" + 
15776
			"				System.out.println(\"SUCCESS\");\n" + 
15777
			"			}\n" + 
15778
			"		}.run();\n" + 
15779
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
15780
			"Type safety: The constructor X.M(Throwable) belongs to the raw type X.M. References to generic type X.M<E> should be parameterized\n" + 
15781
			"----------\n" + 
15782
			"2. WARNING in X.java (at line 4)\n" + 
15783
			"	new X().new M(null) {\n" + 
15784
			"	            ^\n" + 
15785
			"X.M is a raw type. References to generic type X.M<E> should be parameterized\n" + 
15786
			"----------\n" + 
15787
			"3. WARNING in X.java (at line 4)\n" + 
15788
			"	new X().new M(null) {\n" + 
15789
			"	            ^^^^^^^\n" + 
15790
			"Type safety: The constructor X.M(Throwable) belongs to the raw type X.M. References to generic type X.M<E> should be parameterized\n" + 
15791
			"----------\n" + 
15792
			"4. ERROR in X.java (at line 6)\n" + 
15793
			"	Exception e = ex;\n" + 
15794
			"	              ^^\n" + 
15795
			"Type mismatch: cannot convert from Throwable to Exception\n" + 
15796
			"----------\n");
15797
	}		
15798
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=82955
15799
	public void test0514(){
15800
		runConformTest(
15801
			new String[] {
15802
				"Test.java",
15803
				"public class Test {\n" + 
15804
				"	static <T extends Base> T infer( T t1, T t2 ) { return null; }\n" + 
15805
				"	public static void main( String [] args ) {\n" + 
15806
				"		Base base = infer( new Sub1(), new Sub2() );\n" + 
15807
				"		// Note: Eclipse 3.1 says this is an error, but it\'s not\n" + 
15808
				"		Runnable runnable = infer( new Sub1(), new Sub2() );\n" + 
15809
				"	}\n" + 
15810
				"}\n" + 
15811
				"class Base { }\n" + 
15812
				"class Sub1 extends Base implements Runnable { public void run() { } }\n" + 
15813
				"class Sub2 extends Base implements Runnable { public void run() { } }\n"
15814
			}
15815
		);
15816
	}
15817
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84348
15818
	public void test0515(){
15819
		runConformTest(
15820
			new String[] {
15821
				"Test.java",
15822
				"public class Test {\n" + 
15823
				"	public static <T> void myMethod(final List<? extends File> fileList) {\n" + 
15824
				"		Collections.sort(fileList, new Comparator<File>(){\n" + 
15825
				"			public int compare(File f1, File f2) { return 0; }\n" + 
15826
				"		});\n" + 
15827
				"	}\n" + 
15828
				"}\n" + 
15829
				"\n" + 
15830
				"class List<T> {}\n" + 
15831
				"class File {}\n" + 
15832
				"interface Comparator<T> {}\n" + 
15833
				"class Collections {\n" + 
15834
				"	static <T> void sort(List<T> list, Comparator<? super T> c) {}\n" + 
15835
				"}"
15836
			}
15837
		);
15838
	}
15839
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84944
15840
	public void test0516(){
15841
		runConformTest(
15842
			new String[] {
15843
				"parser/AbstractParser.java",
15844
				"package parser;\n" + 
15845
				"public abstract class AbstractParser<T> implements ValueParser<T> {\n" + 
15846
				"	public T parse( final String string ) {\n" + 
15847
				"		return valueOf(string); \n" + 
15848
				"	}\n" + 
15849
				"	protected abstract T valueOf(final String string);	\n" + 
15850
				"}\n" + 
15851
				"interface ValueParser<T> {\n" + 
15852
				"	T parse(final String string);\n" + 
15853
				"}\n",
15854
				"parser/BooleanParser.java",
15855
				"package parser;\n" + 
15856
				"public class BooleanParser extends AbstractParser<Boolean> {\n" + 
15857
				"	protected Boolean valueOf(final String string ) {\n" + 
15858
				"		return Boolean.valueOf(string); 		\n" + 
15859
				"	}\n" + 
15860
				"}\n"
15861
			}
15862
		);
15863
		runConformTest(
15864
			new String[] {
15865
				"test/BooleanParserTest.java",
15866
				"package test;\n" + 
15867
				"import parser.BooleanParser;\n" + 
15868
				"public class BooleanParserTest {\n" + 
15869
				"	static final boolean getBoolean(final String value) {\n" + 
15870
				"		return new BooleanParser().parse(value).booleanValue(); // The type Boolean is not visible\n" + 
15871
				"	}\n" + 
15872
				"}\n"
15873
			},
15874
			null,
15875
			null,
15876
			false, // do not flush output directory
15877
			null
15878
		);
15879
	}
15880
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84944 - check no warning for using raw member
15881
	public void test0517(){
15882
		runNegativeTest(
15883
			new String[] {
15884
				"X.java",
15885
				"class Base<T> {\n" + 
15886
				"	class InnerBase {\n" + 
15887
				"		java.util.List<String> list;\n" + 
15888
				"	}\n" + 
15889
				"  Zork z;\n" +
15890
				"}\n" + 
15891
				"\n" + 
15892
				"public class X extends Base<Integer> {\n" + 
15893
				"	class InnerDerived extends InnerBase {\n" + 
15894
				"		void method() {\n" + 
15895
				"			list.add(\"Hi\"); // Warning on this method call\n" + 
15896
				"		}\n" + 
15897
				"	}\n" + 
15898
				"}\n"
15899
			},
15900
			"----------\n" + 
15901
			"1. ERROR in X.java (at line 5)\n" + 
15902
			"	Zork z;\n" + 
15903
			"	^^^^\n" + 
15904
			"Zork cannot be resolved to a type\n" + 
15905
			"----------\n");
15906
	}	
15907
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85930 - check no warning for using raw member
15908
	public void test0518(){
15909
		runNegativeTest(
15910
			new String[] {
15911
				"X.java",
15912
				"interface Callable<T> {\n" + 
15913
				"	public enum Result {\n" + 
15914
				"		GOOD, BAD\n" + 
15915
				"	};\n" + 
15916
				"	public Result call(T arg);\n" + 
15917
				"}\n" + 
15918
				"\n" + 
15919
				"public class X implements Callable<String> {\n" + 
15920
				"	public Result call(String arg) {\n" + 
15921
				"		return Result.GOOD;\n" + 
15922
				"	}\n" + 
15923
				"  Zork z;\n" +				
15924
				"}\n"
15925
			},
15926
			"----------\n" + 
15927
			"1. ERROR in X.java (at line 12)\n" + 
15928
			"	Zork z;\n" + 
15929
			"	^^^^\n" + 
15930
			"Zork cannot be resolved to a type\n" + 
15931
			"----------\n");
15932
	}	
15933
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85262
15934
	public void test0519(){
15935
		runConformTest(
15936
			new String[] {
15937
				"FooImpl.java",
15938
				"interface Bar<R extends Foo<R>>  {} \n" + 
15939
				" \n" + 
15940
				"class BarImpl<S extends Foo<S>> implements Bar<S> {} \n" + 
15941
				" \n" + 
15942
				"interface Foo<T extends Foo<T>> extends Bar<T> {} \n" + 
15943
				" \n" + 
15944
				"public class FooImpl<U extends Foo<U>> extends BarImpl<U> implements Foo<U> {}\n" + 
15945
				"\n"
15946
			},
15947
			"");
15948
	}	
15949
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85262 - variation
15950
	public void test0520(){
15951
		runConformTest(
15952
			new String[] {
15953
				"Bar.java",
15954
				"public interface Bar<R extends Foo<R>>  {} \n",
15955
				"BarImpl.java",
15956
				"public class BarImpl<S extends Foo<S>> implements Bar<S> {} \n",
15957
				"Foo.java",
15958
				"public interface Foo<T extends Foo<T>> extends Bar<T> {} \n",
15959
			},
15960
			"");
15961
		runConformTest(
15962
			new String[] {
15963
				"FooImpl.java",
15964
				"public class FooImpl<U extends Foo<U>> extends BarImpl<U> implements Foo<U> {}\n",
15965
			},
15966
			"",
15967
			null,
15968
			false, // do not flush output directory
15969
			null);
15970
	}
15971
	public void test0521(){
15972
		runConformTest(
15973
			new String[] {
15974
				"X.java",
15975
				"import java.util.*;\n" + 
15976
				"\n" + 
15977
				"public class X {\n" + 
15978
				"	static public <T extends Collection> void addAll(T a, T b) {\n" + 
15979
				"		a.addAll(b);\n" + 
15980
				"	}\n" + 
15981
				"	static public void main(String[] args) {\n" + 
15982
				"		Collection<Integer> a = new ArrayList<Integer>();\n" + 
15983
				"		Collection<String> b = new ArrayList<String>();\n" + 
15984
				"		b.add(\"string\");\n" + 
15985
				"		addAll(a, b);\n" + 
15986
				"		try {\n" + 
15987
				"			System.out.println(a.iterator().next().intValue()); // ClassCastException\n" + 
15988
				"		} catch(ClassCastException e) {\n" + 
15989
				"			System.out.println(\"SUCCESS\");\n" + 
15990
				"		}\n" + 
15991
				"	}\n" + 
15992
				"}\n"
15993
			},
15994
			"SUCCESS");
15995
	}			
15996
	// variation on test0521, check issuing of unchecked warning **
15997
	public void test0522(){
15998
		runNegativeTest(
15999
			new String[] {
16000
				"X.java",
16001
				"import java.util.*;\n" + 
16002
				"\n" + 
16003
				"public class X {\n" + 
16004
				"	static public <T extends Collection> void addAll(T a, T b) {\n" + 
16005
				"		a.addAll(b);\n" + 
16006
				"	}\n" + 
16007
				"	static public void main(String[] args) {\n" + 
16008
				"		Collection<Integer> a = new ArrayList<Integer>();\n" + 
16009
				"		Collection<String> b = new ArrayList<String>();\n" + 
16010
				"		b.add(\"string\");\n" + 
16011
				"		addAll(a, b);\n" + 
16012
				"		try {\n" + 
16013
				"			System.out.println(a.iterator().next().intValue()); // ClassCastException\n" + 
16014
				"		} catch(ClassCastException e) {\n" + 
16015
				"			System.out.println(\"SUCCESS\");\n" + 
16016
				"		}\n" + 
16017
				"	}\n" + 
16018
				"  Zork z;\n" +
16019
				"}\n"
16020
			},
16021
			"----------\n" + 
16022
			"1. WARNING in X.java (at line 4)\n" + 
16023
			"	static public <T extends Collection> void addAll(T a, T b) {\n" + 
16024
			"	                         ^^^^^^^^^^\n" + 
16025
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
16026
			"----------\n" + 
16027
			"2. WARNING in X.java (at line 5)\n" + 
16028
			"	a.addAll(b);\n" + 
16029
			"	^^^^^^^^^^^\n" + 
16030
			"Type safety: The method addAll(Collection) belongs to the raw type Collection. References to generic type Collection<E> should be parameterized\n" + 
16031
			"----------\n" + 
16032
			"3. ERROR in X.java (at line 18)\n" + 
16033
			"	Zork z;\n" + 
16034
			"	^^^^\n" + 
16035
			"Zork cannot be resolved to a type\n" + 
16036
			"----------\n");
16037
	}			
16038
	public void test0523(){
16039
		runNegativeTest(
16040
			new String[] {
16041
				"X.java",
16042
				"import java.util.*;\n" + 
16043
				"public class X {\n" + 
16044
				"	public X() {\n" + 
16045
				"		M m = new M();\n" + 
16046
				"		List<String> ls = m.list(); // rawified even though wasn\'t using T parameter\n" + 
16047
				"	}\n" + 
16048
				"	Zork z;\n" + 
16049
				"	static class M<T> {\n" + 
16050
				"		List<String> list() {\n" + 
16051
				"			return null;\n" + 
16052
				"		}\n" + 
16053
				"	}\n" + 
16054
				"}\n"
16055
			},
16056
			"----------\n" + 
16057
			"1. WARNING in X.java (at line 4)\n" + 
16058
			"	M m = new M();\n" + 
16059
			"	^\n" + 
16060
			"X.M is a raw type. References to generic type X.M<T> should be parameterized\n" + 
16061
			"----------\n" + 
16062
			"2. WARNING in X.java (at line 4)\n" + 
16063
			"	M m = new M();\n" + 
16064
			"	          ^\n" + 
16065
			"X.M is a raw type. References to generic type X.M<T> should be parameterized\n" + 
16066
			"----------\n" + 
16067
			"3. WARNING in X.java (at line 5)\n" + 
16068
			"	List<String> ls = m.list(); // rawified even though wasn\'t using T parameter\n" + 
16069
			"	                  ^^^^^^^^\n" + 
16070
			"Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" + 
16071
			"----------\n" + 
16072
			"4. ERROR in X.java (at line 7)\n" + 
16073
			"	Zork z;\n" + 
16074
			"	^^^^\n" + 
16075
			"Zork cannot be resolved to a type\n" + 
16076
			"----------\n");
16077
	}
16078
	// ensure there is no unchecked warning **
16079
	public void test0524(){
16080
		runNegativeTest(
16081
			new String[] {
16082
				"X.java",
16083
				"import java.util.*;\n" + 
16084
				"class MyList extends ArrayList<String> {\n" + 
16085
				"}\n" + 
16086
				"\n" + 
16087
				"public class X {\n" + 
16088
				"    public static void main(String[] args) {\n" + 
16089
				"        List<? extends String> a = new MyList();\n" + 
16090
				"        List<String> b = (MyList) a;     \n" + 
16091
				"    }\n" + 
16092
				"	Zork z;\n" + 
16093
				"}\n"
16094
			},
16095
			"----------\n" + 
16096
			"1. WARNING in X.java (at line 2)\n" + 
16097
			"	class MyList extends ArrayList<String> {\n" + 
16098
			"	      ^^^^^^\n" + 
16099
			"The serializable class MyList does not declare a static final serialVersionUID field of type long\n" + 
16100
			"----------\n" + 
16101
			"2. ERROR in X.java (at line 10)\n" + 
16102
			"	Zork z;\n" + 
16103
			"	^^^^\n" + 
16104
			"Zork cannot be resolved to a type\n" + 
16105
			"----------\n");
16106
	}				
16107
	public void test0525(){
16108
		runConformTest(
16109
			new String[] {
16110
				"X.java",
16111
				"import java.util.*;\n" + 
16112
				"\n" + 
16113
				"public class X {\n" + 
16114
				"	public static void main(String[] args) {\n" + 
16115
				"		try {\n" + 
16116
				"			List list = new ArrayList();\n" + 
16117
				"			String s = \"this shouldn\'t work\";\n" + 
16118
				"			list.add(s);\n" + 
16119
				"			List<Integer> listInt = list;\n" + 
16120
				"			int i = listInt.get(0);\n" + 
16121
				"		} catch(ClassCastException e) {\n" + 
16122
				"			System.out.println(\"SUCCESS\");\n" + 
16123
				"		}\n" + 
16124
				"	}\n" + 
16125
				"}\n"
16126
			},
16127
			"SUCCESS");
16128
	}			
16129
	public void test0526(){
16130
		runNegativeTest(
16131
			new String[] {
16132
				"X.java",
16133
				"public class X {\n" + 
16134
				"    Zork z;\n" +
16135
				"    <T> T f(Object o) {\n" + 
16136
				"	return (T) o; // OK\n" + 
16137
				"    }\n" + 
16138
				"\n" + 
16139
				"    <U, T extends U> T g(Object o) {\n" + 
16140
				"	return (T) o; // bug???\n" + 
16141
				"    }\n" + 
16142
				"\n" + 
16143
				"    <U, T extends U> T h(Object o) {\n" + 
16144
				"	return X.<T>castTo(o); // workaround\n" + 
16145
				"    }\n" + 
16146
				"\n" + 
16147
				"    private static <T> T castTo(Object o) {\n" + 
16148
				"	return (T) o;\n" + 
16149
				"    }\n" + 
16150
				"}\n"
16151
			},
16152
			"----------\n" + 
16153
			"1. ERROR in X.java (at line 2)\n" + 
16154
			"	Zork z;\n" + 
16155
			"	^^^^\n" + 
16156
			"Zork cannot be resolved to a type\n" + 
16157
			"----------\n" + 
16158
			"2. WARNING in X.java (at line 4)\n" + 
16159
			"	return (T) o; // OK\n" + 
16160
			"	       ^^^^^\n" + 
16161
			"Type safety: Unchecked cast from Object to T\n" + 
16162
			"----------\n" + 
16163
			"3. WARNING in X.java (at line 8)\n" + 
16164
			"	return (T) o; // bug???\n" + 
16165
			"	       ^^^^^\n" + 
16166
			"Type safety: Unchecked cast from Object to T\n" + 
16167
			"----------\n" + 
16168
			"4. WARNING in X.java (at line 16)\n" + 
16169
			"	return (T) o;\n" + 
16170
			"	       ^^^^^\n" + 
16171
			"Type safety: Unchecked cast from Object to T\n" + 
16172
			"----------\n");
16173
	}				
16174
	// should not produce unchecked errors **
16175
	public void test0527(){
16176
		runNegativeTest(
16177
			new String[] {
16178
				"X.java",
16179
				"public class X {\n" + 
16180
				"	<T, U extends T, V extends T> T foo(U u, V v) {\n" + 
16181
				"		return this == null ? (T) u : (T)v;\n" + 
16182
				"	}\n" + 
16183
				"	Zork z;\n" + 
16184
				"}\n"
16185
			},
16186
			"----------\n" + 
16187
			"1. ERROR in X.java (at line 5)\n" + 
16188
			"	Zork z;\n" + 
16189
			"	^^^^\n" + 
16190
			"Zork cannot be resolved to a type\n" + 
16191
			"----------\n");
16192
	}				
16193
16194
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86217
16195
	public void test0528() {
16196
		this.runConformTest(
16197
			new String[] {
16198
				"X.java",
16199
				"public class X<T extends X.M> extends Y {}\n" + 
16200
				"class Y { static class M {} }\n",
16201
			},
16202
			""
16203
		);
16204
	}
16205
	
16206
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86463
16207
	public void test0529() {
16208
		this.runNegativeTest(
16209
			new String[] {
16210
				"X.java",
16211
				"import java.util.*;\n" + 
16212
				"public class X<T extends List> {\n" + 
16213
				"	void bar() {\n" + 
16214
				"		T t = new ArrayList(); // BUG!!!\n" + 
16215
				"	}\n" + 
16216
				"}\n",
16217
			},
16218
			"----------\n" + 
16219
			"1. WARNING in X.java (at line 2)\n" + 
16220
			"	public class X<T extends List> {\n" + 
16221
			"	                         ^^^^\n" + 
16222
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
16223
			"----------\n" + 
16224
			"2. ERROR in X.java (at line 4)\n" + 
16225
			"	T t = new ArrayList(); // BUG!!!\n" + 
16226
			"	      ^^^^^^^^^^^^^^^\n" + 
16227
			"Type mismatch: cannot convert from ArrayList to T\n" + 
16228
			"----------\n" + 
16229
			"3. WARNING in X.java (at line 4)\n" + 
16230
			"	T t = new ArrayList(); // BUG!!!\n" + 
16231
			"	          ^^^^^^^^^\n" + 
16232
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
16233
			"----------\n");
16234
	}	
16235
	
16236
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86463
16237
	public void test0530() {
16238
		this.runNegativeTest(
16239
			new String[] {
16240
				"X.java",
16241
				"import java.util.*;\n" + 
16242
				"\n" + 
16243
				"abstract class Foo<T extends List>\n" + 
16244
				" {\n" + 
16245
				"  abstract void foo(T t);\n" + 
16246
				"  void foo2()\n" + 
16247
				"  {\n" + 
16248
				"    List l = new LinkedList();\n" + 
16249
				"    foo(l); // BUG!!!\n" + 
16250
				"  }\n" + 
16251
				"}\n" + 
16252
				"\n" + 
16253
				"public class X extends Foo<ArrayList>\n" + 
16254
				"{\n" + 
16255
				"  void foo(ArrayList l)\n" + 
16256
				"  {\n" + 
16257
				"    System.out.println(l);\n" + 
16258
				"  }\n" + 
16259
				"}\n",
16260
			},
16261
			"----------\n" + 
16262
			"1. WARNING in X.java (at line 3)\n" + 
16263
			"	abstract class Foo<T extends List>\n" + 
16264
			"	                             ^^^^\n" + 
16265
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
16266
			"----------\n" + 
16267
			"2. WARNING in X.java (at line 8)\n" + 
16268
			"	List l = new LinkedList();\n" + 
16269
			"	^^^^\n" + 
16270
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
16271
			"----------\n" + 
16272
			"3. WARNING in X.java (at line 8)\n" + 
16273
			"	List l = new LinkedList();\n" + 
16274
			"	             ^^^^^^^^^^\n" + 
16275
			"LinkedList is a raw type. References to generic type LinkedList<E> should be parameterized\n" + 
16276
			"----------\n" + 
16277
			"4. ERROR in X.java (at line 9)\n" + 
16278
			"	foo(l); // BUG!!!\n" + 
16279
			"	^^^\n" + 
16280
			"The method foo(T) in the type Foo<T> is not applicable for the arguments (List)\n" + 
16281
			"----------\n" + 
16282
			"5. WARNING in X.java (at line 13)\n" + 
16283
			"	public class X extends Foo<ArrayList>\n" + 
16284
			"	                           ^^^^^^^^^\n" + 
16285
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
16286
			"----------\n" + 
16287
			"6. WARNING in X.java (at line 15)\n" + 
16288
			"	void foo(ArrayList l)\n" + 
16289
			"	     ^^^^^^^^^^^^^^^^\n" + 
16290
			"The method foo(ArrayList) of type X should be tagged with @Override since it actually overrides a superclass method\n" + 
16291
			"----------\n" + 
16292
			"7. WARNING in X.java (at line 15)\n" + 
16293
			"	void foo(ArrayList l)\n" + 
16294
			"	         ^^^^^^^^^\n" + 
16295
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
16296
			"----------\n");
16297
	}		
16298
	
16299
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86646
16300
	public void test0531() {
16301
		this.runNegativeTest(
16302
			new String[] {
16303
				"X.java",
16304
				"import java.util.Vector;\n" + 
16305
				"\n" + 
16306
				"public class X<T> {\n" + 
16307
				"	public T f1(T l) {\n" + 
16308
				"		Vector<T> v = new Vector<T>();\n" + 
16309
				"		v.add(l);\n" + 
16310
				"		return (T) v.get(0); // Expect warning here\n" + 
16311
				"	}\n" + 
16312
				"  Zork z;\n" +
16313
				"}\n",
16314
			},
16315
			"----------\n" + 
16316
			"1. WARNING in X.java (at line 7)\n" + 
16317
			"	return (T) v.get(0); // Expect warning here\n" + 
16318
			"	       ^^^^^^^^^^^^\n" + 
16319
			"Unnecessary cast from T to T\n" + 
16320
			"----------\n" + 
16321
			"2. ERROR in X.java (at line 9)\n" + 
16322
			"	Zork z;\n" + 
16323
			"	^^^^\n" + 
16324
			"Zork cannot be resolved to a type\n" + 
16325
			"----------\n");
16326
	}
16327
16328
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84944
16329
	public void test0532() {
16330
		this.runConformTest(
16331
			new String[] {
16332
				"p/X.java",
16333
				"package p;\n" + 
16334
				"public class X extends Z<Boolean> {\n" + 
16335
				"	@Override public Boolean value() { return true; }\n" + 
16336
				"}\n" +
16337
				"abstract class Z<T> {\n" + 
16338
				"	public T foo() { return value(); }\n" + 
16339
				"	public abstract T value();\n" + 
16340
				"}\n",
16341
			},
16342
			""
16343
		);
16344
		this.runConformTest(
16345
			new String[] {
16346
				"Y.java",
16347
				"import p.X;\n" +
16348
				"public class Y { boolean test() { return new X().foo().booleanValue(); } }\n",
16349
			},
16350
			"",
16351
			null,
16352
			false, // do not flush output
16353
			null
16354
		);		
16355
	}
16356
	
16357
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838
16358
	public void test0533() {
16359
		this.runNegativeTest(
16360
			new String[] {
16361
				"X.java",
16362
				"import java.util.EnumSet;\n" + 
16363
				"\n" + 
16364
				"enum Foo {\n" + 
16365
				"	blargh, baz, boz;\n" + 
16366
				"}\n" + 
16367
				"\n" + 
16368
				"public class X {\n" + 
16369
				"	public static void main(String[] args) {\n" + 
16370
				"		Class c = Foo.class;\n" + 
16371
				"		EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16372
				"	}\n" + 
16373
				"}\n",
16374
			},
16375
			"----------\n" + 
16376
			"1. WARNING in X.java (at line 9)\n" + 
16377
			"	Class c = Foo.class;\n" + 
16378
			"	^^^^^\n" + 
16379
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16380
			"----------\n" + 
16381
			"2. WARNING in X.java (at line 10)\n" + 
16382
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16383
			"	        ^^^^\n" + 
16384
			"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
16385
			"----------\n" + 
16386
			"3. ERROR in X.java (at line 10)\n" + 
16387
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16388
			"	        ^^^^\n" + 
16389
			"Bound mismatch: The type Enum is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + 
16390
			"----------\n" + 
16391
			"4. WARNING in X.java (at line 10)\n" + 
16392
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16393
			"	                     ^^^^^^^^^^^^^^^^\n" + 
16394
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16395
			"----------\n" + 
16396
			"5. WARNING in X.java (at line 10)\n" + 
16397
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16398
			"	                     ^^^^^^^^^^^^^^^^\n" + 
16399
			"Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum>\n" + 
16400
			"----------\n" + 
16401
			"6. WARNING in X.java (at line 10)\n" + 
16402
			"	EnumSet<Enum> eSet = EnumSet.allOf(c);\n" + 
16403
			"	                                   ^\n" + 
16404
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" + 
16405
			"----------\n");
16406
	}
16407
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16408
	public void test0534() {
16409
		this.runConformTest(
16410
			new String[] {
16411
				"X.java",
16412
				"import java.util.EnumSet;\n" + 
16413
				"\n" + 
16414
				"enum Foo {\n" + 
16415
				"	blargh, baz, boz;\n" + 
16416
				"}\n" + 
16417
				"\n" + 
16418
				"public class X {\n" + 
16419
				"	public static void main(String[] args) {\n" + 
16420
				"		Class c = Foo.class;\n" + 
16421
				"		EnumSet<Foo> eSet = EnumSet.allOf(c);\n" + 
16422
				"	}\n" + 
16423
				"}\n",
16424
			},
16425
			""
16426
		);
16427
	}
16428
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16429
	public void test0535() {
16430
		this.runConformTest(
16431
			new String[] {
16432
				"X.java",
16433
				"import java.util.EnumSet;\n" + 
16434
				"\n" + 
16435
				"enum Foo {\n" + 
16436
				"	blargh, baz, boz;\n" + 
16437
				"}\n" + 
16438
				"\n" + 
16439
				"public class X {\n" + 
16440
				"	public static void main(String[] args) {\n" + 
16441
				"		Class c = Foo.class;\n" + 
16442
				"		EnumSet<? extends Enum> eSet = EnumSet.allOf(c);\n" + 
16443
				"	}\n" + 
16444
				"}\n",
16445
			},
16446
			""
16447
		);
16448
	}
16449
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16450
	public void test0536() {
16451
		this.runConformTest(
16452
			new String[] {
16453
				"X.java",
16454
				"import java.util.EnumSet;\n" + 
16455
				"\n" + 
16456
				"enum Foo {\n" + 
16457
				"	blargh, baz, boz;\n" + 
16458
				"}\n" + 
16459
				"\n" + 
16460
				"public class X {\n" + 
16461
				"	public static void main(String[] args) {\n" + 
16462
				"		Class c = Foo.class;\n" + 
16463
				"		EnumSet<?> eSet = EnumSet.allOf(c);\n" + 
16464
				"	}\n" + 
16465
				"}\n",
16466
			},
16467
			""
16468
		);
16469
	}
16470
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16471
	public void test0537() {
16472
		this.runNegativeTest(
16473
			new String[] {
16474
				"X.java",
16475
				"import java.util.EnumSet;\n" + 
16476
				"\n" + 
16477
				"enum Foo {\n" + 
16478
				"	blargh, baz, boz;\n" + 
16479
				"}\n" + 
16480
				"\n" + 
16481
				"public class X {\n" + 
16482
				"	public static void main(String[] args) {\n" + 
16483
				"		Class c = Foo.class;\n" + 
16484
				"		EnumSet<?> eSet = EnumSet.allOf(c);\n" + 
16485
				"	}\n" + 
16486
				"  Zork z;\n" +
16487
				"}\n",
16488
			},
16489
			"----------\n" + 
16490
			"1. WARNING in X.java (at line 9)\n" + 
16491
			"	Class c = Foo.class;\n" + 
16492
			"	^^^^^\n" + 
16493
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16494
			"----------\n" + 
16495
			"2. WARNING in X.java (at line 10)\n" + 
16496
			"	EnumSet<?> eSet = EnumSet.allOf(c);\n" + 
16497
			"	                  ^^^^^^^^^^^^^^^^\n" + 
16498
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16499
			"----------\n" + 
16500
			"3. WARNING in X.java (at line 10)\n" + 
16501
			"	EnumSet<?> eSet = EnumSet.allOf(c);\n" + 
16502
			"	                                ^\n" + 
16503
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" + 
16504
			"----------\n" + 
16505
			"4. ERROR in X.java (at line 12)\n" + 
16506
			"	Zork z;\n" + 
16507
			"	^^^^\n" + 
16508
			"Zork cannot be resolved to a type\n" + 
16509
			"----------\n");
16510
	}
16511
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16512
	public void test0538() {
16513
		this.runNegativeTest(
16514
			new String[] {
16515
				"X.java",
16516
				"import java.util.EnumSet;\n" + 
16517
				"\n" + 
16518
				"enum Foo {\n" + 
16519
				"	blargh, baz, boz;\n" + 
16520
				"}\n" + 
16521
				"\n" + 
16522
				"public class X {\n" + 
16523
				"	public static void main(String[] args) {\n" + 
16524
				"		Class c = Foo.class;\n" + 
16525
				"		EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16526
				"	}\n" + 
16527
				"}\n",
16528
			},
16529
			"----------\n" + 
16530
			"1. WARNING in X.java (at line 9)\n" + 
16531
			"	Class c = Foo.class;\n" + 
16532
			"	^^^^^\n" + 
16533
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
16534
			"----------\n" + 
16535
			"2. ERROR in X.java (at line 10)\n" + 
16536
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16537
			"	        ^^^^\n" + 
16538
			"Bound mismatch: The type Enum<?> is not a valid substitute for the bounded parameter <E extends Enum<E>> of the type EnumSet<E>\n" + 
16539
			"----------\n" + 
16540
			"3. WARNING in X.java (at line 10)\n" + 
16541
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16542
			"	                        ^^^^^^^^^^^^^^^^\n" + 
16543
			"Type safety: Unchecked invocation allOf(Class) of the generic method allOf(Class<E>) of type EnumSet\n" + 
16544
			"----------\n" + 
16545
			"4. WARNING in X.java (at line 10)\n" + 
16546
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16547
			"	                        ^^^^^^^^^^^^^^^^\n" + 
16548
			"Type safety: The expression of type EnumSet needs unchecked conversion to conform to EnumSet<Enum<?>>\n" + 
16549
			"----------\n" + 
16550
			"5. WARNING in X.java (at line 10)\n" + 
16551
			"	EnumSet<Enum<?>> eSet = EnumSet.allOf(c);\n" + 
16552
			"	                                      ^\n" + 
16553
			"Type safety: The expression of type Class needs unchecked conversion to conform to Class<E>\n" + 
16554
			"----------\n");
16555
	}	
16556
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86838 - variation
16557
	public void test0539() {
16558
		this.runNegativeTest(
16559
			new String[] {
16560
				"X.java",
16561
				"public class X {\n" + 
16562
				"		 static class B<C> {\n" + 
16563
				"		 		 public <T extends I1> T willBe(Class<T> c) {\n" + 
16564
				"		 		 		 return (T)null;\n" + 
16565
				"		 		 }\n" + 
16566
				"		 }\n" + 
16567
				"		 interface I1  {\n" + 
16568
				"		 }\n" + 
16569
				"		 interface I2  extends I1 {\n" + 
16570
				"		 }\n" + 
16571
				"		 \n" + 
16572
				"		 public static void m1(String[] args) {\n" + 
16573
				"		 		 B b = new B();\n" + 
16574
				"		 		 I2 v = b.willBe(I2.class);\n" + 
16575
				"		 }\n" + 
16576
				"		 public static void m2(String[] args) {\n" + 
16577
				"		 		 B<Void> b = new B<Void>();\n" + 
16578
				"		 		 I2 v = b.willBe(I2.class);\n" + 
16579
				"		 }\n" + 
16580
				"\n" + 
16581
				"}\n",
16582
			},
16583
			"----------\n" + 
16584
			"1. WARNING in X.java (at line 4)\n" + 
16585
			"	return (T)null;\n" + 
16586
			"	       ^^^^^^^\n" + 
16587
			"Unnecessary cast from null to T\n" + 
16588
			"----------\n" + 
16589
			"2. WARNING in X.java (at line 13)\n" + 
16590
			"	B b = new B();\n" + 
16591
			"	^\n" + 
16592
			"X.B is a raw type. References to generic type X.B<C> should be parameterized\n" + 
16593
			"----------\n" + 
16594
			"3. WARNING in X.java (at line 13)\n" + 
16595
			"	B b = new B();\n" + 
16596
			"	          ^\n" + 
16597
			"X.B is a raw type. References to generic type X.B<C> should be parameterized\n" + 
16598
			"----------\n" + 
16599
			"4. WARNING in X.java (at line 14)\n" + 
16600
			"	I2 v = b.willBe(I2.class);\n" + 
16601
			"	       ^^^^^^^^^^^^^^^^^^\n" + 
16602
			"Type safety: The method willBe(Class) belongs to the raw type X.B. References to generic type X.B<C> should be parameterized\n" + 
16603
			"----------\n" + 
16604
			"5. ERROR in X.java (at line 14)\n" + 
16605
			"	I2 v = b.willBe(I2.class);\n" + 
16606
			"	       ^^^^^^^^^^^^^^^^^^\n" + 
16607
			"Type mismatch: cannot convert from X.I1 to X.I2\n" + 
16608
			"----------\n");
16609
	}
16610
	// test paramtype argument compatibility
16611
	public void test0540() {
16612
		this.runNegativeTest(
16613
			new String[] {
16614
				"Baz.java",
16615
				"import java.util.*;\n" + 
16616
				"interface Foo<X> {}\n" + 
16617
				"interface Bar extends Foo {\n" + 
16618
				"}\n" + 
16619
				"public class Baz<R,D>  {\n" + 
16620
				"    public R visit(Collection<? extends Foo<?>> trees, D d) {\n" + 
16621
				"	return null;\n" + 
16622
				"    }\n" + 
16623
				"    R test(Collection<Bar> c, D d) {\n" + 
16624
				"	return visit(c, d);\n" + 
16625
				"    }\n" + 
16626
				"}\n",
16627
			},
16628
			"----------\n" + 
16629
			"1. WARNING in Baz.java (at line 3)\n" + 
16630
			"	interface Bar extends Foo {\n" + 
16631
			"	                      ^^^\n" + 
16632
			"Foo is a raw type. References to generic type Foo<X> should be parameterized\n" + 
16633
			"----------\n" + 
16634
			"2. ERROR in Baz.java (at line 10)\n" + 
16635
			"	return visit(c, d);\n" + 
16636
			"	       ^^^^^\n" + 
16637
			"The method visit(Collection<? extends Foo<?>>, D) in the type Baz<R,D> is not applicable for the arguments (Collection<Bar>, D)\n" + 
16638
			"----------\n");
16639
	}		
16640
	public void test0541() {
16641
		this.runConformTest(
16642
			new String[] {
16643
				"X.java",
16644
				"import java.util.Map;\n" + 
16645
				"public class X {\n" + 
16646
				"   public static void main(String[] args) {\n" + 
16647
				"     Map m = null;\n" + 
16648
				"	 try {\n" + 
16649
				"	     Map m2 = m.getClass().newInstance();\n" + 
16650
				"	 } catch(Exception e) {\n" + 
16651
				"	 }\n" + 
16652
				"   }\n" + 
16653
				"}\n",
16654
			},
16655
			"");
16656
	}		
16657
	public void test0542() {
16658
		this.runConformTest(
16659
			new String[] {
16660
				"X.java",
16661
				"public class X {\n" + 
16662
				"	static <T> boolean isOK(T x) {\n" + 
16663
				"		return isOK(x);\n" + 
16664
				"	}\n" + 
16665
				"\n" + 
16666
				"	static <T> boolean isStillOK(T x) {\n" + 
16667
				"		return true && isOK(x);\n" + 
16668
				"	}\n" + 
16669
				"\n" + 
16670
				"	static <T> boolean isNoMoreOK(T x) {\n" + 
16671
				"		return true && isNoMoreOK(x);\n" + 
16672
				"	}\n" + 
16673
				"\n" + 
16674
				"	static <T> boolean isOKAgain(T x) {\n" + 
16675
				"		boolean res;\n" + 
16676
				"		return true && (res = isOKAgain(x));\n" + 
16677
				"	}\n" + 
16678
				"}\n",
16679
			},
16680
			"");
16681
	}		
16682
	public void test0543() {
16683
		this.runNegativeTest(
16684
			new String[] {
16685
				"X.java",
16686
				"import java.util.List;\n" + 
16687
				"\n" + 
16688
				"public class X {\n" + 
16689
				"	public static void main(String[] args) {\n" + 
16690
				"		Object obj = null;\n" + 
16691
				"		List<String> ls = (List<String>) obj;\n" + 
16692
				"	}\n" + 
16693
				"  Zork z;\n" +
16694
				"}\n",
16695
			},
16696
			"----------\n" + 
16697
			"1. WARNING in X.java (at line 6)\n" + 
16698
			"	List<String> ls = (List<String>) obj;\n" + 
16699
			"	                  ^^^^^^^^^^^^^^^^^^\n" + 
16700
			"Type safety: Unchecked cast from Object to List<String>\n" + 
16701
			"----------\n" + 
16702
			"2. ERROR in X.java (at line 8)\n" + 
16703
			"	Zork z;\n" + 
16704
			"	^^^^\n" + 
16705
			"Zork cannot be resolved to a type\n" + 
16706
			"----------\n");
16707
	}		
16708
	public void test0544() {
16709
		this.runNegativeTest(
16710
			new String[] {
16711
				"X.java",
16712
				"import java.util.Vector;\n" + 
16713
				"\n" + 
16714
				"public class X {\n" + 
16715
				"	public static void main(String[] args) {\n" + 
16716
				"		Vector<Integer> a = new Vector<Integer>();\n" + 
16717
				"		Vector b = new Vector();\n" + 
16718
				"		b.add(new Object());\n" + 
16719
				"		a = b;\n" + 
16720
				"		Zork z;\n" + 
16721
				"	}\n" + 
16722
				"}\n",
16723
			},
16724
			"----------\n" + 
16725
			"1. WARNING in X.java (at line 6)\n" + 
16726
			"	Vector b = new Vector();\n" + 
16727
			"	^^^^^^\n" + 
16728
			"Vector is a raw type. References to generic type Vector<E> should be parameterized\n" + 
16729
			"----------\n" + 
16730
			"2. WARNING in X.java (at line 6)\n" + 
16731
			"	Vector b = new Vector();\n" + 
16732
			"	               ^^^^^^\n" + 
16733
			"Vector is a raw type. References to generic type Vector<E> should be parameterized\n" + 
16734
			"----------\n" + 
16735
			"3. WARNING in X.java (at line 7)\n" + 
16736
			"	b.add(new Object());\n" + 
16737
			"	^^^^^^^^^^^^^^^^^^^\n" + 
16738
			"Type safety: The method add(Object) belongs to the raw type Vector. References to generic type Vector<E> should be parameterized\n" + 
16739
			"----------\n" + 
16740
			"4. WARNING in X.java (at line 8)\n" + 
16741
			"	a = b;\n" + 
16742
			"	    ^\n" + 
16743
			"Type safety: The expression of type Vector needs unchecked conversion to conform to Vector<Integer>\n" + 
16744
			"----------\n" + 
16745
			"5. ERROR in X.java (at line 9)\n" + 
16746
			"	Zork z;\n" + 
16747
			"	^^^^\n" + 
16748
			"Zork cannot be resolved to a type\n" + 
16749
			"----------\n");
16750
	}		
16751
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=86898
16752
	public void test0545() {
16753
		this.runNegativeTest(
16754
			new String[] {
16755
				"X.java",
16756
				"class B extends A<Object> {\n" + 
16757
				"	void m2() {\n" + 
16758
				"		m3((X2) m());  // A<Object>.m() --> X<? extends Object> - cannot cast to X2\n" + 
16759
				"	}\n" + 
16760
				"	void m3(X2 i) {}\n" + 
16761
				"}\n" + 
16762
				"class A<T> {\n" + 
16763
				"	X<? extends T> m() {\n" + 
16764
				"		return null;\n" + 
16765
				"	}\n" + 
16766
				"}\n" + 
16767
				"\n" + 
16768
				"class X2 extends X<String> {\n" + 
16769
				"}\n" + 
16770
				"\n" + 
16771
				"public class X<T> {\n" + 
16772
				"	void foo(X<String> lhs, X<? extends Object> rhs) {\n" + 
16773
				"		lhs = rhs; // cannot convert\n" + 
16774
				"	}\n" + 
16775
				"	void bar(X2 lhs, X<? extends Object> rhs) {\n" + 
16776
				"		lhs = rhs; // cannot convert\n" + 
16777
				"	}\n" + 
16778
				"}\n" + 
16779
				"class C {\n" + 
16780
				"	void foo(X<? extends Object> xo) {}\n" + 
16781
				"	void bar(X<String> xs) {}\n" + 
16782
				"}\n" + 
16783
				"class D extends C {\n" + 
16784
				"	void foo(X<String> xs) {}\n" + 
16785
				"	void bar(X<? extends Object> xo) {}\n" + 
16786
				"}\n",
16787
			},
16788
			"----------\n" + 
16789
			"1. ERROR in X.java (at line 18)\n" + 
16790
			"	lhs = rhs; // cannot convert\n" + 
16791
			"	      ^^^\n" + 
16792
			"Type mismatch: cannot convert from X<capture#2-of ? extends Object> to X<String>\n" + 
16793
			"----------\n" + 
16794
			"2. ERROR in X.java (at line 21)\n" + 
16795
			"	lhs = rhs; // cannot convert\n" + 
16796
			"	      ^^^\n" + 
16797
			"Type mismatch: cannot convert from X<capture#3-of ? extends Object> to X2\n" + 
16798
			"----------\n" + 
16799
			"3. ERROR in X.java (at line 29)\n" + 
16800
			"	void foo(X<String> xs) {}\n" + 
16801
			"	     ^^^^^^^^^^^^^^^^^\n" + 
16802
			"Name clash: The method foo(X<String>) of type D has the same erasure as foo(X<? extends Object>) of type C but does not override it\n" + 
16803
			"----------\n" + 
16804
			"4. ERROR in X.java (at line 30)\n" + 
16805
			"	void bar(X<? extends Object> xo) {}\n" + 
16806
			"	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
16807
			"Name clash: The method bar(X<? extends Object>) of type D has the same erasure as bar(X<String>) of type C but does not override it\n" + 
16808
			"----------\n");
16809
	}		
16810
	// ensure no unsafe cast warning **
16811
	public void test0546() {
16812
		this.runNegativeTest(
16813
			new String[] {
16814
				"X.java",
16815
				"class StringList extends java.util.LinkedList<String> {\n" + 
16816
				"}\n" + 
16817
				"\n" + 
16818
				"public class X {\n" + 
16819
				"    public static void main(String[] args) {\n" + 
16820
				"        java.util.List<? extends String> a = new StringList();\n" + 
16821
				"        java.util.List<String> b = (StringList) a;      // warned but safe.\n" + 
16822
				"    }\n" + 
16823
				"   Zork z;\n" +
16824
				"}\n",
16825
			},
16826
			"----------\n" + 
16827
			"1. WARNING in X.java (at line 1)\n" + 
16828
			"	class StringList extends java.util.LinkedList<String> {\n" + 
16829
			"	      ^^^^^^^^^^\n" + 
16830
			"The serializable class StringList does not declare a static final serialVersionUID field of type long\n" + 
16831
			"----------\n" + 
16832
			"2. ERROR in X.java (at line 9)\n" + 
16833
			"	Zork z;\n" + 
16834
			"	^^^^\n" + 
16835
			"Zork cannot be resolved to a type\n" + 
16836
			"----------\n");
16837
	}
16838
	public void test0547() {
16839
		this.runConformTest(
16840
			new String[] {
16841
				"X.java",
16842
				"import java.util.*;\n" + 
16843
				"public class X {\n" + 
16844
				"	public <K> TreeMap<K,K> essai(K type) {\n" + 
16845
				"		TreeMap<K,K> treeMap = new TreeMap<K,K>();\n" + 
16846
				"		return treeMap;\n" + 
16847
				"	}\n" + 
16848
				"	public static void main(String args[]) {\n" + 
16849
				"		X x = new X();\n" + 
16850
				"		TreeMap<?,?> treeMap = x.essai(null);\n" + 
16851
				"	}\n" + 
16852
				"}\n",
16853
			},
16854
			"");
16855
	}		
16856
	public void test0548() {
16857
		this.runNegativeTest(
16858
			new String[] {
16859
				"X.java",
16860
				"interface DA<T> {\n" + 
16861
				"}\n" + 
16862
				"interface DB<T> extends DA<T> {\n" + 
16863
				"}\n" + 
16864
				"interface DC<T> extends DA<Integer> {\n" + 
16865
				"}\n" + 
16866
				"\n" + 
16867
				"public class X {\n" + 
16868
				"	Object o = (DC<?>) (DA<?>) null;\n" + 
16869
				"  Zork z;\n" +
16870
				"}\n",
16871
			},
16872
			"----------\n" + 
16873
			"1. WARNING in X.java (at line 9)\n" + 
16874
			"	Object o = (DC<?>) (DA<?>) null;\n" + 
16875
			"	           ^^^^^^^^^^^^^^^^^^^^\n" + 
16876
			"Unnecessary cast from DA<capture#1-of ?> to DC<?>\n" + 
16877
			"----------\n" + 
16878
			"2. WARNING in X.java (at line 9)\n" + 
16879
			"	Object o = (DC<?>) (DA<?>) null;\n" + 
16880
			"	                   ^^^^^^^^^^^^\n" + 
16881
			"Unnecessary cast from null to DA<?>\n" + 
16882
			"----------\n" + 
16883
			"3. ERROR in X.java (at line 10)\n" + 
16884
			"	Zork z;\n" + 
16885
			"	^^^^\n" + 
16886
			"Zork cannot be resolved to a type\n" + 
16887
			"----------\n");
16888
	}
16889
	// **
16890
	public void test0549() {
16891
		this.runConformTest(
16892
			new String[] {
16893
				"X.java",
16894
				"public class X<T> {\n" + 
16895
				"	boolean DEBUG = this instanceof Special;\n" + 
16896
				"\n" + 
16897
				"	public static class Special extends X<String> {\n" + 
16898
				"	}\n" + 
16899
				"}\n",
16900
			},
16901
			"");
16902
	}	
16903
// results may change depending on 
16904
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=148046
16905
// **
16906
	public void test0550() {
16907
		this.runNegativeTest(
16908
			new String[] {
16909
				"X.java",
16910
				"class A {}\n" + 
16911
				"class B extends A {}\n" + 
16912
				"\n" + 
16913
				"public class X<T> {\n" + 
16914
				"    public <U extends B> void foo(X<? super A> param) {\n" + 
16915
				"        X<U> foo = (X<U>)param;\n" + 
16916
				"    }\n" + 
16917
				"   Zork z;\n" +
16918
				"}\n",
16919
			},
16920
			"----------\n" + 
16921
			"1. WARNING in X.java (at line 6)\n" + 
16922
			"	X<U> foo = (X<U>)param;\n" + 
16923
			"	           ^^^^^^^^^^^\n" + 
16924
			"Type safety: Unchecked cast from X<capture#1-of ? super A> to X<U>\n" + 
16925
			"----------\n" + 
16926
			"2. ERROR in X.java (at line 8)\n" + 
16927
			"	Zork z;\n" + 
16928
			"	^^^^\n" + 
16929
			"Zork cannot be resolved to a type\n" + 
16930
			"----------\n");
16931
	}		
16932
	// ensure no unchecked warning
16933
	public void test0551() {
16934
		this.runNegativeTest(
16935
			new String[] {
16936
				"X.java",
16937
				"public class X {\n" + 
16938
				"    <T, U extends T, V extends T> T cond1(boolean z, U x1, V x2) {\n" + 
16939
				"        return (z? (T) x1: x2);\n" + 
16940
				"    }\n" + 
16941
				"    Zork z;\n" +
16942
				"}\n",
16943
			},
16944
			"----------\n" + 
16945
			"1. ERROR in X.java (at line 5)\n" + 
16946
			"	Zork z;\n" + 
16947
			"	^^^^\n" + 
16948
			"Zork cannot be resolved to a type\n" + 
16949
			"----------\n");
16950
	}			
16951
	public void test0552() {
16952
		this.runConformTest(
16953
			new String[] {
16954
				"X.java",
16955
				"public class X {\n" + 
16956
				"\n" + 
16957
				"	Comparable<?> x;\n" + 
16958
				"\n" + 
16959
				"	void put(Comparable<?> c) {\n" + 
16960
				"		this.x = c;\n" + 
16961
				"	}\n" + 
16962
				"\n" + 
16963
				"	Comparable<?> get() {\n" + 
16964
				"		return x;\n" + 
16965
				"	}\n" + 
16966
				"\n" + 
16967
				"	void test() {\n" + 
16968
				"		X ci = new X();\n" + 
16969
				"		ci.put(new Integer(3));\n" + 
16970
				"		Integer i = (Integer) ci.get();\n" + 
16971
				"	}\n" + 
16972
				"\n" + 
16973
				"}\n",
16974
			},
16975
			"");
16976
	}					
16977
	public void test0553() {
16978
		this.runConformTest(
16979
			new String[] {
16980
				"X.java",
16981
				"public class X {\n" + 
16982
				"   public static void main(String args[]) throws Exception {\n" + 
16983
				"      doIt();\n" + 
16984
				"      System.out.println(\"SUCCESS\");\n" + 
16985
				"   }\n" + 
16986
				"   public static void doIt() {\n" + 
16987
				"      Holder<Integer> association = new Holder<Integer>(new Integer(0));\n" + 
16988
				"      Integer sizeHolder = (Integer)(association.getValue()); //Cast to Integer is redundant!!!\n" + 
16989
				"      System.out.print(sizeHolder.intValue());\n" + 
16990
				"   }\n" + 
16991
				"   static class Holder<V> {\n" + 
16992
				"      V value;\n" + 
16993
				"      Holder(V value) {\n" + 
16994
				"         this.value = value;\n" + 
16995
				"      }\n" + 
16996
				"      V getValue() {\n" + 
16997
				"         return value;\n" + 
16998
				"      }\n" + 
16999
				"   }\n" + 
17000
				"}\n"	,
17001
			},
17002
			"0SUCCESS");
17003
	}					
17004
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=86898 - variation
17005
	public void test0554() {
17006
		this.runNegativeTest(
17007
			new String[] {
17008
				"X.java",
17009
				" import java.util.*;\n" + 
17010
				" public class X<T> {\n" + 
17011
				" public static void main(String[] args) {\n" + 
17012
				"		X<? extends Object> xo = null;\n" + 
17013
				"		X<String> xs = null;\n" + 
17014
				"		X2 x2 = null;\n" + 
17015
				"		\n" + 
17016
				"		Object o1 = (X<String>) xo;\n" + 
17017
				"		Object o2 = (X<? extends Object>) xs;\n" + 
17018
				"		Object o3 = (X2) xo;\n" + 
17019
				"		Object o4 = (X<? extends Object>) x2;\n" + 
17020
				"		Object o5 = (X3<String>) xo;\n" + 
17021
				"	}\n" + 
17022
				"}\n" + 
17023
				"class X2 extends X<String> {\n" + 
17024
				"}\n" + 
17025
				"class X3<U> extends X<U> {\n" + 
17026
				"   Zork z;\n" +
17027
				"}\n",
17028
			},
17029
			"----------\n" + 
17030
			"1. WARNING in X.java (at line 8)\n" + 
17031
			"	Object o1 = (X<String>) xo;\n" + 
17032
			"	            ^^^^^^^^^^^^^^\n" + 
17033
			"Type safety: Unchecked cast from X<capture#1-of ? extends Object> to X<String>\n" + 
17034
			"----------\n" + 
17035
			"2. WARNING in X.java (at line 8)\n" + 
17036
			"	Object o1 = (X<String>) xo;\n" + 
17037
			"	            ^^^^^^^^^^^^^^\n" + 
17038
			"Unnecessary cast from X<capture#1-of ? extends Object> to X<String>\n" + 
17039
			"----------\n" + 
17040
			"3. WARNING in X.java (at line 9)\n" + 
17041
			"	Object o2 = (X<? extends Object>) xs;\n" + 
17042
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
17043
			"Unnecessary cast from X<String> to X<? extends Object>\n" + 
17044
			"----------\n" + 
17045
			"4. WARNING in X.java (at line 10)\n" + 
17046
			"	Object o3 = (X2) xo;\n" + 
17047
			"	            ^^^^^^^\n" + 
17048
			"Unnecessary cast from X<capture#3-of ? extends Object> to X2\n" + 
17049
			"----------\n" + 
17050
			"5. WARNING in X.java (at line 11)\n" + 
17051
			"	Object o4 = (X<? extends Object>) x2;\n" + 
17052
			"	            ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
17053
			"Unnecessary cast from X2 to X<? extends Object>\n" + 
17054
			"----------\n" + 
17055
			"6. WARNING in X.java (at line 12)\n" + 
17056
			"	Object o5 = (X3<String>) xo;\n" + 
17057
			"	            ^^^^^^^^^^^^^^^\n" + 
17058
			"Type safety: Unchecked cast from X<capture#5-of ? extends Object> to X3<String>\n" + 
17059
			"----------\n" + 
17060
			"7. WARNING in X.java (at line 12)\n" + 
17061
			"	Object o5 = (X3<String>) xo;\n" + 
17062
			"	            ^^^^^^^^^^^^^^^\n" + 
17063
			"Unnecessary cast from X<capture#5-of ? extends Object> to X3<String>\n" + 
17064
			"----------\n" + 
17065
			"8. ERROR in X.java (at line 18)\n" + 
17066
			"	Zork z;\n" + 
17067
			"	^^^^\n" + 
17068
			"Zork cannot be resolved to a type\n" + 
17069
			"----------\n");
17070
	}					
17071
	public void test0555() {
17072
		this.runNegativeTest(
17073
			new String[] {
17074
				"X.java",
17075
				" import java.util.List;\n" + 
17076
				" public class X<U extends Number> {\n" + 
17077
				" U u;\n" + 
17078
				" void foo(X<? extends Number> xn, X<? extends U> xu) {\n" + 
17079
				"		xn = xu;\n" + 
17080
				"		xu = xn;\n" + 
17081
				"		xu.u = xn.u; // ko\n" + 
17082
				"		xn.u = xu.u; // ko\n" + 
17083
				"	}\n" + 
17084
				"}\n",
17085
			},
17086
			"----------\n" + 
17087
			"1. ERROR in X.java (at line 6)\n" + 
17088
			"	xu = xn;\n" + 
17089
			"	     ^^\n" + 
17090
			"Type mismatch: cannot convert from X<capture#4-of ? extends Number> to X<? extends U>\n" + 
17091
			"----------\n" + 
17092
			"2. ERROR in X.java (at line 7)\n" + 
17093
			"	xu.u = xn.u; // ko\n" + 
17094
			"	       ^^^^\n" + 
17095
			"Type mismatch: cannot convert from capture#6-of ? extends Number to capture#5-of ? extends U\n" + 
17096
			"----------\n" + 
17097
			"3. ERROR in X.java (at line 8)\n" + 
17098
			"	xn.u = xu.u; // ko\n" + 
17099
			"	       ^^^^\n" + 
17100
			"Type mismatch: cannot convert from capture#8-of ? extends U to capture#7-of ? extends Number\n" + 
17101
			"----------\n");
17102
	}
17103
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87273
17104
	public void test0556() {
17105
		this.runConformTest(
17106
			new String[] {
17107
				"X.java",
17108
				"interface Foo {\n" + 
17109
				"	Object get();\n" + 
17110
				"}\n" + 
17111
				"\n" + 
17112
				"interface MyList<F> extends Foo {\n" + 
17113
				"	public F get();\n" + 
17114
				"}\n" + 
17115
				"\n" + 
17116
				"class MyListImpl<G> implements MyList<G> {\n" + 
17117
				"	public G get() {\n" + 
17118
				"		System.out.println(\"SUCCESS\");\n" + 
17119
				"		return null;\n" + 
17120
				"	}\n" + 
17121
				"}\n" + 
17122
				"\n" + 
17123
				"interface StringList extends MyList<String> {\n" + 
17124
				"}\n" + 
17125
				"\n" + 
17126
				"class StringListImpl extends MyListImpl<String> implements StringList {\n" + 
17127
				"}\n" + 
17128
				"\n" + 
17129
				"public class X {\n" + 
17130
				"	public static void main(String[] args) {\n" + 
17131
				"		Foo f = new StringListImpl();\n" + 
17132
				"		f.get();\n" +
17133
				"	}\n" + 
17134
				"}\n",
17135
			},
17136
			"SUCCESS");
17137
	}					
17138
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83002
17139
	public void test0557() {
17140
		this.runConformTest(
17141
			new String[] {
17142
				"X.java",
17143
				"public class X {\n" + 
17144
				"	static <T extends Exception> void foo(T t) throws T {\n" + // ensure exception is properly encoded (...^ex)
17145
				"	}\n" + 
17146
				"}\n",
17147
			},
17148
			"");
17149
		this.runConformTest(
17150
			new String[] {
17151
				"Y.java",
17152
				"import java.io.*;\n" +
17153
				"public class Y {\n" + 
17154
				"	void foo() {\n" +
17155
				"		try {\n" +
17156
				"			X.foo(new IOException());\n" +
17157
				"		} catch(IOException e){\n" +
17158
				"		}\n" +
17159
				"	}\n" + 
17160
				"}\n",
17161
			},
17162
			"",
17163
			null,
17164
			false,
17165
			null);
17166
	}
17167
	
17168
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83002
17169
	public void test0558() {
17170
		this.runConformTest(
17171
			new String[] {
17172
				"X.java",
17173
				"public class X {\n" + 
17174
				"	static <T extends Exception, U extends Exception> void foo(T t, U u) throws T, U {\n" + // ensure exception is properly encoded (...^ex)
17175
				"	}\n" + 
17176
				"}\n",
17177
			},
17178
			"");
17179
		this.runConformTest(
17180
			new String[] {
17181
				"Y.java",
17182
				"import java.io.*;\n" +
17183
				"public class Y {\n" + 
17184
				"	void foo() {\n" +
17185
				"		try {\n" +
17186
				"			X.foo(new IOException(), new ClassNotFoundException());\n" +
17187
				"		} catch(IOException e){\n" +
17188
				"		} catch(ClassNotFoundException e){\n" +
17189
				"		}\n" +
17190
				"	}\n" + 
17191
				"}\n",
17192
			},
17193
			"",
17194
			null,
17195
			false,
17196
			null);
17197
	}
17198
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=86902
17199
	// **
17200
	public void test0559() {
17201
		this.runNegativeTest(
17202
			new String[] {
17203
				"X.java",
17204
				"class Cell<T> {\n" + 
17205
				"	T t;\n" + 
17206
				"	public void setT(T t) {\n" + 
17207
				"		this.t= t;\n" + 
17208
				"	}\n" + 
17209
				"	public T getT() {\n" + 
17210
				"		return t;\n" + 
17211
				"	}\n" + 
17212
				"}\n" + 
17213
				"\n" + 
17214
				"public class X {\n" + 
17215
				"  Zork z;\n" +
17216
				"	public static void main(String[] args) {\n" + 
17217
				"		Cell c= new Cell();\n" + 
17218
				"		c.setT(Boolean.FALSE); // other: warning: [unchecked] unchecked\n" + 
17219
				"			// call to setT(T) as a member of the raw type p.Cell\n" + 
17220
				"		c.t= Boolean.TRUE; // other: warning: [unchecked] unchecked call\n" + 
17221
				"			// to setT(T) as a member of the raw type p.Cell\n" + 
17222
				"		boolean b1= (Boolean) c.getT();\n" + 
17223
				"		boolean b2= (Boolean) c.t;\n" + 
17224
				"	}\n" + 
17225
				"}\n",
17226
			},
17227
			"----------\n" + 
17228
			"1. ERROR in X.java (at line 12)\n" + 
17229
			"	Zork z;\n" + 
17230
			"	^^^^\n" + 
17231
			"Zork cannot be resolved to a type\n" + 
17232
			"----------\n" + 
17233
			"2. WARNING in X.java (at line 14)\n" + 
17234
			"	Cell c= new Cell();\n" + 
17235
			"	^^^^\n" + 
17236
			"Cell is a raw type. References to generic type Cell<T> should be parameterized\n" + 
17237
			"----------\n" + 
17238
			"3. WARNING in X.java (at line 14)\n" + 
17239
			"	Cell c= new Cell();\n" + 
17240
			"	            ^^^^\n" + 
17241
			"Cell is a raw type. References to generic type Cell<T> should be parameterized\n" + 
17242
			"----------\n" + 
17243
			"4. WARNING in X.java (at line 15)\n" + 
17244
			"	c.setT(Boolean.FALSE); // other: warning: [unchecked] unchecked\n" + 
17245
			"	^^^^^^^^^^^^^^^^^^^^^\n" + 
17246
			"Type safety: The method setT(Object) belongs to the raw type Cell. References to generic type Cell<T> should be parameterized\n" + 
17247
			"----------\n" + 
17248
			"5. WARNING in X.java (at line 17)\n" + 
17249
			"	c.t= Boolean.TRUE; // other: warning: [unchecked] unchecked call\n" + 
17250
			"	  ^\n" + 
17251
			"Type safety: The field t from the raw type Cell is assigned a value of type Boolean. References to generic type Cell<T> should be parameterized\n" + 
17252
			"----------\n");
17253
	}		
17254
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85924
17255
	public void test0560() {
17256
		this.runConformTest(
17257
			new String[] {
17258
				"X.java",
17259
				"interface IController<U extends IView<?>>  {\n" + 
17260
				"    public U getView() ;\n" + 
17261
				"}\n" + 
17262
				"interface IView<U>  {\n" + 
17263
				"}\n" + 
17264
				"class MatGroup   {\n" + 
17265
				"	public abstract static class View implements IView<String> {\n" + 
17266
				"		public void setTempAppearance() {\n" + 
17267
				"			System.out.println(\"SUCCESS\");\n" + 
17268
				"		}\n" + 
17269
				"	}\n" + 
17270
				"	\n" + 
17271
				"	public abstract static class Ctrl<U extends View> implements IController<U>  {\n" + 
17272
				"	}\n" + 
17273
				"}\n" + 
17274
				"public class X {\n" + 
17275
				"	public static void main(String []args) {\n" + 
17276
				"		MatGroup.Ctrl<?>children[] = { \n" + 
17277
				"				new MatGroup.Ctrl<MatGroup.View>(){\n" + 
17278
				"					public MatGroup.View getView() { return new MatGroup.View(){}; }	\n" + 
17279
				"				}} ;\n" + 
17280
				"	    for(MatGroup.Ctrl<?> glmat: children) {\n" + 
17281
				"			glmat.getView().setTempAppearance() ;\n" + 
17282
				"	    }\n" + 
17283
				"	}\n" + 
17284
				"}\n",
17285
			},
17286
			"SUCCESS");
17287
	}
17288
17289
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87956
17290
	public void test0561() {
17291
		this.runConformTest(
17292
			new String[] {
17293
				"X.java",
17294
				"public class X {\n" + 
17295
				"	void foo(A<String> a) {}\n" + 
17296
				"	Object foo(A<Integer> a) { return null; }\n" + 
17297
				"	 void test(A<Integer> a) { foo(a); }\n" + 
17298
				"}\n" + 
17299
				"class A<T> {}\n",
17300
			},
17301
			""
17302
		);
17303
		this.runConformTest(
17304
			new String[] {
17305
				"X.java",
17306
				"public class X {\n" + 
17307
				"	Number foo(A<String> a) { return null; }\n" + 
17308
				"	Integer foo(A<Integer> a) { return null; }\n" + 
17309
				"	void test(A<Integer> a) { foo(a); }\n" + 
17310
				"}\n" + 
17311
				"class A<T> {}\n",
17312
			},
17313
			""
17314
		);
17315
	}
17316
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87550
17317
	public void test0562() {
17318
		this.runConformTest(
17319
			new String[] {
17320
				"X.java",
17321
				"import java.util.*;\n" + 
17322
				"interface Inter<A, B> {}\n" + 
17323
				"public class X<T, U, V extends X<T, U, V>> extends ArrayList<V> implements Inter<T, U> {\n" + 
17324
				"	public final void foo(U u) {\n" + 
17325
				"		X.bar(this, u);\n" + 
17326
				"	}\n" + 
17327
				"	public static final <P, Q> void bar(Collection<? extends Inter<P, Q>> c, Q q) {}\n" + 
17328
				"}\n",
17329
			},
17330
			"");	
17331
	}	
17332
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87550 - variation	
17333
	public void test0563() {
17334
		this.runConformTest(
17335
			new String[] {
17336
				"X.java",
17337
				"import java.util.*;\n" + 
17338
				"interface Inter<A, B> {}\n" + 
17339
				"public class X<T, U, V extends X<T, U, V>> extends ArrayList<V> implements Inter<T, U> {\n" + 
17340
				"	public final void foo(U u) {\n" + 
17341
				"		X.bar(this, u);\n" + 
17342
				"	}\n" + 
17343
				"	public static final <P, Q, R> void bar(Collection<R> c, Q q) {}\n" + 
17344
				"}\n",
17345
			},
17346
			"");	
17347
	}
17348
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87550 - variation	
17349
	public void test0564() {
17350
		this.runConformTest(
17351
			new String[] {
17352
				"X.java",
17353
				"import java.util.*;\n" + 
17354
				"interface Inter<A, B> {}\n" + 
17355
				"public class X<T, U, V extends X<T, U, V>> extends ArrayList<V> implements Inter<T, U> {\n" + 
17356
				"	public final void foo(U u) {\n" + 
17357
				"		X.bar(this, u);\n" + 
17358
				"	}\n" + 
17359
				"	public static final <P, Q> void bar(Collection<? extends Inter<P, Q>> c, Q q) {}\n" + 
17360
				"}\n",
17361
			},
17362
			"");	
17363
	}	
17364
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=87995	- check no warning
17365
	public void test0565() {
17366
		this.runNegativeTest(
17367
			new String[] {
17368
				"X.java",
17369
				"public class X {\n" + 
17370
				"interface IFoo<T> {\n" + 
17371
				"    public T get(Class<T> clazz);\n" + 
17372
				"   Zork z;\n" +
17373
				"}\n" + 
17374
				"\n" + 
17375
				"class Bar implements IFoo<Integer> {\n" + 
17376
				"    public Integer get(Class<Integer> arg0) {\n" + 
17377
				"        return new Integer(3);\n" + 
17378
				"    }\n" + 
17379
				"}\n" + 
17380
				"}\n",
17381
			},
17382
			"----------\n" + 
17383
			"1. ERROR in X.java (at line 4)\n" + 
17384
			"	Zork z;\n" + 
17385
			"	^^^^\n" + 
17386
			"Zork cannot be resolved to a type\n" + 
17387
			"----------\n");	
17388
	}	
17389
	public void test0566() {
17390
		this.runNegativeTest(
17391
			new String[] {
17392
				"X.java",
17393
				"import java.util.*;\n" + 
17394
				"\n" + 
17395
				"public class X {\n" + 
17396
				"\n" + 
17397
				"	void bar2() {\n" + 
17398
				"		List<X1> le = new ArrayList<X1>(5);\n" + 
17399
				"		le = fill(le, new X2());\n" + 
17400
				"	}\n" + 
17401
				"	<T> List<T> fill(List<? super T> lt, T t) { return null; }\n" + 
17402
				"}\n" + 
17403
				"class X1 {}\n" + 
17404
				"class X2 extends X1 {\n" + 
17405
				"	void foo(){}\n" + 
17406
				"}\n",
17407
			},
17408
			"----------\n" + 
17409
			"1. ERROR in X.java (at line 7)\n" + 
17410
			"	le = fill(le, new X2());\n" + 
17411
			"	     ^^^^^^^^^^^^^^^^^^\n" + 
17412
			"Type mismatch: cannot convert from List<X2> to List<X1>\n" + 
17413
			"----------\n");	
17414
	}		
17415
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89454
17416
	public void test0567() {
17417
		this.runConformTest(
17418
			new String[] {
17419
				"Thrower.java",
17420
				"public interface Thrower<E extends Exception> {\n" + 
17421
				"    public void throwIt() throws E;\n" + 
17422
				"}\n",
17423
			},
17424
			"");
17425
		this.runConformTest(
17426
			new String[] {
17427
				"GenericsTest.java",
17428
				"public class GenericsTest {\n" + 
17429
				"    public static void main(String[] args) throws MyException {\n" + 
17430
				"        Thrower<MyException> thrower = new Thrower<MyException>() {\n" + 
17431
				"            public void throwIt() throws MyException {\n" + 
17432
				"                throw new MyException();\n" + 
17433
				"            }\n" + 
17434
				"        };\n" + 
17435
				"        try {\n" + 
17436
				"           thrower.throwIt();\n" + 
17437
				"        } catch(Exception e) {\n" + 
17438
				"          System.out.println(\"SUCCESS\");\n" + 
17439
				"        }\n" + 
17440
				"    }\n" + 
17441
				"}\n" + 
17442
				"class MyException extends Exception {\n" + 
17443
				"}\n",
17444
			},
17445
			"SUCCESS",
17446
			null,
17447
			false,
17448
			null);
17449
	}	
17450
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89448
17451
	public void test0568() {
17452
		this.runConformTest(
17453
			new String[] {
17454
				"X.java",
17455
				"import java.util.ArrayList;\n" + 
17456
				"import java.util.List;\n" + 
17457
				"\n" + 
17458
				"public class X {\n" + 
17459
				"\n" + 
17460
				"    public static void main(String[] args) {\n" + 
17461
				"\n" + 
17462
				"        ArrayList<ArrayList<Long>> n = new ArrayList<ArrayList<Long>>();\n" + 
17463
				"        ArrayList<Long> arr = new ArrayList<Long>();\n" + 
17464
				"        arr.add(new Long(5));\n" + 
17465
				"        n.add(arr);\n" + 
17466
				"        \n" + 
17467
				"        List<? extends List<Long>> m = n; // Whoa!\n" + 
17468
				"        \n" + 
17469
				"        for(Long l : m.get(0)) {\n" + 
17470
				"            System.out.println(l);\n" + 
17471
				"        }\n" + 
17472
				"    }\n" + 
17473
				"\n" + 
17474
				"}\n",
17475
			},
17476
			"5");	
17477
	}	
17478
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89778
17479
	public void test0569() {
17480
		this.runNegativeTest(
17481
			new String[] {
17482
				"X.java",
17483
				"public class X\n" + 
17484
				"{\n" + 
17485
				"    protected static <T extends Exception> void foo() throws T, Exce {\n" + 
17486
				"    }\n" + 
17487
				"}\n",
17488
			},
17489
			"----------\n" + 
17490
			"1. ERROR in X.java (at line 3)\n" + 
17491
			"	protected static <T extends Exception> void foo() throws T, Exce {\n" + 
17492
			"	                                                            ^^^^\n" + 
17493
			"Exce cannot be resolved to a type\n" + 
17494
			"----------\n");	
17495
	}		
17496
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90147
17497
	public void test0570() {
17498
		this.runNegativeTest(
17499
			new String[] {
17500
				"X.java",
17501
				"public class X<T extends Object> {\n" + 
17502
				"  public class InnerClass implements Comparable<T> {\n" + 
17503
				"    public int compareTo(T other) {\n" + 
17504
				"      return -1;\n" + 
17505
				"    }\n" + 
17506
				"  }\n" + 
17507
				"  \n" + 
17508
				"  public void foo() {\n" + 
17509
				"    InnerClass a = new InnerClass();\n" + 
17510
				"    InnerClass b = new InnerClass();\n" + 
17511
				"    // The following line does not compile (anymore):\n" + 
17512
				"    a.compareTo(b);\n" + 
17513
				"  }\n" + 
17514
				"}\n",
17515
			},
17516
			"----------\n" + 
17517
			"1. ERROR in X.java (at line 12)\n" + 
17518
			"	a.compareTo(b);\n" + 
17519
			"	  ^^^^^^^^^\n" + 
17520
			"The method compareTo(T) in the type X<T>.InnerClass is not applicable for the arguments (X<T>.InnerClass)\n" + 
17521
			"----------\n");	
17522
	}
17523
	public void test0571() {
17524
		this.runConformTest(
17525
			new String[] {
17526
				"X.java",
17527
				"interface IFoo {\n" + 
17528
				"	void foo();\n" + 
17529
				"}\n" + 
17530
				"class Box<T extends IFoo> {\n" + 
17531
				"	T value() {\n" + 
17532
				"		return null;\n" + 
17533
				"	}\n" + 
17534
				"}\n" + 
17535
				"\n" + 
17536
				"interface IBar {\n" + 
17537
				"	void bar();\n" + 
17538
				"}\n" + 
17539
				"\n" + 
17540
				"public class X {\n" + 
17541
				"	void test01(Box<?> box) {\n" + 
17542
				"		box.value().foo();\n" + 
17543
				"	}\n" + 
17544
				"	void test02(Box<? extends IBar> box) {\n" + 
17545
				"		box.value().foo();\n" + 
17546
				"		box.value().bar();\n" + 
17547
				"	}\n" + 
17548
				"	public static void main(String[] args) {\n" + 
17549
				"		System.out.println(\"SUCCESS\");\n" + 
17550
				"	}\n" + 
17551
				"}\n",
17552
			},
17553
			"SUCCESS");	
17554
	}
17555
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90430
17556
	public void test0572() {
17557
		this.runConformTest(
17558
			new String[] {
17559
				"X.java",
17560
				"public class X {\n" + 
17561
				"	public <T extends Enum<T>> void doWithEnumClass(Class<T> enumClass) {\n" + 
17562
				"	}\n" + 
17563
				"\n" + 
17564
				"	public void f() {\n" + 
17565
				"		Class<?> cl = null; // Returned by Class.forName(\"xyz\");\n" + 
17566
				"		doWithEnumClass((Class<Enum>) cl);\n" + 
17567
				"	}\n" + 
17568
			"}\n",
17569
			},
17570
			"");	
17571
	}		
17572
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90430 - check unchecked warnings
17573
	public void test0573() {
17574
		this.runNegativeTest(
17575
			new String[] {
17576
				"X.java",
17577
				"public class X {\n" + 
17578
				"	public <T extends Enum<T>> void doWithEnumClass(Class<T> enumClass) {\n" + 
17579
				"		Zork z;\n" +
17580
				"	}\n" + 
17581
				"\n" + 
17582
				"	public void f() {\n" + 
17583
				"		Class<?> cl = null; // Returned by Class.forName(\"xyz\");\n" + 
17584
				"		doWithEnumClass((Class<Enum>) cl);\n" + 
17585
				"	}\n" + 
17586
			"}\n",
17587
			},
17588
			"----------\n" + 
17589
			"1. ERROR in X.java (at line 3)\n" + 
17590
			"	Zork z;\n" + 
17591
			"	^^^^\n" + 
17592
			"Zork cannot be resolved to a type\n" + 
17593
			"----------\n" + 
17594
			"2. WARNING in X.java (at line 8)\n" + 
17595
			"	doWithEnumClass((Class<Enum>) cl);\n" + 
17596
			"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
17597
			"Type safety: Unchecked invocation doWithEnumClass(Class<Enum>) of the generic method doWithEnumClass(Class<T>) of type X\n" + 
17598
			"----------\n" + 
17599
			"3. WARNING in X.java (at line 8)\n" + 
17600
			"	doWithEnumClass((Class<Enum>) cl);\n" + 
17601
			"	                ^^^^^^^^^^^^^^^^\n" + 
17602
			"Type safety: Unchecked cast from Class<capture#1-of ?> to Class<Enum>\n" + 
17603
			"----------\n" + 
17604
			"4. WARNING in X.java (at line 8)\n" + 
17605
			"	doWithEnumClass((Class<Enum>) cl);\n" + 
17606
			"	                       ^^^^\n" + 
17607
			"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
17608
			"----------\n");	
17609
	}			
17610
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation
17611
	public void test0574() {
17612
		this.runNegativeTest(
17613
			new String[] {
17614
				"X.java",
17615
				"import java.util.List;\n" + 
17616
				"\n" + 
17617
				"public class X {\n" + 
17618
				"\n" + 
17619
				"	class C2 {\n" + 
17620
				"		<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
17621
				"		<T extends String> T foo(Object o) {  return null; } // ok\n" + 
17622
				"	}\n" + 
17623
				"	public static void main(String[] args) {\n" + 
17624
				"		new X().new C2().foo((List<String>) null);\n" + 
17625
				"	}\n" + 
17626
				"}\n"
17627
			},
17628
			"----------\n" + 
17629
			"1. WARNING in X.java (at line 6)\n" + 
17630
			"	<T extends Integer> T foo(Object o) {  return null; } // ok\n" + 
17631
			"	           ^^^^^^^\n" + 
17632
			"The type parameter T should not be bounded by the final type Integer. Final types cannot be further extended\n" + 
17633
			"----------\n" + 
17634
			"2. WARNING in X.java (at line 7)\n" + 
17635
			"	<T extends String> T foo(Object o) {  return null; } // ok\n" + 
17636
			"	           ^^^^^^\n" + 
17637
			"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
17638
			"----------\n" + 
17639
			"3. ERROR in X.java (at line 10)\n" + 
17640
			"	new X().new C2().foo((List<String>) null);\n" + 
17641
			"	                 ^^^\n" + 
17642
			"The method foo(Object) is ambiguous for the type X.C2\n" + 
17643
			"----------\n");
17644
	}	
17645
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496 - variation with field ref
17646
	public void test0575() {
17647
		this.runNegativeTest(
17648
			new String[] {
17649
				"X.java",
17650
				"public class X {\n" + 
17651
				"    public static void main(String[] args) {\n" + 
17652
				"        Foo<?> f1 = new Foo<Integer>();\n" + 
17653
				"        (f1).bar = (f1).bar;\n" + 
17654
				"    }\n" + 
17655
				"    static class Foo<T> {\n" + 
17656
				"       Bar<T> bar = new Bar<T>();\n" + 
17657
				"    }\n" + 
17658
				"    static class Bar<T> {\n" + 
17659
				"        T t;\n" + 
17660
				"    }\n" + 
17661
				"}\n"
17662
			},
17663
			"----------\n" + 
17664
			"1. ERROR in X.java (at line 4)\n" + 
17665
			"	(f1).bar = (f1).bar;\n" + 
17666
			"	           ^^^^^^^^\n" + 
17667
			"Type mismatch: cannot convert from X.Bar<capture#2-of ?> to X.Bar<capture#1-of ?>\n" + 
17668
			"----------\n");
17669
	}
17670
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496 - variation with single ref
17671
	public void test0576() {
17672
		this.runConformTest(
17673
			new String[] {
17674
				"X.java",
17675
				"public class X {\n" + 
17676
				"    public static void main(String[] args) {\n" + 
17677
				"        Foo<?> f1 = new Foo<Integer>();\n" + 
17678
				"        Foo<?> f2 = new Foo<String>();\n" + 
17679
				"		f1 = f1;\n" + 
17680
				"		f1 = f2;\n" + 
17681
				"    }\n" + 
17682
				"    static class Foo<T> {\n" + 
17683
				"    }\n" + 
17684
				"}\n"
17685
			},
17686
			"");
17687
	}
17688
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496 - variation with qualified name ref
17689
	public void test0577() {
17690
		this.runNegativeTest(
17691
			new String[] {
17692
				"X.java",
17693
				"public class X {\n" + 
17694
				"    public static void main(String[] args) {\n" + 
17695
				"        Foo<?> f1 = new Foo<Integer>();\n" + 
17696
				"        (f1).bar = f1.bar;\n" + 
17697
				"    }\n" + 
17698
				"    static class Foo<T> {\n" + 
17699
				"       Bar<T> bar = new Bar<T>();\n" + 
17700
				"    }\n" + 
17701
				"    static class Bar<T> {\n" + 
17702
				"        T t;\n" + 
17703
				"    }\n" + 
17704
				"}\n"
17705
			},
17706
			"----------\n" + 
17707
			"1. ERROR in X.java (at line 4)\n" + 
17708
			"	(f1).bar = f1.bar;\n" + 
17709
			"	           ^^^^^^\n" + 
17710
			"Type mismatch: cannot convert from X.Bar<capture#2-of ?> to X.Bar<capture#1-of ?>\n" + 
17711
			"----------\n");
17712
	}	
17713
	// check array bound for wildcard
17714
	public void test0578() {
17715
		this.runConformTest(
17716
			new String[] {
17717
				"X.java",
17718
				"public class X {\n" + 
17719
				"	void foo(Box<? extends int[]> box) {\n" + 
17720
				"		int[] ints = box.get();\n" + 
17721
				"	}\n" + 
17722
				"}\n" + 
17723
				"class Box<T> {\n" + 
17724
				"	T get() { return null; }\n" + 
17725
				"}\n"
17726
			},
17727
			"");
17728
	}		
17729
	// check array bound for wildcard
17730
	public void test0579() {
17731
		this.runNegativeTest(
17732
			new String[] {
17733
				"X.java",
17734
				"public class X {\n" + 
17735
				"	void foo(Box<? super int[]> box) {\n" + 
17736
				"		int[] ints = box.get();\n" + 
17737
				"	}\n" + 
17738
				"}\n" + 
17739
				"class Box<T> {\n" + 
17740
				"	T get() { return null; }\n" + 
17741
				"}\n"
17742
			},
17743
			"----------\n" + 
17744
			"1. ERROR in X.java (at line 3)\n" + 
17745
			"	int[] ints = box.get();\n" + 
17746
			"	             ^^^^^^^^^\n" + 
17747
			"Type mismatch: cannot convert from capture#1-of ? super int[] to int[]\n" + 
17748
			"----------\n");
17749
	}		
17750
	// check array bound for wildcard
17751
	public void test0580() {
17752
		this.runNegativeTest(
17753
			new String[] {
17754
				"X.java",
17755
				"public class X {\n" + 
17756
				"	void foo(Box<?> box) {\n" + 
17757
				"		int[] ints = box.get();\n" + 
17758
				"	}\n" + 
17759
				"}\n" + 
17760
				"class Box<T> {\n" + 
17761
				"	T get() { return null; }\n" + 
17762
				"}\n"
17763
			},
17764
			"----------\n" + 
17765
			"1. ERROR in X.java (at line 3)\n" + 
17766
			"	int[] ints = box.get();\n" + 
17767
			"	             ^^^^^^^^^\n" + 
17768
			"Type mismatch: cannot convert from capture#1-of ? to int[]\n" + 
17769
			"----------\n");
17770
	}
17771
	
17772
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496 - variation
17773
	public void test0581() {
17774
	    this.runNegativeTest(
17775
			new String[] {
17776
	            "X.java",
17777
	            "class X {" +
17778
	            "  public static void main(String[] args) {\n" +
17779
	            "    Foo<?> f1 = new Foo<Integer>();\n" +
17780
	            "    f1.bar = f1.bar;\n" +
17781
	            "   }\n" +
17782
	            " }\n" +
17783
	            "class Foo<T> {\n" +
17784
	            "  Bar<T> bar = new Bar<T>();\n" +
17785
	            "}\n" +
17786
	            "class Bar<T> {\n" +
17787
	            "  T t;\n" +
17788
	            "}\n"
17789
	   		},
17790
			"----------\n" + 
17791
			"1. ERROR in X.java (at line 3)\n" + 
17792
			"	f1.bar = f1.bar;\n" + 
17793
			"	         ^^^^^^\n" + 
17794
			"Type mismatch: cannot convert from Bar<capture#2-of ?> to Bar<capture#1-of ?>\n" + 
17795
			"----------\n");            
17796
	}
17797
17798
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84496
17799
	public void test0582() {
17800
	    this.runConformTest(
17801
            new String[] {
17802
                "X.java",
17803
                "import java.util.List;\n" +
17804
                "class X {\n" +
17805
                "  void foo(List<? extends I1> l1) {\n" +
17806
                "    C1 c1 = (C1)l1.get(0);\n" +
17807
                "  }\n" +
17808
                "}\n" +
17809
                "interface I1{}\n" +
17810
                "class C1{}\n"
17811
            },
17812
            "");
17813
	}
17814
	
17815
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=91021
17816
	public void test0583() {
17817
	    this.runNegativeTest(
17818
            new String[] {
17819
                "X.java",
17820
				"class D<U> {\n" + 
17821
				"		 public D (D<U> anotherD) {\n" + 
17822
				"		 }\n" + 
17823
				"}\n" + 
17824
				"\n" + 
17825
				"public class X<S> {\n" + 
17826
				"		 public static class C<T> {\n" + 
17827
				"		 		 public C(C<T> anotherC) {\n" + 
17828
				"		 		 }\n" + 
17829
				"		 }\n" + 
17830
				"\n" + 
17831
				"		 public void mD(D<S> d) {\n" + 
17832
				"		 		 //the following line is OK (no warning reported)\n" + 
17833
				"		 		 new D<S>(d);\n" + 
17834
				"		 }\n" + 
17835
				"		 \n" + 
17836
				"		 public void mC(C<S> c) {\n" + 
17837
				"		 		 /* type safety warning\n" + 
17838
				"		 		  * (The expression of type X.C<S>\n" + 
17839
				"		 		  * needs unchecked conversion to conform to\n" + 
17840
				"		 		  * XSB<S>.C<S>)\n" + 
17841
				"		 		  */\n" + 
17842
				"		 		 new C<S>(c);\n" + 
17843
				"		 }\n" + 
17844
				"		Zork z;\n" +
17845
				"}\n"
17846
            },
17847
			"----------\n" + 
17848
			"1. ERROR in X.java (at line 25)\n" + 
17849
			"	Zork z;\n" + 
17850
			"	^^^^\n" + 
17851
			"Zork cannot be resolved to a type\n" + 
17852
			"----------\n");
17853
	}	
17854
	
17855
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=91017
17856
	public void test0584() {
17857
	    this.runNegativeTest(
17858
            new String[] {
17859
                "X.java",
17860
				"import java.util.ArrayList;\n" + 
17861
				"import java.util.List;\n" + 
17862
				"\n" + 
17863
				"public class X {\n" + 
17864
				"		 public static void main(String[] args) {\n" + 
17865
				"		 		 List<String> stringList = new ArrayList<String>();\n" + 
17866
				"		 		 stringList.add(\"foo\");\n" + 
17867
				"		 		 List<Integer> intList = new ArrayList<Integer>();\n" + 
17868
				"		 		 intList.add(1);\n" + 
17869
				"\n" + 
17870
				"		 		 List<?> untypedList = stringList;\n" + 
17871
				"		 		 List<?> untypedList2 = intList;\n" + 
17872
				"\n" + 
17873
				"		 		 //correctly flagged as error: untypedList.add(new Object());\n" + 
17874
				"		 		 //ditto: untypedList.add(untypedList2.get(0));\n" + 
17875
				"\n" + 
17876
				"		 		 //but this is not flagged at all by eclipse:\n" + 
17877
				"		 		 untypedList.addAll(untypedList2);\n" + 
17878
				"\n" + 
17879
				"		 		 for(String s : stringList){\n" + 
17880
				"		 		 		 //next line generates runtime ClassCastException\n" + 
17881
				"		 		 		 Logger.log(\"Test_Lists.main: s: \" + s);\n" + 
17882
				"		 		 }\n" + 
17883
				"		 }\n" + 
17884
				"}\n"
17885
            },
17886
    		"----------\n" + 
17887
    		"1. ERROR in X.java (at line 18)\n" + 
17888
    		"	untypedList.addAll(untypedList2);\n" + 
17889
    		"	            ^^^^^^\n" + 
17890
    		"The method addAll(Collection<? extends capture#1-of ?>) in the type List<capture#1-of ?> is not applicable for the arguments (List<capture#2-of ?>)\n" + 
17891
    		"----------\n" + 
17892
    		"2. ERROR in X.java (at line 22)\n" + 
17893
    		"	Logger.log(\"Test_Lists.main: s: \" + s);\n" + 
17894
    		"	^^^^^^\n" + 
17895
    		"Logger cannot be resolved\n" + 
17896
    		"----------\n");
17897
	}		
17898
	
17899
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90881
17900
	public void test0585() {
17901
	    this.runNegativeTest(
17902
            new String[] {
17903
                "X.java",
17904
				"import java.util.*;\n" + 
17905
				"\n" + 
17906
				"public class X {\n" + 
17907
				"        public static void main(String[] args) {\n" + 
17908
				"                Outer.Comparator<String> i = new Outer.Comparator<String>() {\n" + 
17909
				"\n" + 
17910
				"                        public boolean equals(String a, String b) {\n" + 
17911
				"                                return false;\n" + 
17912
				"                        }\n" + 
17913
				"\n" + 
17914
				"                        public int hashCode(String a) {\n" + 
17915
				"                                return 0;\n" + 
17916
				"                        }\n" + 
17917
				"                };\n" + 
17918
				"\n" + 
17919
				"        }\n" + 
17920
				"}\n" + 
17921
				"\n" + 
17922
				"class Outer {}\n",
17923
            },
17924
			"----------\n" + 
17925
			"1. ERROR in X.java (at line 5)\n" + 
17926
			"	Outer.Comparator<String> i = new Outer.Comparator<String>() {\n" + 
17927
			"	^^^^^^^^^^^^^^^^\n" + 
17928
			"Outer.Comparator cannot be resolved to a type\n" + 
17929
			"----------\n" + 
17930
			"2. ERROR in X.java (at line 5)\n" + 
17931
			"	Outer.Comparator<String> i = new Outer.Comparator<String>() {\n" + 
17932
			"	                                 ^^^^^^^^^^^^^^^^\n" + 
17933
			"Outer.Comparator cannot be resolved to a type\n" + 
17934
			"----------\n");
17935
	}			
17936
	
17937
	// **
17938
	// note: the test does not show the needed unchecked warning, since it is
17939
	//       a conform test
17940
	public void test0586() {
17941
	    this.runConformTest(
17942
            new String[] {
17943
                "X.java",
17944
				"public class X {\n" + 
17945
				"    static class BB<T, S> { }\n" + 
17946
				"    static class BD<T> extends BB<T, T> { }\n" + 
17947
				"    void f() {\n" + 
17948
				"        BB<? extends Number, ? super Integer> bb = null;\n" + 
17949
				"        Object o = (BD<Number>) bb;\n" + 
17950
				"    }\n" + 
17951
				"}\n",
17952
            },
17953
			"");
17954
	}			
17955
	
17956
	public void test0587() {
17957
	    this.runConformTest(
17958
            new String[] {
17959
                "X.java",
17960
				"interface DA<T> {\n" + 
17961
				"}\n" + 
17962
				"interface DB<T> extends DA<T> {\n" + 
17963
				"}\n" + 
17964
				"interface DC<T> extends DA<Integer> {\n" + 
17965
				"}\n" + 
17966
				"\n" + 
17967
				"public class X {\n" + 
17968
				"	Object o = (DC<?>) (DA<?>) null;\n" + 
17969
				"}\n",
17970
            },
17971
			"");
17972
	}			
17973
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90433
17974
	public void test0588() {
17975
	    this.runNegativeTest(
17976
            new String[] {
17977
                "X.java",
17978
				"public class X<S extends Comparable<S>> {\n" + 
17979
				"    public void f() {\n" + 
17980
				"        Class<S> currentClass = null;\n" + 
17981
				"        boolean b = currentClass == Long.class;\n" + // not provably distinct types
17982
				"		\n" + 
17983
				"		boolean c = X.class == Long.class;\n" + // provably distinct types
17984
				"    }\n" + 
17985
				"}\n",
17986
            },
17987
    		"----------\n" + 
17988
    		"1. ERROR in X.java (at line 6)\n" + 
17989
    		"	boolean c = X.class == Long.class;\n" + 
17990
    		"	            ^^^^^^^^^^^^^^^^^^^^^\n" + 
17991
    		"Incompatible operand types Class<X> and Class<Long>\n" + 
17992
    		"----------\n");
17993
	}			
17994
	
17995
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85281
17996
	public void test0589() {
17997
	    this.runNegativeTest(
17998
            new String[] {
17999
                "X.java",
18000
				"import java.util.ArrayList;\n" + 
18001
				"import java.util.List;\n" + 
18002
				"\n" + 
18003
				"public class X {\n" + 
18004
				"\n" + 
18005
				"	void addAll(List<? extends Number> target, List<? extends Number> source) {\n" + 
18006
				"		target.addAll(source);\n" + 
18007
				"	}\n" + 
18008
				"\n" + 
18009
				"	public static void main(String... args) {\n" + 
18010
				"		List<Integer> ints = new ArrayList<Integer>();\n" + 
18011
				"		ints.add(3);\n" + 
18012
				"\n" + 
18013
				"		List<Float> floats = new ArrayList<Float>();\n" + 
18014
				"		floats.add(3f);\n" + 
18015
				"\n" + 
18016
				"		new X().addAll(ints, floats);\n" + 
18017
				"\n" + 
18018
				"		for (Integer integer : ints) {\n" + 
18019
				"			System.out.println(integer.intValue());\n" + 
18020
				"		}\n" + 
18021
				"	}\n" + 
18022
				"}\n",
18023
            },
18024
    		"----------\n" + 
18025
    		"1. ERROR in X.java (at line 7)\n" + 
18026
    		"	target.addAll(source);\n" + 
18027
    		"	       ^^^^^^\n" + 
18028
    		"The method addAll(Collection<? extends capture#1-of ? extends Number>) in the type List<capture#1-of ? extends Number> is not applicable for the arguments (List<capture#2-of ? extends Number>)\n" + 
18029
    		"----------\n");
18030
	}		
18031
18032
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85281 - variation
18033
	public void test0590() {
18034
	    this.runNegativeTest(
18035
            new String[] {
18036
                "X.java",
18037
				"import java.util.ArrayList;\n" + 
18038
				"import java.util.List;\n" + 
18039
				"\n" + 
18040
				"public class X {\n" + 
18041
				"\n" + 
18042
				"	void assignAll(Class<? super Number> sup, Class<? extends Number> ext) {\n" + 
18043
				"		Class<? super Number> superSup = sup.getSuperclass();\n" + 
18044
				"		Class<?> superExt = ext.getSuperclass();\n" + 
18045
				"		Class<? super Number> superSup2 = ext.getSuperclass();\n" + 
18046
				"	}	\n" + 
18047
				"}\n",
18048
            },
18049
    		"----------\n" + 
18050
    		"1. ERROR in X.java (at line 9)\n" + 
18051
    		"	Class<? super Number> superSup2 = ext.getSuperclass();\n" + 
18052
    		"	                                  ^^^^^^^^^^^^^^^^^^^\n" + 
18053
    		"Type mismatch: cannot convert from Class<capture#6-of ? super capture#5-of ? extends Number> to Class<? super Number>\n" + 
18054
    		"----------\n");
18055
	}
18056
	
18057
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85281 - variation
18058
	public void test0591() {
18059
	    this.runConformTest(
18060
            new String[] {
18061
                "X.java",
18062
				"public class X<U> {\n" + 
18063
				"\n" + 
18064
				"	public Values<U> foo(Box<? extends U> box) {\n" + 
18065
				"		return selectedValues(box.getValues());\n" + 
18066
				"	}\n" + 
18067
				"	public static <G> Values<G> selectedValues(Values<? extends G> v) {\n" + 
18068
				"		return null;\n" + 
18069
				"	}\n" + 
18070
				"}\n" + 
18071
				"\n" + 
18072
				"abstract class Box<V> {\n" + 
18073
				"	  abstract Values<V> getValues();\n" + 
18074
				"}\n" + 
18075
				"abstract class Values<T> {\n" + 
18076
				"}\n",
18077
            },
18078
			"");
18079
	}		
18080
	public void test0592() {
18081
	    this.runConformTest(
18082
            new String[] {
18083
                "X.java",
18084
				"import java.util.*;\n" + 
18085
				"public class X {\n" + 
18086
				"    List<?> l;\n" + 
18087
				"    void m() {\n" + 
18088
				"	m2(l);\n" + 
18089
				"    }\n" + 
18090
				"    <T> void m2(List<T> l2) {\n" + 
18091
				"	l2.add(l2.remove(0));\n" + 
18092
				"    }\n" + 
18093
				"}\n",
18094
            },
18095
			"");
18096
	}			
18097
	public void test0593() {
18098
	    this.runNegativeTest(
18099
            new String[] {
18100
                "X.java",
18101
				"import java.util.*;\n" + 
18102
				"public class X {\n" + 
18103
				"	    List<Class<?>> classes1 = Arrays.asList(String.class, Boolean.class);\n" + 
18104
				"	    List<? extends Class<?>> classes2 = Arrays.asList(String.class, Boolean.class);\n" + 				
18105
				"}\n",
18106
            },
18107
    		"----------\n" + 
18108
    		"1. ERROR in X.java (at line 3)\n" + 
18109
    		"	List<Class<?>> classes1 = Arrays.asList(String.class, Boolean.class);\n" + 
18110
    		"	               ^^^^^^^^\n" + 
18111
    		"Type mismatch: cannot convert from List<Class<? extends Object&Serializable&Comparable<?>>> to List<Class<?>>\n" + 
18112
    		"----------\n" + 
18113
    		"2. WARNING in X.java (at line 3)\n" + 
18114
    		"	List<Class<?>> classes1 = Arrays.asList(String.class, Boolean.class);\n" + 
18115
    		"	                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18116
    		"Type safety : A generic array of Class<? extends Object&Serializable&Comparable<?>> is created for a varargs parameter\n" + 
18117
    		"----------\n" + 
18118
    		"3. WARNING in X.java (at line 4)\n" + 
18119
    		"	List<? extends Class<?>> classes2 = Arrays.asList(String.class, Boolean.class);\n" + 
18120
    		"	                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18121
    		"Type safety : A generic array of Class<? extends Object&Serializable&Comparable<?>> is created for a varargs parameter\n" + 
18122
    		"----------\n");
18123
	}		
18124
	public void test0594() {
18125
	    this.runNegativeTest(
18126
            new String[] {
18127
                "X.java",
18128
				" import java.util.*;\n" + 
18129
				"import static java.util.Map.*;\n" + 
18130
				"\n" + 
18131
				"abstract class MyIterator<E> implements Iterator<E> {\n" + 
18132
				"	Set<E> iteratedSet;\n" + 
18133
				"}\n" + 
18134
				"public class X {\n" + 
18135
				"	\n" + 
18136
				"	void foo() {\n" + 
18137
				"		Map<String, ?> map;\n" + 
18138
				"		Iterator<Entry<String, ?>> it = map.entrySet().iterator();\n" + 
18139
				"\n" + 
18140
				"		Entry<String, Number> unrelatedEntry;\n" + 
18141
				"		MyIterator<Entry<String, ?>> mit = (MyIterator<Entry<String, ?>>) it;\n" + 
18142
				"		mit.iteratedSet.add(unrelatedEntry);\n" + 
18143
				"	}\n" + 
18144
				"}\n",
18145
            },
18146
    		"----------\n" + 
18147
    		"1. ERROR in X.java (at line 11)\n" + 
18148
    		"	Iterator<Entry<String, ?>> it = map.entrySet().iterator();\n" + 
18149
    		"	                                ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18150
    		"Type mismatch: cannot convert from Iterator<Map.Entry<String,capture#1-of ?>> to Iterator<Map.Entry<String,?>>\n" + 
18151
    		"----------\n");
18152
	}		
18153
	public void test0595() {
18154
	    this.runNegativeTest(
18155
            new String[] {
18156
                "X.java",
18157
				" import java.util.*;\n" + 
18158
				"import static java.util.Map.*;\n" + 
18159
				"\n" + 
18160
				"abstract class MyIterator<E> implements Iterator<E> {\n" + 
18161
				"	Set<E> iteratedSet;\n" + 
18162
				"}\n" + 
18163
				"public class X {\n" + 
18164
				"	\n" + 
18165
				"	void bar() {\n" + 
18166
				"		Map<? extends String, ?> map;\n" + 
18167
				"		Iterator<Entry<? extends String, ?>> it = map.entrySet().iterator();\n" + 
18168
				"\n" + 
18169
				"		Entry<String, Number> unrelatedEntry;\n" + 
18170
				"		MyIterator<Entry<? extends String, ?>> mit = (MyIterator<Entry<? extends String, ?>>) it;\n" + 
18171
				"		mit.iteratedSet.add(unrelatedEntry);\n" + 
18172
				"	}\n" + 
18173
				"}\n",
18174
            },
18175
    		"----------\n" + 
18176
    		"1. ERROR in X.java (at line 11)\n" + 
18177
    		"	Iterator<Entry<? extends String, ?>> it = map.entrySet().iterator();\n" + 
18178
    		"	                                          ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18179
    		"Type mismatch: cannot convert from Iterator<Map.Entry<capture#1-of ? extends String,capture#2-of ?>> to Iterator<Map.Entry<? extends String,?>>\n" + 
18180
    		"----------\n");
18181
	}		
18182
	public void test0596() {
18183
	    this.runConformTest(
18184
            new String[] {
18185
                "X.java",
18186
				"import java.util.*;\n" + 
18187
				"\n" + 
18188
				"public class X {\n" + 
18189
				"	<T> Set<T> unmodifiableSet(Set<T> set) {\n" + 
18190
				"		return set;\n" + 
18191
				"	}\n" + 
18192
				"	public void foo(Set<?> s) {\n" + 
18193
				"		Set<?> s2 = unmodifiableSet(s);\n" + 
18194
				"	}\n" + 
18195
				"}\n",
18196
            },
18197
			"");
18198
	}		
18199
	public void test0597() {
18200
	    this.runNegativeTest(
18201
            new String[] {
18202
                "X.java",
18203
				"public class X<U> {\n" + 
18204
				"	Pair<U,U> m() { \n" + 
18205
				"		return null; \n" + 
18206
				"	}\n" + 
18207
				"	void foo(X<?> x) {\n" + 
18208
				"		x.m().first = x.m().second;\n" + 
18209
				"	}\n" + 
18210
				"}\n" + 
18211
				"	\n" + 
18212
				"class Pair<E, F> {\n" + 
18213
				"	E first;\n" + 
18214
				"	F second;\n" + 
18215
				"}\n",
18216
            },
18217
    		"----------\n" + 
18218
    		"1. ERROR in X.java (at line 6)\n" + 
18219
    		"	x.m().first = x.m().second;\n" + 
18220
    		"	              ^^^^^^^^^^^^\n" + 
18221
    		"Type mismatch: cannot convert from capture#2-of ? to capture#1-of ?\n" + 
18222
    		"----------\n");
18223
	}		
18224
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90879
18225
	public void test0598() {
18226
	    this.runConformTest(
18227
            new String[] {
18228
                "X.java",
18229
				"import java.util.*;\n" + 
18230
				"\n" + 
18231
				"class X implements Comparable {\n" + 
18232
				"\n" + 
18233
				"	public int compareTo(Object o) {\n" + 
18234
				"		return 0;\n" + 
18235
				"	}\n" + 
18236
				"\n" + 
18237
				"}\n" + 
18238
				"\n" + 
18239
				"class Y {\n" + 
18240
				"	public static void main(String[] args) {\n" + 
18241
				"		List<X> lx = null;\n" + 
18242
				"		Collections.sort(lx);\n" + 
18243
				"	}\n" + 
18244
				"}\n",
18245
			},
18246
			"");
18247
	}			
18248
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90879 - variation
18249
	public void test0599() {
18250
	    this.runNegativeTest(
18251
            new String[] {
18252
                "X.java",
18253
				"import java.util.*;\n" + 
18254
				"\n" + 
18255
				"public class X implements Comparable {\n" + 
18256
				"	public static void main(String[] args) {\n" + 
18257
				"		Zork z;\n" + 
18258
				"		\n" + 
18259
				"		List<X> lx = null;\n" + 
18260
				"		sort1(lx);\n" + 
18261
				"		sort2(lx);\n" + 
18262
				"		sort3(lx);\n" + 
18263
				"		sort4(lx);\n" + 
18264
				"		sort5(lx);\n" + 
18265
				"	}\n" + 
18266
				"	public int compareTo(Object o) {\n" + 
18267
				"		return 0;\n" + 
18268
				"	}\n" + 
18269
				"	static <T extends Comparable<? super T>> void sort1(List<T> list) {}\n" + 
18270
				"	static <T extends Comparable<? extends T>> void sort2(List<T> list) {}\n" + 
18271
				"	static <T extends Comparable<?>> void sort3(List<T> list) {}\n" + 
18272
				"	static <T extends Comparable<T>> void sort4(List<T> list) {}\n" + 
18273
				"	static <T extends Comparable> void sort5(List<T> list) {}\n" + 
18274
				"}\n",
18275
			},
18276
			"----------\n" + 
18277
			"1. WARNING in X.java (at line 3)\n" + 
18278
			"	public class X implements Comparable {\n" + 
18279
			"	                          ^^^^^^^^^^\n" + 
18280
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18281
			"----------\n" + 
18282
			"2. ERROR in X.java (at line 5)\n" + 
18283
			"	Zork z;\n" + 
18284
			"	^^^^\n" + 
18285
			"Zork cannot be resolved to a type\n" + 
18286
			"----------\n" + 
18287
			"3. WARNING in X.java (at line 8)\n" + 
18288
			"	sort1(lx);\n" + 
18289
			"	^^^^^^^^^\n" + 
18290
			"Type safety: Unchecked invocation sort1(List<X>) of the generic method sort1(List<T>) of type X\n" + 
18291
			"----------\n" + 
18292
			"4. WARNING in X.java (at line 9)\n" + 
18293
			"	sort2(lx);\n" + 
18294
			"	^^^^^^^^^\n" + 
18295
			"Type safety: Unchecked invocation sort2(List<X>) of the generic method sort2(List<T>) of type X\n" + 
18296
			"----------\n" + 
18297
			"5. WARNING in X.java (at line 11)\n" + 
18298
			"	sort4(lx);\n" + 
18299
			"	^^^^^^^^^\n" + 
18300
			"Type safety: Unchecked invocation sort4(List<X>) of the generic method sort4(List<T>) of type X\n" + 
18301
			"----------\n" + 
18302
			"6. WARNING in X.java (at line 21)\n" + 
18303
			"	static <T extends Comparable> void sort5(List<T> list) {}\n" + 
18304
			"	                  ^^^^^^^^^^\n" + 
18305
			"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18306
			"----------\n");
18307
	}		
18308
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90879 - variation
18309
	public void test0600() {
18310
	    this.runNegativeTest(
18311
            new String[] {
18312
                "X.java",
18313
				"import java.util.*;\n" + 
18314
				"\n" + 
18315
				"public class X implements Comparable {\n" + 
18316
				"	public static void main(String[] args) {\n" + 
18317
				"		Zork z;\n" + 
18318
				"		\n" + 
18319
				"		List<MyEnum> le = null;\n" + 
18320
				"		sort6(le);\n" + 
18321
				"		sort7(le);\n" + 
18322
				"		sort8(le);\n" + 
18323
				"		sort9(le);\n" + 
18324
				"		sort10(le);\n" + 
18325
				"	}\n" + 
18326
				"	public int compareTo(Object o) {\n" + 
18327
				"		return 0;\n" + 
18328
				"	}\n" + 
18329
				"	static <T extends MyEnum<? super T>> void sort6(List<T> list) {}\n" + 
18330
				"	static <T extends MyEnum<? extends T>> void sort7(List<T> list) {}\n" + 
18331
				"	static <T extends MyEnum<?>> void sort8(List<T> list) {}\n" + 
18332
				"	static <T extends MyEnum<T>> void sort9(List<T> list) {}\n" + 
18333
				"	static <T extends MyEnum> void sort10(List<T> list) {}\n" + 
18334
				"}\n" + 
18335
				"class MyEnum<E extends MyEnum<E>> {}\n",
18336
            },
18337
            "----------\n" + 
18338
    		"1. WARNING in X.java (at line 3)\n" + 
18339
    		"	public class X implements Comparable {\n" + 
18340
    		"	                          ^^^^^^^^^^\n" + 
18341
    		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18342
    		"----------\n" + 
18343
    		"2. ERROR in X.java (at line 5)\n" + 
18344
    		"	Zork z;\n" + 
18345
    		"	^^^^\n" + 
18346
    		"Zork cannot be resolved to a type\n" + 
18347
    		"----------\n" + 
18348
    		"3. WARNING in X.java (at line 7)\n" + 
18349
    		"	List<MyEnum> le = null;\n" + 
18350
    		"	     ^^^^^^\n" + 
18351
    		"MyEnum is a raw type. References to generic type MyEnum<E> should be parameterized\n" + 
18352
    		"----------\n" + 
18353
    		"4. WARNING in X.java (at line 8)\n" + 
18354
    		"	sort6(le);\n" + 
18355
    		"	^^^^^^^^^\n" + 
18356
    		"Type safety: Unchecked invocation sort6(List<MyEnum>) of the generic method sort6(List<T>) of type X\n" + 
18357
    		"----------\n" + 
18358
    		"5. WARNING in X.java (at line 9)\n" + 
18359
    		"	sort7(le);\n" + 
18360
    		"	^^^^^^^^^\n" + 
18361
    		"Type safety: Unchecked invocation sort7(List<MyEnum>) of the generic method sort7(List<T>) of type X\n" + 
18362
    		"----------\n" + 
18363
    		"6. WARNING in X.java (at line 11)\n" + 
18364
    		"	sort9(le);\n" + 
18365
    		"	^^^^^^^^^\n" + 
18366
    		"Type safety: Unchecked invocation sort9(List<MyEnum>) of the generic method sort9(List<T>) of type X\n" + 
18367
    		"----------\n" + 
18368
    		"7. WARNING in X.java (at line 21)\n" + 
18369
    		"	static <T extends MyEnum> void sort10(List<T> list) {}\n" + 
18370
    		"	                  ^^^^^^\n" + 
18371
    		"MyEnum is a raw type. References to generic type MyEnum<E> should be parameterized\n" + 
18372
    		"----------\n");
18373
	}			
18374
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=85281 - variation
18375
	public void test0601() {
18376
	    this.runNegativeTest(
18377
            new String[] {
18378
                "X.java",
18379
				"public class X<U> {\n" + 
18380
				"\n" + 
18381
				"	public Values<U> foo(Box<? extends U> box) {\n" + 
18382
				"		return selectedValues(box.getValues());\n" + 
18383
				"	}\n" + 
18384
				"	public static <G> Values<G> selectedValues(Values<G> v) {\n" + 
18385
				"		return null;\n" + 
18386
				"	}\n" + 
18387
				"}\n" + 
18388
				"\n" + 
18389
				"abstract class Box<V> {\n" + 
18390
				"	  abstract Values<V> getValues();\n" + 
18391
				"}\n" + 
18392
				"abstract class Values<T> {\n" + 
18393
				"}\n",
18394
            },
18395
    		"----------\n" + 
18396
    		"1. ERROR in X.java (at line 4)\n" + 
18397
			"	return selectedValues(box.getValues());\n" + 
18398
			"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
18399
    		"Type mismatch: cannot convert from Values<capture#1-of ? extends U> to Values<U>\n" + 
18400
    		"----------\n");
18401
	}		
18402
	public void test0602() {
18403
	    this.runNegativeTest(
18404
            new String[] {
18405
                "X.java",
18406
				"public class X<U> {\n" + 
18407
				"\n" + 
18408
				"	public void foo(Box<? extends U> box) {\n" + 
18409
				"		box.getValues()[0] = box.getValues()[1];\n" + 
18410
				"	}\n" + 
18411
				"}\n" + 
18412
				"\n" + 
18413
				"abstract class Box<V> {\n" + 
18414
				"	  abstract Values<V>[] getValues();\n" + 
18415
				"}\n" + 
18416
				"abstract class Values<T> {\n" + 
18417
				"}\n",
18418
            },
18419
    		"----------\n" + 
18420
    		"1. ERROR in X.java (at line 4)\n" + 
18421
    		"	box.getValues()[0] = box.getValues()[1];\n" + 
18422
    		"	                     ^^^^^^^^^^^^^^^^^^\n" + 
18423
    		"Type mismatch: cannot convert from Values<capture#2-of ? extends U> to Values<capture#1-of ? extends U>\n" + 
18424
    		"----------\n");
18425
	}		
18426
	public void test0603() {
18427
	    this.runConformTest(
18428
            new String[] {
18429
                "X.java",
18430
				"public class X<U> {\n" + 
18431
				"\n" + 
18432
				"	public void foo(Box<? extends U>[] boxes) {\n" + 
18433
				"		boxes[0] = boxes[1];\n" + 
18434
				"	}\n" + 
18435
				"}\n" + 
18436
				"\n" + 
18437
				"abstract class Box<V> {\n" + 
18438
				"	  abstract Values<V>[] getValues();\n" + 
18439
				"}\n" + 
18440
				"abstract class Values<T> {\n" + 
18441
				"}\n",
18442
            },
18443
			"");
18444
	}		
18445
	// capture on array ref 
18446
	public void test0604() {
18447
	    this.runConformTest(
18448
            new String[] {
18449
                "X.java",
18450
				"public class X<U> {\n" + 
18451
				"\n" + 
18452
				"	public void foo(Box<? extends U>[] boxes) {\n" + 
18453
				"		bar(boxes[0], boxes[1]);\n" + 
18454
				"	}\n" + 
18455
				"	<V> void bar(V v1, V v2) {}\n" + 
18456
				"}\n" + 
18457
				"\n" + 
18458
				"abstract class Box<V> {\n" + 
18459
				"	  abstract Values<V>[] getValues();\n" + 
18460
				"}\n" + 
18461
				"abstract class Values<T> {\n" + 
18462
				"}\n",
18463
            },
18464
			"");
18465
	}		
18466
	// capture on array ref
18467
	public void test0605() {
18468
	    this.runNegativeTest(
18469
            new String[] {
18470
                "X.java",
18471
				"public class X<U> {\n" + 
18472
				"\n" + 
18473
				"	public void foo(Box<? extends U> box) {\n" + 
18474
				"		box.getValues()[1] = box.getValues()[2];\n" + 
18475
				"	}\n" + 
18476
				"}\n" + 
18477
				"\n" + 
18478
				"abstract class Box<V> {\n" + 
18479
				"	  abstract Values<V>[] getValues();\n" + 
18480
				"}\n" + 
18481
				"abstract class Values<T> {\n" + 
18482
				"}\n",
18483
            },
18484
    		"----------\n" + 
18485
    		"1. ERROR in X.java (at line 4)\n" + 
18486
    		"	box.getValues()[1] = box.getValues()[2];\n" + 
18487
    		"	                     ^^^^^^^^^^^^^^^^^^\n" + 
18488
    		"Type mismatch: cannot convert from Values<capture#2-of ? extends U> to Values<capture#1-of ? extends U>\n" + 
18489
    		"----------\n");
18490
	}		
18491
	public void test0606() {
18492
	    this.runNegativeTest(
18493
            new String[] {
18494
                "X.java",
18495
				"public class X<U> {\n" + 
18496
				"\n" + 
18497
				"	public void foo(Box<? extends U> box) {\n" + 
18498
				"		box.getValues()[1] = (Values<? extends U>) box.getValues()[2];\n" + 
18499
				"	}\n" + 
18500
				"	<V> void bar(V v1, V v2) {}\n" + 
18501
				"}\n" + 
18502
				"\n" + 
18503
				"abstract class Box<V> {\n" + 
18504
				"	  abstract Values<V>[] getValues();\n" + 
18505
				"}\n" + 
18506
				"abstract class Values<T> {\n" + 
18507
				"}\n",
18508
            },
18509
    		"----------\n" + 
18510
    		"1. ERROR in X.java (at line 4)\n" + 
18511
    		"	box.getValues()[1] = (Values<? extends U>) box.getValues()[2];\n" + 
18512
    		"	                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18513
    		"Type mismatch: cannot convert from Values<capture#3-of ? extends U> to Values<capture#1-of ? extends U>\n" + 
18514
    		"----------\n");
18515
	}		
18516
	public void test0607() {
18517
	    this.runNegativeTest(
18518
            new String[] {
18519
                "X.java",
18520
				"import java.util.*;\n" + 
18521
				"\n" + 
18522
				"public class X {\n" + 
18523
				"\n" + 
18524
				"	void test01() {\n" + 
18525
				"		List<Comparable<Object>> lObj = new ArrayList<Comparable<Object>> ();\n" + 
18526
				"		Collections.sort (lObj);	\n" + 
18527
				"	}\n" + 
18528
				"	void test02() {\n" + 
18529
				"		List<Comparable> lComp = new ArrayList<Comparable> ();\n" + 
18530
				"		Collections.sort (lComp);		\n" + 
18531
				"	}\n" + 
18532
				"	void test03() {\n" + 
18533
				"		List<Comparable<String>> lStr = new ArrayList<Comparable<String>> ();\n" + 
18534
				"		Collections.sort (lStr);\n" + 
18535
				"	}\n" + 
18536
				" }\n",
18537
            },
18538
            "----------\n" + 
18539
    		"1. WARNING in X.java (at line 10)\n" + 
18540
    		"	List<Comparable> lComp = new ArrayList<Comparable> ();\n" + 
18541
    		"	     ^^^^^^^^^^\n" + 
18542
    		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18543
    		"----------\n" + 
18544
    		"2. WARNING in X.java (at line 10)\n" + 
18545
    		"	List<Comparable> lComp = new ArrayList<Comparable> ();\n" + 
18546
    		"	                                       ^^^^^^^^^^\n" + 
18547
    		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18548
    		"----------\n" + 
18549
    		"3. WARNING in X.java (at line 11)\n" + 
18550
    		"	Collections.sort (lComp);		\n" + 
18551
    		"	^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18552
    		"Type safety: Unchecked invocation sort(List<Comparable>) of the generic method sort(List<T>) of type Collections\n" + 
18553
    		"----------\n" + 
18554
    		"4. ERROR in X.java (at line 15)\n" + 
18555
    		"	Collections.sort (lStr);\n" + 
18556
    		"	            ^^^^\n" + 
18557
    		"Bound mismatch: The generic method sort(List<T>) of type Collections is not applicable for the arguments (List<Comparable<String>>). The inferred type Comparable<String> is not a valid substitute for the bounded parameter <T extends Comparable<? super T>>\n" + 
18558
    		"----------\n");
18559
	}	
18560
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84284 - check warnings
18561
	public void test0608() {
18562
	    this.runNegativeTest(
18563
            new String[] {
18564
                "Ball.java",
18565
				"import java.util.*;\n" + 
18566
				"class Ball implements Comparable {\n" + 
18567
				"\n" + 
18568
				"    public int compareTo(Object o) {\n" + 
18569
				"    	return 0;\n" + 
18570
				"    }\n" + 
18571
				"    \n" + 
18572
				"    public static void main(String[] args) {\n" + 
18573
				"    	LinkedList<Ball> foo = new LinkedList<Ball>();\n" + 
18574
				"    	Collections.sort(foo);\n" + 
18575
				"    }\n" + 
18576
				"	Zork z;\n" + 
18577
				"}\n",
18578
            },
18579
            "----------\n" + 
18580
    		"1. WARNING in Ball.java (at line 2)\n" + 
18581
    		"	class Ball implements Comparable {\n" + 
18582
    		"	                      ^^^^^^^^^^\n" + 
18583
    		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
18584
    		"----------\n" + 
18585
    		"2. WARNING in Ball.java (at line 10)\n" + 
18586
    		"	Collections.sort(foo);\n" + 
18587
    		"	^^^^^^^^^^^^^^^^^^^^^\n" + 
18588
    		"Type safety: Unchecked invocation sort(List<Ball>) of the generic method sort(List<T>) of type Collections\n" + 
18589
    		"----------\n" + 
18590
    		"3. ERROR in Ball.java (at line 12)\n" + 
18591
    		"	Zork z;\n" + 
18592
    		"	^^^^\n" + 
18593
    		"Zork cannot be resolved to a type\n" + 
18594
    		"----------\n");
18595
	}		
18596
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=81831
18597
	public void test0609() {
18598
	    this.runConformTest(
18599
            new String[] {
18600
                "I.java",
18601
				"interface I<T extends I<? super T>> {}\n",
18602
            },
18603
			"");
18604
	}		
18605
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89940
18606
	public void _test0610() {
18607
	    this.runNegativeTest(
18608
            new String[] {
18609
                "X.java",
18610
				" import java.util.List;\n" + 
18611
				"\n" + 
18612
				"public class X {\n" + 
18613
				"	void foo(List<Object> objects, List raw) {\n" + 
18614
				"\n" + 
18615
				"	    List<Number> numbers;\n" + 
18616
				"	    List<? extends Number> ext;\n" + 
18617
				"	    \n" + 
18618
				"	    numbers= (List<Number>) objects; // correct - cast error\n" + 
18619
				"	    ext= (List<? extends Number>) objects; // wrong, should fail\n" + 
18620
				"\n" + 
18621
				"	    ext= raw; // correct - raw conversion warning issued\n" + 
18622
				"	    numbers= raw; // correct - raw conversion warning issued\n" + 
18623
				"	}\n" + 
18624
				"}\n",
18625
            },
18626
			"----------\n" + 
18627
			"1. ERROR in X.java (at line 9)\n" + 
18628
			"	numbers= (List<Number>) objects; // correct - cast error\n" + 
18629
			"	         ^^^^^^^^^^^^^^^^^^^^^^\n" + 
18630
			"Cannot cast from List<Object> to List<Number>\n" + 
18631
			"----------\n" + 
18632
			"2. ERROR in X.java (at line 10)\n" + 
18633
			"	ext= (List<? extends Number>) objects; // wrong, should fail\n" + 
18634
			"	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
18635
			"Cannot cast from List<Object> to List<? extends Number>\n" + 
18636
			"----------\n" + 
18637
			"3. WARNING in X.java (at line 12)\n" + 
18638
			"	ext= raw; // correct - raw conversion warning issued\n" + 
18639
			"	     ^^^\n" + 
18640
			"Type safety: The expression of type List needs unchecked conversion to conform to List<? extends Number>\n" + 
18641
			"----------\n" + 
18642
			"4. WARNING in X.java (at line 13)\n" + 
18643
			"	numbers= raw; // correct - raw conversion warning issued\n" + 
18644
			"	         ^^^\n" + 
18645
			"Type safety: The expression of type List needs unchecked conversion to conform to List<Number>\n" + 
18646
			"----------\n");
18647
	}		
18648
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=91696
18649
	public void test0611() {
18650
	    this.runConformTest(
18651
            new String[] {
18652
                "C.java",
18653
				"import java.io.Serializable;\n" + 
18654
				"\n" + 
18655
				"interface A<K extends A.BK<S>, S extends A.BS> {\n" + 
18656
				"	public interface BS extends Serializable {\n" + 
18657
				"	}\n" + 
18658
				"	public interface BK<SS> extends Serializable {\n" + 
18659
				"		public void put(SS a);\n" + 
18660
				"	}\n" + 
18661
				"\n" + 
18662
				"	public P<K, S> getP();\n" + 
18663
				"}\n" + 
18664
				"\n" + 
18665
				"class P<K extends A.BK<S>, S extends A.BS> {\n" + 
18666
				"	K k;\n" + 
18667
				"	S s;\n" + 
18668
				"\n" + 
18669
				"	public void put() {\n" + 
18670
				"		k.put(s);\n" + 
18671
				"	}\n" + 
18672
				"}\n" + 
18673
				"\n" + 
18674
				"public class C<T> implements A<C.K, C.S> {\n" + 
18675
				"	public static class K implements A.BK<C.S> {\n" + 
18676
				"		public void put(S a) {\n" + 
18677
				"		}\n" + 
18678
				"	}\n" + 
18679
				"	protected static class S implements A.BS {\n" + 
18680
				"	}\n" + 
18681
				"\n" + 
18682
				"	public P<K, S> getP() {\n" + 
18683
				"		return null;\n" + 
18684
				"	}\n" + 
18685
				"}\n",
18686
            },
18687
			"");
18688
	}			
18689
	public void test0612() {
18690
	    this.runNegativeTest(
18691
            new String[] {
18692
                "X.java",
18693
				"import java.util.*;\n" + 
18694
				"\n" + 
18695
				"class MPair<A,B> {}\n" + 
18696
				"\n" + 
18697
				"public class X<K,V> {\n" + 
18698
				"    private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18699
				"    private Bucket[] buckets = new X.Bucket[100];\n" + 
18700
				"}\n",
18701
            },
18702
			"----------\n" + 
18703
			"1. ERROR in X.java (at line 6)\n" + 
18704
			"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18705
			"	                                                     ^\n" + 
18706
			"Cannot make a static reference to the non-static type K\n" + 
18707
			"----------\n" + 
18708
			"2. ERROR in X.java (at line 6)\n" + 
18709
			"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" + 
18710
			"	                                                       ^\n" + 
18711
			"Cannot make a static reference to the non-static type V\n" + 
18712
			"----------\n" + 
18713
			"3. WARNING in X.java (at line 7)\n" + 
18714
			"	private Bucket[] buckets = new X.Bucket[100];\n" + 
18715
			"	                 ^^^^^^^\n" + 
18716
			"The field X<K,V>.buckets is never read locally\n" + 
18717
			"----------\n");
18718
	}
18719
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973
18720
	public void test0613() {
18721
	    this.runNegativeTest(
18722
            new String[] {
18723
                "Map.java",
18724
				"package xy;\n" + 
18725
				"import xy.Map.Entry;\n" + 
18726
				"\n" + 
18727
				"class Map<M> {\n" + 
18728
				"    class Entry<E> { }\n" + 
18729
				"}\n" + 
18730
				"class User {\n" + 
18731
				"    void a(Entry<String> e) { } // Entry<String> is illegal (eclipse accepts)\n" + 
18732
				"    void c(Map.Entry<String> e) { } // illegal (correctly flagged)\n" + 
18733
				"    void b(Entry e) { } // OK\n" + 
18734
				"    void d(Map<Integer>.Entry<String> e) { } // OK\n" + 
18735
				"}\n",
18736
            },
18737
            "----------\n" + 
18738
    		"1. ERROR in Map.java (at line 8)\n" + 
18739
    		"	void a(Entry<String> e) { } // Entry<String> is illegal (eclipse accepts)\n" + 
18740
    		"	       ^^^^^\n" + 
18741
    		"The member type Map.Entry<String> must be qualified with a parameterized type, since it is not static\n" + 
18742
    		"----------\n" + 
18743
    		"2. ERROR in Map.java (at line 9)\n" + 
18744
    		"	void c(Map.Entry<String> e) { } // illegal (correctly flagged)\n" + 
18745
    		"	       ^^^^^^^^^\n" + 
18746
    		"The member type Map.Entry<String> must be qualified with a parameterized type, since it is not static\n" + 
18747
    		"----------\n" + 
18748
    		"3. WARNING in Map.java (at line 10)\n" + 
18749
    		"	void b(Entry e) { } // OK\n" + 
18750
    		"	       ^^^^^\n" + 
18751
    		"Map.Entry is a raw type. References to generic type Map<M>.Entry<E> should be parameterized\n" + 
18752
    		"----------\n");
18753
	}			
18754
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973 - variation	
18755
	public void test0614() {
18756
	    this.runNegativeTest(
18757
            new String[] {
18758
                "X1.java",
18759
				"class X1 {\n" + 
18760
				"	static class X2<T> {\n" + 
18761
				"		class X3<U> {\n" + 
18762
				"		}\n" + 
18763
				"	}\n" + 
18764
				"}\n" + 
18765
				"class Y1 {\n" + 
18766
				"	class Y2 extends X1.X2<Exception> {\n" + 
18767
				"		void foo() {\n" + 
18768
				"			X3<String> x;\n" + 
18769
				"		}\n" + 
18770
				"	}\n" + 
18771
				"	Zork z;\n" + 
18772
				"}\n",
18773
            },
18774
			"----------\n" + 
18775
			"1. ERROR in X1.java (at line 13)\n" + 
18776
			"	Zork z;\n" + 
18777
			"	^^^^\n" + 
18778
			"Zork cannot be resolved to a type\n" + 
18779
			"----------\n");
18780
	}			
18781
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973 - variation	
18782
	public void test0615() {
18783
	    this.runNegativeTest(
18784
            new String[] {
18785
                "X1.java",
18786
				"class X1 {\n" + 
18787
				"	static class X2<T> {\n" + 
18788
				"		class X3<U> {\n" + 
18789
				"		}\n" + 
18790
				"	}\n" + 
18791
				"}\n" + 
18792
				"class Y1 {\n" + 
18793
				"	class Y2 extends X1.X2 {\n" + 
18794
				"		void foo() {\n" + 
18795
				"			X3<String> x;\n" + 
18796
				"		}\n" + 
18797
				"	}\n" + 
18798
				"}\n",
18799
            },
18800
            "----------\n" + 
18801
    		"1. WARNING in X1.java (at line 8)\n" + 
18802
    		"	class Y2 extends X1.X2 {\n" + 
18803
    		"	                 ^^^^^\n" + 
18804
    		"X1.X2 is a raw type. References to generic type X1.X2<T> should be parameterized\n" + 
18805
    		"----------\n" + 
18806
    		"2. ERROR in X1.java (at line 10)\n" + 
18807
    		"	X3<String> x;\n" + 
18808
    		"	^^\n" + 
18809
    		"The member type X1.X2.X3<String> must be qualified with a parameterized type, since it is not static\n" + 
18810
    		"----------\n");
18811
	}			
18812
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973 - variation	
18813
	public void test0616() {
18814
	    this.runNegativeTest(
18815
            new String[] {
18816
                "Map.java",
18817
				"package xy;\n" + 
18818
				"import xy.Map.Entry;\n" + 
18819
				"\n" + 
18820
				"class Map<M> {\n" + 
18821
				"    class Entry<E> { }\n" + 
18822
				"}\n" + 
18823
				"class User extends Map<String> {\n" + 
18824
				"    void a(Entry<String> e) { } // Entry<String> is illegal (eclipse accepts)\n" + 
18825
				"    void c(Map.Entry<String> e) { } // illegal (correctly flagged)\n" + 
18826
				"    void b(Entry e) { } // OK\n" + 
18827
				"    void d(Map<Integer>.Entry<String> e) { } // OK\n" + 
18828
				"}\n",
18829
            },
18830
            "----------\n" + 
18831
    		"1. ERROR in Map.java (at line 9)\n" + 
18832
    		"	void c(Map.Entry<String> e) { } // illegal (correctly flagged)\n" + 
18833
    		"	       ^^^^^^^^^\n" + 
18834
    		"The member type Map.Entry<String> must be qualified with a parameterized type, since it is not static\n" + 
18835
    		"----------\n" + 
18836
    		"2. WARNING in Map.java (at line 10)\n" + 
18837
    		"	void b(Entry e) { } // OK\n" + 
18838
    		"	       ^^^^^\n" + 
18839
    		"Map.Entry is a raw type. References to generic type Map<M>.Entry<E> should be parameterized\n" + 
18840
    		"----------\n");
18841
	}
18842
public void test0617() {
18843
        this.runNegativeTest(
18844
            new String[] {
18845
                "X.java",
18846
                "public class X {\n" + 
18847
                "\n" + 
18848
                "   public void foo() {\n" + 
18849
                "       String s = null;\n" + 
18850
                "       ZZZ1<?>.ZZZ2<?>.ZZZ3<?> var = null;\n" + 
18851
                "       s = var;\n" + 
18852
                "   }\n" + 
18853
                "}\n" + 
18854
                "\n" + 
18855
                "class ZZZ1<T1> {\n" + 
18856
                "  class ZZZ2<T2> {\n" +
18857
                "    class ZZZ3<T3> {}\n" + 
18858
                "  }\n" + 
18859
                "}\n",
18860
            },
18861
    		"----------\n" + 
18862
    		"1. ERROR in X.java (at line 6)\n" + 
18863
    		"	s = var;\n" + 
18864
    		"	    ^^^\n" + 
18865
    		"Type mismatch: cannot convert from ZZZ1<?>.ZZZ2<?>.ZZZ3<capture#1-of ?> to String\n" + 
18866
    		"----------\n");
18867
    }
18868
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973 - variation	
18869
	public void test0618() {
18870
	    this.runNegativeTest(
18871
            new String[] {
18872
                "Map.java",
18873
				"class Map<M> {\n" + 
18874
				"    class Entry<E> { }\n" + 
18875
				"    class Foo {\n" + 
18876
				"    	Entry<String> entry;\n" + 
18877
				"    	static void foo(Entry<String> e) { } // invalid static ref\n" + 
18878
				"    }\n" + 
18879
				"    static class Bar {\n" + 
18880
				"    	Entry<String> entry; // invalid static ref\n" + 
18881
				"    }\n" + 
18882
				"    void a(Entry<String> e) { } // OK\n" + 
18883
				"    void c(Map.Entry<String> e) { } // illegal \n" + 
18884
				"    void b(Entry e) { } // OK\n" + 
18885
				"    void d(Map<Integer>.Entry<String> e) { } // OK\n" + 
18886
				"}\n",
18887
            },
18888
            "----------\n" + 
18889
    		"1. ERROR in Map.java (at line 5)\n" + 
18890
    		"	static void foo(Entry<String> e) { } // invalid static ref\n" + 
18891
    		"	            ^^^^^^^^^^^^^^^^^^^^\n" + 
18892
    		"The method foo cannot be declared static; static methods can only be declared in a static or top level type\n" + 
18893
    		"----------\n" + 
18894
    		"2. ERROR in Map.java (at line 5)\n" + 
18895
    		"	static void foo(Entry<String> e) { } // invalid static ref\n" + 
18896
    		"	                ^^^^^\n" + 
18897
    		"Cannot make a static reference to the non-static type Entry\n" + 
18898
    		"----------\n" + 
18899
    		"3. ERROR in Map.java (at line 8)\n" + 
18900
    		"	Entry<String> entry; // invalid static ref\n" + 
18901
    		"	^^^^^\n" + 
18902
    		"Cannot make a static reference to the non-static type Entry\n" + 
18903
    		"----------\n" + 
18904
    		"4. ERROR in Map.java (at line 11)\n" + 
18905
    		"	void c(Map.Entry<String> e) { } // illegal \n" + 
18906
    		"	       ^^^^^^^^^\n" + 
18907
    		"The member type Map.Entry<String> must be qualified with a parameterized type, since it is not static\n" + 
18908
    		"----------\n" + 
18909
    		"5. WARNING in Map.java (at line 12)\n" + 
18910
    		"	void b(Entry e) { } // OK\n" + 
18911
    		"	       ^^^^^\n" + 
18912
    		"Map.Entry is a raw type. References to generic type Map<M>.Entry<E> should be parameterized\n" + 
18913
    		"----------\n");
18914
	}
18915
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89440	
18916
	public void test0619() {
18917
	    this.runConformTest(
18918
            new String[] {
18919
                "X.java",
18920
				"interface ISample<V> {\n" + 
18921
				"	public static enum Stuff {\n" + 
18922
				"		FIRST, SECOND, THIRD\n" + 
18923
				"	};\n" + 
18924
				"}\n" + 
18925
				"\n" + 
18926
				"class SampleClass {\n" + 
18927
				"	public void doSomething(ISample.Stuff thing) {\n" + 
18928
				"\n" + 
18929
				"	}\n" + 
18930
				"}\n" + 
18931
				"\n" + 
18932
				"public class X {\n" + 
18933
				"	public void doSomething() {\n" + 
18934
				"		SampleClass sample = new SampleClass();\n" + 
18935
				"		sample.doSomething(ISample.Stuff.FIRST);\n" + 
18936
				"	}\n" + 
18937
				"}\n",
18938
            },
18939
			"");
18940
	}
18941
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84551	
18942
	public void test0620() {
18943
	    this.runNegativeTest(
18944
            new String[] {
18945
                "Outer.java",
18946
				"public class Outer<O> {\n" + 
18947
				"	class Inner { }\n" + 
18948
				"	\n" + 
18949
				"	static void test(Inner i) { }\n" + 
18950
				"}\n",
18951
            },
18952
			"----------\n" + 
18953
			"1. ERROR in Outer.java (at line 4)\n" + 
18954
			"	static void test(Inner i) { }\n" + 
18955
			"	                 ^^^^^\n" + 
18956
			"Cannot make a static reference to the non-static type Inner\n" + 
18957
			"----------\n");
18958
	}	
18959
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84551- variation
18960
	public void test0621() {
18961
	    this.runConformTest(
18962
            new String[] {
18963
                "Outer.java",
18964
				"public class Outer {\n" + 
18965
				"	class Inner { }\n" + 
18966
				"	\n" + 
18967
				"	static void test(Inner i) { }\n" + 
18968
				"}\n",
18969
            },
18970
			"");
18971
	}		
18972
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84551 - variation
18973
	public void test0622() {
18974
	    this.runConformTest(
18975
            new String[] {
18976
                "Outer.java",
18977
				"public class Outer<O> {\n" + 
18978
				"	static class Inner { }\n" + 
18979
				"	\n" + 
18980
				"	static void test(Inner i) { }\n" + 
18981
				"}\n",
18982
            },
18983
			"");
18984
	}		
18985
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84551 - variation
18986
	public void test0623() {
18987
	    this.runConformTest(
18988
            new String[] {
18989
                "X.java",
18990
				"public class X<T> {\n" + 
18991
				"	static class Outer {\n" + 
18992
				"		class Inner { }\n" + 
18993
				"		static void test(Inner i) { }\n" + 
18994
				"	}\n" + 
18995
				"}\n",
18996
            },
18997
			"");
18998
	}			
18999
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83034
19000
	public void test0624() {
19001
	    this.runConformTest(
19002
            new String[] {
19003
                "X.java",
19004
				" interface IFoo<U, V extends X<U, V>> {\n" + 
19005
				"	V bar(int i);\n" + 
19006
				"}\n" + 
19007
				"\n" + 
19008
				"public class X<E, F extends X<E, F>> {\n" + 
19009
				"	\n" + 
19010
				"	public boolean foo(X<E, ?> x) {\n" + 
19011
				"		return false;\n" + 
19012
				"	}\n" + 
19013
				"	public boolean baz(IFoo<E, ?> f) {\n" + 
19014
				"		return foo(f.bar(0));\n" + 
19015
				"	}\n" + 
19016
				"}\n",
19017
            },
19018
			"");
19019
	}		
19020
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=83034 - variation
19021
	public void test0625() {
19022
	    this.runConformTest(
19023
            new String[] {
19024
                "Foo.java",
19025
				"public class Foo<K> {\n" + 
19026
				"	public enum Mode {\n" + 
19027
				"		A\n" + 
19028
				"	};\n" + 
19029
				"	public void test(Mode mode) {\n" + 
19030
				"	}\n" + 
19031
				"} \n",
19032
            },
19033
			"");
19034
	    this.runConformTest(
19035
            new String[] {
19036
                "X.java",
19037
				"public class X {\n" + 
19038
				"	enum Keys {\n" + 
19039
				"		B\n" + 
19040
				"	};\n" + 
19041
				"	public void test() {\n" + 
19042
				"		Foo<Keys> foo = new Foo<Keys>();\n" + 
19043
				"		foo.test(Foo.Mode.A); // error\n" + 
19044
				"	}\n" + 
19045
				"} \n",
19046
            },
19047
			"",
19048
			null,
19049
			false,
19050
			null);
19051
	}		
19052
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=92037
19053
	public void test0626() {
19054
	    this.runNegativeTest(
19055
            new String[] {
19056
                "X.java",
19057
				"public class X {\n" + 
19058
				"\n" + 
19059
				"	private static class A {\n" + 
19060
				"\n" + 
19061
				"	}\n" + 
19062
				"\n" + 
19063
				"	private static class B<A> {\n" + 
19064
				"\n" + 
19065
				"	}\n" + 
19066
				"\n" + 
19067
				"	private static class AA extends A {\n" + 
19068
				"\n" + 
19069
				"	}\n" + 
19070
				"\n" + 
19071
				"	private static class C extends B<AA> {\n" + 
19072
				"\n" + 
19073
				"	}\n" + 
19074
				"\n" + 
19075
				"	public static void main(String[] args) {\n" + 
19076
				"		B<A> b = new B<A>();\n" + 
19077
				"		System.out.println(b instanceof C);\n" + 
19078
				"	}\n" + 
19079
				"}\n",
19080
            },
19081
    		"----------\n" + 
19082
    		"1. WARNING in X.java (at line 7)\n" + 
19083
    		"	private static class B<A> {\n" + 
19084
    		"	                       ^\n" + 
19085
    		"The type parameter A is hiding the type X.A\n" + 
19086
    		"----------\n" + 
19087
    		"2. WARNING in X.java (at line 11)\n" + 
19088
    		"	private static class AA extends A {\n" + 
19089
    		"	                     ^^\n" + 
19090
    		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
19091
    		"----------\n" + 
19092
    		"3. WARNING in X.java (at line 15)\n" + 
19093
    		"	private static class C extends B<AA> {\n" + 
19094
    		"	                     ^\n" + 
19095
    		"Access to enclosing constructor X.B<A>() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
19096
    		"----------\n" + 
19097
    		"4. ERROR in X.java (at line 21)\n" + 
19098
    		"	System.out.println(b instanceof C);\n" + 
19099
    		"	                   ^^^^^^^^^^^^^^\n" + 
19100
    		"Incompatible conditional operand types X.B<X.A> and X.C\n" + 
19101
    		"----------\n");
19102
	}		
19103
	public void test0627() {
19104
	    this.runNegativeTest(
19105
            new String[] {
19106
                "X.java",
19107
				"import java.util.List;\n" + 
19108
				"\n" + 
19109
				"public class X {\n" + 
19110
				"\n" + 
19111
				"	<T> List<? extends T> foo(List<? extends T> l1, List<? extends T> l2) {\n" + 
19112
				"		return l1;\n" + 
19113
				"	}\n" + 
19114
				"	void bar(List<String> l1, List<Integer> l2) {\n" + 
19115
				"		String s = foo(l1, l2);\n" + 
19116
				"	}\n" + 
19117
				"}\n",
19118
            },
19119
    		"----------\n" + 
19120
    		"1. ERROR in X.java (at line 9)\n" + 
19121
    		"	String s = foo(l1, l2);\n" + 
19122
    		"	           ^^^^^^^^^^^\n" + 
19123
    		"Type mismatch: cannot convert from List<capture#2-of ? extends Object&Serializable&Comparable<?>> to String\n" + 
19124
    		"----------\n");
19125
	}	
19126
	// check capture for conditional operator
19127
	public void test0628() {
19128
	    this.runNegativeTest(
19129
            new String[] {
19130
                "X.java",
19131
				"import java.util.List;\n" + 
19132
				"\n" + 
19133
				"public class X {\n" + 
19134
				"\n" + 
19135
				"	<T> List<? extends T> foo(List<? extends T> l1, List<? extends T> l2) {\n" + 
19136
				"		return l1;\n" + 
19137
				"	}\n" + 
19138
				"	void bar(List<Float> l1, List<Integer> l2) {\n" + 
19139
				"		List<?> l3 = null;\n" + 
19140
				"		String s = l1 != null ? foo(l1, l2) : l3;\n" + 
19141
				"	}\n" + 
19142
				"}\n",
19143
            },
19144
    		"----------\n" + 
19145
    		"1. ERROR in X.java (at line 10)\n" + 
19146
    		"	String s = l1 != null ? foo(l1, l2) : l3;\n" + 
19147
    		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19148
    		"Type mismatch: cannot convert from List<capture#4-of ? extends Object> to String\n" + 
19149
    		"----------\n");
19150
	}		
19151
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=92556
19152
	public void test0629() {
19153
	    this.runConformTest(
19154
            new String[] {
19155
                "X.java",
19156
				"public class X {\n" + 
19157
				"	public abstract class Context<N extends Number> {\n" + 
19158
				"		private Strategy<N, ? super Context<N>> strategy;\n" + 
19159
				"		public void setStrategy(Strategy<N, ? super Context<N>> strategy) {\n" + 
19160
				"			this.strategy = strategy;\n" + 
19161
				"		}\n" + 
19162
				"		// m?thode qui utilise la strat?gie\n" + 
19163
				"		public N call() throws Exception {\n" + 
19164
				"			return this.strategy.call(this);\n" + 
19165
				"		}\n" + 
19166
				"	}\n" + 
19167
				"	public interface Strategy<N extends Number, C extends Context<N>> {\n" + 
19168
				"		public abstract N call(C context);\n" + 
19169
				"	}\n" + 
19170
				"\n" + 
19171
				"} \n",
19172
            },
19173
			"");
19174
	}			
19175
	public void test0630() {
19176
	    this.runNegativeTest(
19177
            new String[] {
19178
                "X.java",
19179
				"import java.util.ArrayList;\n" + 
19180
				"import java.util.List;\n" + 
19181
				"\n" + 
19182
				"public class X {\n" + 
19183
				"\n" + 
19184
				"	void test0() {\n" + 
19185
				"		List<? super Number[]> arrays= new ArrayList<Number[]>();\n" + 
19186
				"		Number[] a= null;\n" + 
19187
				"		arrays.add(null);\n" + 
19188
				"		arrays.add(a); // Error: The method add(capture-of ? super Number[]) in the type List<capture-of ? super Number[]> is not applicable for the arguments (Number[])\n" + 
19189
				"	}\n" + 
19190
				"\n" + 
19191
				"	void test01() {\n" + 
19192
				"		List<? extends Number[]> arrays= new ArrayList<Number[]>();\n" + 
19193
				"		Number[] a= null;\n" + 
19194
				"		arrays.add(null);\n" + 
19195
				"		arrays.add(a); // Error: The method add(capture-of ? extends Number[]) in the type List<capture-of ? super Number[]> is not applicable for the arguments (Number[])\n" + 
19196
				"	}\n" + 
19197
				"	\n" + 
19198
				"	void test02() {\n" + 
19199
				"		List<? super Number> nums= null;\n" + 
19200
				"		Number n= null;\n" + 
19201
				"		nums.add(null);\n" + 
19202
				"		nums.add(n);\n" + 
19203
				"	}\n" + 
19204
				"\n" + 
19205
				"	void test3() {\n" + 
19206
				"		List<? super List<Number>> nums= null;\n" + 
19207
				"		List<Number> n= null;\n" + 
19208
				"		nums.add(null);\n" + 
19209
				"		nums.add(n);\n" + 
19210
				"	}\n" + 
19211
				"}\n",
19212
	        },
19213
			"----------\n" + 
19214
			"1. ERROR in X.java (at line 17)\n" + 
19215
			"	arrays.add(a); // Error: The method add(capture-of ? extends Number[]) in the type List<capture-of ? super Number[]> is not applicable for the arguments (Number[])\n" + 
19216
			"	       ^^^\n" + 
19217
			"The method add(capture#4-of ? extends Number[]) in the type List<capture#4-of ? extends Number[]> is not applicable for the arguments (Number[])\n" + 
19218
			"----------\n");
19219
	}
19220
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=93044	
19221
	public void test0631() {
19222
	    this.runNegativeTest(
19223
            new String[] {
19224
                "X.java",
19225
				"import java.lang.annotation.RetentionPolicy;\n" + 
19226
				"\n" + 
19227
				"public class X\n" + 
19228
				"{\n" + 
19229
				"		 public static void main(String[] args)\n" + 
19230
				"		 {\n" + 
19231
				"		 		 Class<? extends Enum<?>> c = RetentionPolicy.class;\n" + 
19232
				"		 		 System.out.println(Enum.valueOf(c, \"CLASS\"));\n" + 
19233
				"		 }\n" + 
19234
				"}\n",
19235
	        },
19236
			"----------\n" + 
19237
			"1. ERROR in X.java (at line 8)\n" + 
19238
			"	System.out.println(Enum.valueOf(c, \"CLASS\"));\n" + 
19239
			"	                        ^^^^^^^\n" + 
19240
			"Bound mismatch: The generic method valueOf(Class<T>, String) of type Enum<E> is not applicable for the arguments (Class<capture#1-of ? extends Enum<?>>, String). The inferred type capture#1-of ? extends Enum<?> is not a valid substitute for the bounded parameter <T extends Enum<T>>\n" + 
19241
			"----------\n");
19242
	}			
19243
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=92982
19244
	public void test0632() {
19245
	    this.runNegativeTest(
19246
            new String[] {
19247
                "X.java",
19248
				"import java.util.Vector;\n" + 
19249
				"\n" + 
19250
				"public class X {\n" + 
19251
				"	void test01() {\n" + 
19252
				"		Vector<? super java.lang.Object[]> lhs = null;\n" + 
19253
				"		Vector<? extends java.lang.Object[]> rhs = null;\n" + 
19254
				"		lhs.add(rhs.get(0));\n" + 
19255
				"	}\n" + 
19256
				"	void test02() {\n" + 
19257
				"		Vector<? extends java.lang.Object[]> lhs = null;\n" + 
19258
				"		Vector<? extends java.lang.Object[]> rhs = null;\n" + 
19259
				"		lhs.add(rhs.get(0));\n" + 
19260
				"	}\n" + 
19261
				"	void test3() {\n" + 
19262
				"		Vector<? super java.lang.Object[]> lhs = null;\n" + 
19263
				"		Vector<? super java.lang.Object[]> rhs = null;\n" + 
19264
				"		lhs.add(rhs.get(0));\n" + 
19265
				"	}\n" + 
19266
				"	void test4() {\n" + 
19267
				"		Vector<?  extends java.lang.Object[]> lhs = null;\n" + 
19268
				"		Vector<? super java.lang.Object[]> rhs = null;\n" + 
19269
				"		lhs.add(rhs.get(0));\n" + 
19270
				"	}\n" + 
19271
				"}\n",
19272
	        },
19273
			"----------\n" + 
19274
			"1. ERROR in X.java (at line 12)\n" + 
19275
			"	lhs.add(rhs.get(0));\n" + 
19276
			"	    ^^^\n" + 
19277
			"The method add(capture#3-of ? extends Object[]) in the type Vector<capture#3-of ? extends Object[]> is not applicable for the arguments (capture#4-of ? extends Object[])\n" + 
19278
			"----------\n" + 
19279
			"2. ERROR in X.java (at line 17)\n" + 
19280
			"	lhs.add(rhs.get(0));\n" + 
19281
			"	    ^^^\n" + 
19282
			"The method add(capture#5-of ? super Object[]) in the type Vector<capture#5-of ? super Object[]> is not applicable for the arguments (capture#6-of ? super Object[])\n" + 
19283
			"----------\n" + 
19284
			"3. ERROR in X.java (at line 22)\n" + 
19285
			"	lhs.add(rhs.get(0));\n" + 
19286
			"	    ^^^\n" + 
19287
			"The method add(capture#7-of ? extends Object[]) in the type Vector<capture#7-of ? extends Object[]> is not applicable for the arguments (capture#8-of ? super Object[])\n" + 
19288
			"----------\n");
19289
	}				
19290
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=92982 - variation
19291
	public void test0633() {
19292
	    this.runConformTest(
19293
            new String[] {
19294
                "X.java",
19295
				"import java.util.Vector;\n" + 
19296
				"\n" + 
19297
				"public class X {\n" + 
19298
				"	void test1() {\n" + 
19299
				"		Vector<? super Object[]> lhs = null;\n" + 
19300
				"		Vector<Object[]> rhs = null;\n" + 
19301
				"		lhs.add(rhs.get(0)); \n" + 
19302
				"		foo(rhs.get(0)); // ok #foo(Object[])\n" + 
19303
				"	}\n" + 
19304
				"	void foo(Object[] objs) {\n" + 
19305
				"	}\n" + 
19306
				"}\n",
19307
	        },
19308
			"");
19309
	}				
19310
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90775
19311
	public void test0634() {
19312
	    this.runNegativeTest(
19313
            new String[] {
19314
                "X.java",
19315
				"import java.lang.reflect.Array;\n" + 
19316
				"\n" + 
19317
				"public class X<T> {\n" + 
19318
				"\n" + 
19319
				"	T[] theArray;\n" + 
19320
				"\n" + 
19321
				"	public X(Class<T> clazz) {\n" + 
19322
				"		theArray = (T[]) Array.newInstance(clazz, 10); // Compiler warning\n" + 
19323
				"	}\n" + 
19324
				"\n" + 
19325
				"	public T get(int i) {\n" + 
19326
				"		return theArray[i];\n" + 
19327
				"	}\n" + 
19328
				"\n" + 
19329
				"	public static void main(String[] args) {\n" + 
19330
				"		X<Integer> t = new X<Integer>(Integer.class);\n" + 
19331
				"		// GenericsArray1<Integer> t = new GenericsArray1<Integer>( int.class );\n" + 
19332
				"		Object[] o = t.theArray;\n" + 
19333
				"	}\n" + 
19334
				"  Zork z;\n" +
19335
				"}\n",
19336
	        },
19337
	        "----------\n" + 
19338
			"1. WARNING in X.java (at line 8)\n" + 
19339
			"	theArray = (T[]) Array.newInstance(clazz, 10); // Compiler warning\n" + 
19340
			"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19341
			"Type safety: Unchecked cast from Object to T[]\n" + 
19342
			"----------\n" + 
19343
			"2. ERROR in X.java (at line 20)\n" + 
19344
			"	Zork z;\n" + 
19345
			"	^^^^\n" + 
19346
			"Zork cannot be resolved to a type\n" + 
19347
			"----------\n");
19348
	}					
19349
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=93298
19350
	public void test0635() {
19351
	    this.runConformTest(
19352
            new String[] {
19353
                "X.java",
19354
				"import java.util.Iterator;\n" + 
19355
				"public class X {\n" + 
19356
				"	public static class Indexed <U>  {\n" + 
19357
				"		public Iterator<U> foo() {\n" + 
19358
				"			return new IndexedIter();\n" + 
19359
				"		}\n" + 
19360
				"		class IndexedIter implements Iterator<U> {\n" + 
19361
				"			public boolean hasNext() {\n" + 
19362
				"				return false;\n" + 
19363
				"			}\n" + 
19364
				"			public U next() {\n" + 
19365
				"				return null;\n" + 
19366
				"			}\n" + 
19367
				"			public void remove() {\n" + 
19368
				"			}\n" + 
19369
				"		}\n" + 
19370
				"	}\n" + 
19371
				"}\n",
19372
	        },
19373
			"");
19374
	}
19375
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=78084	
19376
	public void test0636() {
19377
	    this.runNegativeTest(
19378
            new String[] {
19379
                "X.java",
19380
			"public abstract class X<T> {\n" + 
19381
			"  public final T element() {\n" + 
19382
			"    T result = (T) customElement(); // reports unnecessary cast\n" + 
19383
			"    return result;\n" + 
19384
			"  }\n" + 
19385
			"  protected abstract Object customElement();\n" + 
19386
			"  Zork z;\n" +
19387
			"}\n",
19388
	        },
19389
	        "----------\n" + 
19390
			"1. WARNING in X.java (at line 3)\n" + 
19391
			"	T result = (T) customElement(); // reports unnecessary cast\n" + 
19392
			"	           ^^^^^^^^^^^^^^^^^^^\n" + 
19393
			"Type safety: Unchecked cast from Object to T\n" + 
19394
			"----------\n" + 
19395
			"2. ERROR in X.java (at line 7)\n" + 
19396
			"	Zork z;\n" + 
19397
			"	^^^^\n" + 
19398
			"Zork cannot be resolved to a type\n" + 
19399
			"----------\n");
19400
	}
19401
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84968	
19402
	public void test0637() {
19403
	    this.runConformTest(
19404
            new String[] {
19405
                "X.java",
19406
				"public class X<E> {\n" + 
19407
				"	public static final class Ex1 extends Exception {\n" + 
19408
				"		private static final long serialVersionUID = 1;\n" + 
19409
				"	}\n" + 
19410
				"\n" + 
19411
				"	private void a1() {\n" + 
19412
				"		try {\n" + 
19413
				"			a1_1();\n" + 
19414
				"		} catch (Ex1 si) {\n" + 
19415
				"			assert si != null;\n" + 
19416
				"		}\n" + 
19417
				"	}\n" + 
19418
				"\n" + 
19419
				"	protected Object a1_1() throws Ex1 {\n" + 
19420
				"		return null;\n" + 
19421
				"	}\n" + 
19422
				"\n" + 
19423
				"	private void a2() {\n" + 
19424
				"		try {\n" + 
19425
				"			a2_1();\n" + 
19426
				"		} catch (Ex2 si) {\n" + 
19427
				"			assert si != null;\n" + 
19428
				"		}\n" + 
19429
				"	}\n" + 
19430
				"\n" + 
19431
				"	protected Object a2_1() throws Ex2 {\n" + 
19432
				"		return null;\n" + 
19433
				"	}\n" + 
19434
				"\n" + 
19435
				"	public final static class Ex3 extends Exception {\n" + 
19436
				"		private static final long serialVersionUID = 1;\n" + 
19437
				"	}\n" + 
19438
				"\n" + 
19439
				"	private void a3() {\n" + 
19440
				"		try {\n" + 
19441
				"			a3_1();\n" + 
19442
				"		} catch (Ex3 si) {\n" + 
19443
				"			assert si != null;\n" + 
19444
				"		}\n" + 
19445
				"	}\n" + 
19446
				"\n" + 
19447
				"	protected Object a3_1() throws Ex3 {\n" + 
19448
				"		return null;\n" + 
19449
				"	}\n" + 
19450
				"\n" + 
19451
				"}\n" + 
19452
				"\n" + 
19453
				"final class Ex2 extends Exception {\n" + 
19454
				"	private static final long serialVersionUID = 1;\n" + 
19455
				"}\n",
19456
	        },
19457
			"");
19458
	}	
19459
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=93478	
19460
	public void test0638() {
19461
	    this.runConformTest(
19462
            new String[] {
19463
                "X.java",
19464
				"import java.util.concurrent.BlockingQueue;\n" + 
19465
				"\n" + 
19466
				"public class X {\n" + 
19467
				"	static interface IMX<S, L> {\n" + 
19468
				"		void call(L a, S b);\n" + 
19469
				"	}\n" + 
19470
				"	static interface Y<S, L> {\n" + 
19471
				"		void addX(final IMX<S, L> a);\n" + 
19472
				"		void removeX(final IMX<S, L> a);\n" + 
19473
				"	}\n" + 
19474
				"	static final class Pair<T, V> {\n" + 
19475
				"		T first;\n" + 
19476
				"\n" + 
19477
				"		V second;\n" + 
19478
				"	}\n" + 
19479
				"	static class Bar<P> {\n" + 
19480
				"		Bar(final BlockingQueue<P> a) {\n" + 
19481
				"\n" + 
19482
				"		}\n" + 
19483
				"	}\n" + 
19484
				"}\n" + 
19485
				"\n" + 
19486
				"final class Foo<S, L> extends X.Bar<X.Pair<L[], S>> implements X.IMX<S, L> {\n" + 
19487
				"	Foo(final BlockingQueue<X.Pair<L[], S>> in) {\n" + 
19488
				"		super(in);\n" + 
19489
				"	}\n" + 
19490
				"	public void call(L a, S b) {\n" + 
19491
				"	}\n" + 
19492
				"}\n",
19493
	        },
19494
			"");
19495
	}
19496
	public void test0639() {
19497
	    this.runConformTest(
19498
            new String[] {
19499
                "X.java",
19500
				"import java.lang.annotation.Annotation;\n" + 
19501
				"import java.lang.reflect.*;\n" + 
19502
				"\n" + 
19503
				"@interface MyAnnotation {\n" + 
19504
				"}\n" + 
19505
				"public class X {\n" + 
19506
				"	void test() throws Exception {\n" + 
19507
				"		Class type = X.class;\n" + 
19508
				"		Method method = type.getMethod(\"test\");\n" + 
19509
				"		Constructor constructor = type.getConstructor();\n" + 
19510
				"		Field field = type.getField(\"field\");\n" + 
19511
				"		Package packge = type.getPackage();\n" + 
19512
				"		MyAnnotation typeAnnot = getAnnotation(MyAnnotation.class);\n" + 
19513
				"		MyAnnotation methodAnnot = getAnnotation(MyAnnotation.class);\n" + 
19514
				"		MyAnnotation constrAnnot = getAnnotation(MyAnnotation.class);\n" + 
19515
				"		MyAnnotation fieldAnnot = getAnnotation(MyAnnotation.class);\n" + 
19516
				"		MyAnnotation packgeAnnot = getAnnotation(MyAnnotation.class);\n" + 
19517
				"	}\n" + 
19518
				"\n" + 
19519
				"	int field;\n" + 
19520
				"	\n" + 
19521
				"	<U extends Annotation> U getAnnotation(Class<U> annotatedType) {\n" + 
19522
				"		return null;\n" + 
19523
				"	}\n" + 
19524
				"}\n",
19525
	        },
19526
			"");
19527
	}		
19528
	public void test0640() {
19529
	    this.runConformTest(
19530
            new String[] {
19531
                "X.java",
19532
				"import java.lang.annotation.Annotation;\n" + 
19533
				"import java.lang.reflect.*;\n" + 
19534
				"\n" + 
19535
				"@interface MyAnnotation {\n" + 
19536
				"}\n" + 
19537
				"public class X {\n" + 
19538
				"	void test() throws Exception {\n" + 
19539
				"		Class<?> type = X.class;\n" + 
19540
				"		Method method = type.getMethod(\"test\");\n" + 
19541
				"		Constructor constructor = type.getConstructor();\n" + 
19542
				"		Field field = type.getField(\"field\");\n" + 
19543
				"		Package packge = type.getPackage();\n" + 
19544
				"		MyAnnotation typeAnnot = getAnnotation(MyAnnotation.class);\n" + 
19545
				"		MyAnnotation methodAnnot = getAnnotation(MyAnnotation.class);\n" + 
19546
				"		MyAnnotation constrAnnot = getAnnotation(MyAnnotation.class);\n" + 
19547
				"		MyAnnotation fieldAnnot = getAnnotation(MyAnnotation.class);\n" + 
19548
				"		MyAnnotation packgeAnnot = getAnnotation(MyAnnotation.class);\n" + 
19549
				"	}\n" + 
19550
				"\n" + 
19551
				"	int field;\n" + 
19552
				"	\n" + 
19553
				"	<U extends Annotation> U getAnnotation(Class<U> annotatedType) {\n" + 
19554
				"		return null;\n" + 
19555
				"	}\n" + 
19556
				"}\n",
19557
	        },
19558
			"");
19559
	}			
19560
	public void test0641() {
19561
	    this.runNegativeTest(
19562
            new String[] {
19563
                "X.java",
19564
				"import java.lang.reflect.*;\n" + 
19565
				"\n" + 
19566
				"@interface MyAnnotation {\n" + 
19567
				"}\n" + 
19568
				"@SuppressWarnings(\"all\")\n" +
19569
				"public class X {\n" + 
19570
				"	void test() throws Exception {\n" + 
19571
				"		Class type = X.class;\n" + 
19572
				"		Method method = type.getMethod(\"test\");\n" + 
19573
				"		Constructor constructor = type.getConstructor();\n" + 
19574
				"		Field field = type.getField(\"field\");\n" + 
19575
				"		Package packge = type.getPackage();\n" + 
19576
				"		MyAnnotation typeAnnot = type.getAnnotation(MyAnnotation.class);\n" + 
19577
				"		MyAnnotation methodAnnot = method.getAnnotation(MyAnnotation.class);\n" + 
19578
				"		MyAnnotation constrAnnot = constructor.getAnnotation(MyAnnotation.class);\n" + 
19579
				"		MyAnnotation fieldAnnot = field.getAnnotation(MyAnnotation.class);\n" + 
19580
				"		MyAnnotation packgeAnnot = packge.getAnnotation(MyAnnotation.class);\n" + 
19581
				"	}\n" + 
19582
				"\n" + 
19583
				"	int field;\n" + 
19584
				"}\n",
19585
	        },
19586
	        "----------\n" + 
19587
			"1. ERROR in X.java (at line 13)\n" + 
19588
			"	MyAnnotation typeAnnot = type.getAnnotation(MyAnnotation.class);\n" + 
19589
			"	                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19590
			"Type mismatch: cannot convert from Annotation to MyAnnotation\n" + 
19591
			"----------\n" + 
19592
			"2. ERROR in X.java (at line 15)\n" + 
19593
			"	MyAnnotation constrAnnot = constructor.getAnnotation(MyAnnotation.class);\n" + 
19594
			"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19595
			"Type mismatch: cannot convert from Annotation to MyAnnotation\n" + 
19596
			"----------\n");
19597
	}			
19598
	public void test0642() {
19599
	    this.runConformTest(
19600
            new String[] {
19601
                "X.java",
19602
				"import java.lang.reflect.*;\n" + 
19603
				"\n" + 
19604
				"@interface MyAnnotation {\n" + 
19605
				"}\n" + 
19606
				"@SuppressWarnings(\"all\")\n" +
19607
				"public class X {\n" + 
19608
				"	void test() throws Exception {\n" + 
19609
				"		Class<?> type = X.class;\n" + 
19610
				"		Method method = type.getMethod(\"test\");\n" + 
19611
				"		Constructor<?> constructor = type.getConstructor();\n" + 
19612
				"		Field field = type.getField(\"field\");\n" + 
19613
				"		Package packge = type.getPackage();\n" + 
19614
				"		MyAnnotation typeAnnot = type.getAnnotation(MyAnnotation.class);\n" + 
19615
				"		MyAnnotation methodAnnot = method.getAnnotation(MyAnnotation.class);\n" + 
19616
				"		MyAnnotation constrAnnot = constructor.getAnnotation(MyAnnotation.class);\n" + 
19617
				"		MyAnnotation fieldAnnot = field.getAnnotation(MyAnnotation.class);\n" + 
19618
				"		MyAnnotation packgeAnnot = packge.getAnnotation(MyAnnotation.class);\n" + 
19619
				"	}\n" + 
19620
				"\n" + 
19621
				"	int field;\n" + 
19622
				"}\n",
19623
	        },
19624
			"");
19625
	}		
19626
	public void test0643() {
19627
	    this.runConformTest(
19628
            new String[] {
19629
                "X.java",
19630
				"public class X<T> {\n" + 
19631
				"	\n" + 
19632
				"	static <U> U foo(U u) {\n" + 
19633
				"		return u;\n" + 
19634
				"	}\n" + 
19635
				"	\n" + 
19636
				"	void bar(X x) {\n" + 
19637
				"		String str = x.foo(\"hello\");\n" + 
19638
				"	}\n" + 
19639
				"}\n",
19640
	        },
19641
			"");
19642
	}		
19643
	public void test0644() {
19644
	    this.runNegativeTest(
19645
            new String[] {
19646
                "X.java",
19647
				"public class X<T> {\n" + 
19648
				"	\n" + 
19649
				"	<U> U foo(U u) {\n" + 
19650
				"		return u;\n" + 
19651
				"	}\n" + 
19652
				"	\n" + 
19653
				"	void bar(X x) {\n" + 
19654
				"		String str = x.foo(\"hello\");\n" + 
19655
				"	}\n" + 
19656
				"}\n",
19657
	        },
19658
	        "----------\n" + 
19659
			"1. WARNING in X.java (at line 7)\n" + 
19660
			"	void bar(X x) {\n" + 
19661
			"	         ^\n" + 
19662
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
19663
			"----------\n" + 
19664
			"2. WARNING in X.java (at line 8)\n" + 
19665
			"	String str = x.foo(\"hello\");\n" + 
19666
			"	             ^^^^^^^^^^^^^^\n" + 
19667
			"Type safety: The method foo(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
19668
			"----------\n" + 
19669
			"3. ERROR in X.java (at line 8)\n" + 
19670
			"	String str = x.foo(\"hello\");\n" + 
19671
			"	             ^^^^^^^^^^^^^^\n" + 
19672
			"Type mismatch: cannot convert from Object to String\n" + 
19673
			"----------\n");
19674
	}			
19675
	public void test0645() {
19676
	    this.runNegativeTest(
19677
            new String[] {
19678
                "X.java",
19679
				"import java.lang.annotation.Annotation;\n" + 
19680
				"\n" + 
19681
				"@interface MyAnnotation {\n" + 
19682
				"}\n" + 
19683
				"\n" + 
19684
				"class X {\n" + 
19685
				"	void bar(XClass<String> arg) {\n" + 
19686
				"		XClass xc = new XClass();\n" + 
19687
				"		String str = xc.getConstructor().getAnnotation(arg);\n" + 
19688
				"	}\n" + 
19689
				"}\n" + 
19690
				"\n" + 
19691
				"class XClass<U> {\n" + 
19692
				"	XConstructor<U> getConstructor() {\n" + 
19693
				"		return null;\n" + 
19694
				"	}\n" + 
19695
				"}\n" + 
19696
				"class XConstructor<V> {\n" + 
19697
				"	<W extends Annotation> W getAnnotation(XClass<W> cl) {\n" + 
19698
				"		return null;\n" + 
19699
				"	}\n" + 
19700
				"}\n",
19701
	        },
19702
			"----------\n" + 
19703
			"1. WARNING in X.java (at line 8)\n" + 
19704
			"	XClass xc = new XClass();\n" + 
19705
			"	^^^^^^\n" + 
19706
			"XClass is a raw type. References to generic type XClass<U> should be parameterized\n" + 
19707
			"----------\n" + 
19708
			"2. WARNING in X.java (at line 8)\n" + 
19709
			"	XClass xc = new XClass();\n" + 
19710
			"	                ^^^^^^\n" + 
19711
			"XClass is a raw type. References to generic type XClass<U> should be parameterized\n" + 
19712
			"----------\n" + 
19713
			"3. WARNING in X.java (at line 9)\n" + 
19714
			"	String str = xc.getConstructor().getAnnotation(arg);\n" + 
19715
			"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19716
			"Type safety: The method getAnnotation(XClass) belongs to the raw type XConstructor. References to generic type XConstructor<V> should be parameterized\n" + 
19717
			"----------\n" + 
19718
			"4. ERROR in X.java (at line 9)\n" + 
19719
			"	String str = xc.getConstructor().getAnnotation(arg);\n" + 
19720
			"	             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19721
			"Type mismatch: cannot convert from Annotation to String\n" + 
19722
			"----------\n");
19723
	}			
19724
	public void test0646() {
19725
	    this.runNegativeTest(
19726
            new String[] {
19727
                "X.java",
19728
				"public class X {\n" + 
19729
				"	public static void main(String[] args) {\n" + 
19730
				"		Outer.Inner inner = new Outer().new Inner();\n" + 
19731
				"		X x = inner.setOuterT(new X());\n" + 
19732
				"		\n" + 
19733
				"		Outer<String>.Inner innerS = inner;\n" + 
19734
				"	}\n" + 
19735
				"}\n" + 
19736
				"\n" + 
19737
				"class Outer<T> {\n" + 
19738
				"	T t;\n" + 
19739
				"	class Inner {\n" + 
19740
				"		T setOuterT(T t1) {\n" + 
19741
				"			t = t1;\n" + 
19742
				"			return t;\n" + 
19743
				"		}\n" + 
19744
				"	}\n" + 
19745
				"}\n",
19746
	        },
19747
	        "----------\n" + 
19748
			"1. WARNING in X.java (at line 3)\n" + 
19749
			"	Outer.Inner inner = new Outer().new Inner();\n" + 
19750
			"	^^^^^^^^^^^\n" + 
19751
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner should be parameterized\n" + 
19752
			"----------\n" + 
19753
			"2. WARNING in X.java (at line 3)\n" + 
19754
			"	Outer.Inner inner = new Outer().new Inner();\n" + 
19755
			"	                        ^^^^^\n" + 
19756
			"Outer is a raw type. References to generic type Outer<T> should be parameterized\n" + 
19757
			"----------\n" + 
19758
			"3. WARNING in X.java (at line 3)\n" + 
19759
			"	Outer.Inner inner = new Outer().new Inner();\n" + 
19760
			"	                                    ^^^^^\n" + 
19761
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner should be parameterized\n" + 
19762
			"----------\n" + 
19763
			"4. WARNING in X.java (at line 4)\n" + 
19764
			"	X x = inner.setOuterT(new X());\n" + 
19765
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19766
			"Type safety: The method setOuterT(Object) belongs to the raw type Outer.Inner. References to generic type Outer<T>.Inner should be parameterized\n" + 
19767
			"----------\n" + 
19768
			"5. ERROR in X.java (at line 4)\n" + 
19769
			"	X x = inner.setOuterT(new X());\n" + 
19770
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
19771
			"Type mismatch: cannot convert from Object to X\n" + 
19772
			"----------\n" + 
19773
			"6. WARNING in X.java (at line 6)\n" + 
19774
			"	Outer<String>.Inner innerS = inner;\n" + 
19775
			"	                             ^^^^^\n" + 
19776
			"Type safety: The expression of type Outer.Inner needs unchecked conversion to conform to Outer<String>.Inner\n" + 
19777
			"----------\n");
19778
	}				
19779
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=94644
19780
	public void test0647() {
19781
	    this.runNegativeTest(
19782
            new String[] {
19783
                "X.java",
19784
				"public class X {\n" + 
19785
				"	public static void main(String[] args) {\n" + 
19786
				"		Outer.Inner inner = new Outer().new Inner();\n" + 
19787
				"		X x = inner.set(new X());\n" + 
19788
				"		\n" + 
19789
				"		Outer<String>.Inner innerS = inner;\n" + 
19790
				"	}\n" + 
19791
				"}\n" + 
19792
				"\n" + 
19793
				"class Outer<T> {\n" + 
19794
				"	T t;\n" + 
19795
				"	static class Inner<U> {\n" + 
19796
				"		U set(U u) {\n" + 
19797
				"			return u;\n" + 
19798
				"		}\n" + 
19799
				"	}\n" + 
19800
				"}\n",
19801
	        },
19802
	        "----------\n" + 
19803
			"1. WARNING in X.java (at line 3)\n" + 
19804
			"	Outer.Inner inner = new Outer().new Inner();\n" + 
19805
			"	^^^^^^^^^^^\n" + 
19806
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner<U> should be parameterized\n" + 
19807
			"----------\n" + 
19808
			"2. WARNING in X.java (at line 3)\n" + 
19809
			"	Outer.Inner inner = new Outer().new Inner();\n" + 
19810
			"	                        ^^^^^\n" + 
19811
			"Outer is a raw type. References to generic type Outer<T> should be parameterized\n" + 
19812
			"----------\n" + 
19813
			"3. WARNING in X.java (at line 3)\n" + 
19814
			"	Outer.Inner inner = new Outer().new Inner();\n" + 
19815
			"	                                    ^^^^^\n" + 
19816
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner<U> should be parameterized\n" + 
19817
			"----------\n" + 
19818
			"4. WARNING in X.java (at line 4)\n" + 
19819
			"	X x = inner.set(new X());\n" + 
19820
			"	      ^^^^^^^^^^^^^^^^^^\n" + 
19821
			"Type safety: The method set(Object) belongs to the raw type Outer.Inner. References to generic type Outer<T>.Inner<U> should be parameterized\n" + 
19822
			"----------\n" + 
19823
			"5. ERROR in X.java (at line 4)\n" + 
19824
			"	X x = inner.set(new X());\n" + 
19825
			"	      ^^^^^^^^^^^^^^^^^^\n" + 
19826
			"Type mismatch: cannot convert from Object to X\n" + 
19827
			"----------\n" + 
19828
			"6. ERROR in X.java (at line 6)\n" + 
19829
			"	Outer<String>.Inner innerS = inner;\n" + 
19830
			"	^^^^^^^^^^^^^^^^^^^\n" + 
19831
			"The member type Outer<String>.Inner cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type Outer<String>\n" + 
19832
			"----------\n");
19833
	}
19834
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=94644 - variation	
19835
	public void test0648() {
19836
	    this.runNegativeTest(
19837
            new String[] {
19838
                "X.java",
19839
				"public class X {\n" + 
19840
				"	void foo() {\n" + 
19841
				"		@SuppressWarnings(\"unused\")\n" + 
19842
				"		Outer.Inner inner = new Sub().get();\n" + 
19843
				"	}\n" + 
19844
				"	Zork z;\n" + 
19845
				"}\n" + 
19846
				"class Outer<T> {\n" + 
19847
				"	class Inner<U> {\n" + 
19848
				"	}\n" + 
19849
				"}\n" + 
19850
				"class Sub extends Outer {\n" + 
19851
				"	Inner get() { return null; }\n" + 
19852
				"}\n",
19853
	        },
19854
	        "----------\n" + 
19855
			"1. WARNING in X.java (at line 4)\n" + 
19856
			"	Outer.Inner inner = new Sub().get();\n" + 
19857
			"	^^^^^^^^^^^\n" + 
19858
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner<U> should be parameterized\n" + 
19859
			"----------\n" + 
19860
			"2. ERROR in X.java (at line 6)\n" + 
19861
			"	Zork z;\n" + 
19862
			"	^^^^\n" + 
19863
			"Zork cannot be resolved to a type\n" + 
19864
			"----------\n" + 
19865
			"3. WARNING in X.java (at line 12)\n" + 
19866
			"	class Sub extends Outer {\n" + 
19867
			"	                  ^^^^^\n" + 
19868
			"Outer is a raw type. References to generic type Outer<T> should be parameterized\n" + 
19869
			"----------\n" + 
19870
			"4. WARNING in X.java (at line 13)\n" + 
19871
			"	Inner get() { return null; }\n" + 
19872
			"	^^^^^\n" + 
19873
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner<U> should be parameterized\n" + 
19874
			"----------\n");
19875
	}			
19876
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=94644 - variation	
19877
	public void test0649() {
19878
	    this.runNegativeTest(
19879
            new String[] {
19880
                "X.java",
19881
				"public class X {\n" + 
19882
				"	void foo() {\n" + 
19883
				"		@SuppressWarnings(\"unused\")\n" + 
19884
				"		Outer<String>.Inner inner = new Sub().get();\n" + 
19885
				"	}\n" + 
19886
				"	Zork z;\n" + 
19887
				"}\n" + 
19888
				"class Outer<T> {\n" + 
19889
				"	class Inner {\n" + 
19890
				"	}\n" + 
19891
				"}\n" + 
19892
				"class Sub extends Outer {\n" + 
19893
				"	Inner get() { return null; }\n" + 
19894
				"}\n",
19895
	        },
19896
	        "----------\n" + 
19897
			"1. WARNING in X.java (at line 4)\n" + 
19898
			"	Outer<String>.Inner inner = new Sub().get();\n" + 
19899
			"	                            ^^^^^^^^^^^^^^^\n" + 
19900
			"Type safety: The expression of type Outer.Inner needs unchecked conversion to conform to Outer<String>.Inner\n" + 
19901
			"----------\n" + 
19902
			"2. ERROR in X.java (at line 6)\n" + 
19903
			"	Zork z;\n" + 
19904
			"	^^^^\n" + 
19905
			"Zork cannot be resolved to a type\n" + 
19906
			"----------\n" + 
19907
			"3. WARNING in X.java (at line 12)\n" + 
19908
			"	class Sub extends Outer {\n" + 
19909
			"	                  ^^^^^\n" + 
19910
			"Outer is a raw type. References to generic type Outer<T> should be parameterized\n" + 
19911
			"----------\n" + 
19912
			"4. WARNING in X.java (at line 13)\n" + 
19913
			"	Inner get() { return null; }\n" + 
19914
			"	^^^^^\n" + 
19915
			"Outer.Inner is a raw type. References to generic type Outer<T>.Inner should be parameterized\n" + 
19916
			"----------\n");
19917
	}
19918
	
19919
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89440	
19920
	public void test0650() {
19921
	    this.runConformTest(
19922
            new String[] {
19923
				"p/A.java",
19924
				"package p;\n" +
19925
				"\n" +
19926
				"public interface A<V> {\n" +
19927
				"	public static enum Stuff {\n" +
19928
				"		FIRST, SECOND, THIRD\n" +
19929
				"	};\n" +
19930
				"}",
19931
            },
19932
            "");
19933
	    this.runConformTest(
19934
	    	new String[] {
19935
				"q/SampleClass2.java",
19936
				"package q;\n" +
19937
				"\n" +
19938
				"import p.A.Stuff;\n" +
19939
				"\n" +
19940
				"public class SampleClass2 {\n" +
19941
				"  public void doSomething(Stuff thing) {\n" +
19942
				"    \n" +
19943
				"  }\n" +
19944
				"}"
19945
            },
19946
			"",
19947
			null,
19948
			false,
19949
			null);
19950
		this.runConformTest(
19951
			new String[] {
19952
				"q/SampleClass3.java",
19953
				"package q;\n" +
19954
				"\n" +
19955
				"import p.A;\n" +
19956
				"\n" +
19957
				"public class SampleClass3 {\n" +
19958
				"	public void doSomething() {\n" +
19959
				"		SampleClass2 sample = new SampleClass2();\n" +
19960
				"		sample.doSomething(A.Stuff.FIRST);\n" +
19961
				"	}\n" +
19962
				"}",
19963
			},
19964
			"",
19965
			null,
19966
			false,
19967
			null);
19968
	}
19969
	public void test0651() {
19970
	    this.runConformTest(
19971
            new String[] {
19972
                "X.java",
19973
				"public class X<U> {\n" + 
19974
				"\n" + 
19975
				"	int field;\n" + 
19976
				"	static int FIELD;\n" + 
19977
				"\n" + 
19978
				"	{\n" + 
19979
				"		field = 1;\n" + 
19980
				"	}\n" + 
19981
				"	static {\n" + 
19982
				"		FIELD = 1;\n" + 
19983
				"	}\n" + 
19984
				"\n" + 
19985
				"	public Values<U> foo(Box<? extends U> box) {\n" + 
19986
				"		return selectedValues(box.getValues()); // 1\n" + 
19987
				"	}\n" + 
19988
				"	public static <G> Values<G> selectedValues(Values<? extends G> v) {\n" + 
19989
				"		return null;\n" + 
19990
				"	}\n" + 
19991
				"}\n" + 
19992
				"abstract class Box<V extends java.io.Serializable> { // Added bound for V\n" + 
19993
				"	abstract Values<V> getValues();\n" + 
19994
				"}\n" + 
19995
				"abstract class Values<T> {\n" + 
19996
				"}\n",
19997
	        },
19998
			"");
19999
	}	
20000
	public void test0652() {
20001
	    this.runConformTest(
20002
            new String[] {
20003
                "X.java",
20004
				"import java.util.*;\n" + 
20005
				"\n" + 
20006
				"public class X {\n" + 
20007
				"    public static void main(String[] args) {\n" + 
20008
				"        Collection<?> c = new HashSet<String>();\n" + 
20009
				"        Set<?> s = (Set<?>)c;\n" + 
20010
				"    }\n" + 
20011
				"}\n",
20012
	        },
20013
			"");
20014
	}	
20015
	public void test0653() {
20016
	    this.runNegativeTest(
20017
            new String[] {
20018
                "X.java",
20019
				"import java.util.*;\n" + 
20020
				"\n" + 
20021
				"public class X {\n" + 
20022
				"	static public <T extends Collection> void workaround(T a, T b) {\n" + 
20023
				"		a.addAll(b);\n" + 
20024
				"	}\n" + 
20025
				"	Zork z;\n" + 
20026
				"}\n",
20027
	        },
20028
	        "----------\n" + 
20029
			"1. WARNING in X.java (at line 4)\n" + 
20030
			"	static public <T extends Collection> void workaround(T a, T b) {\n" + 
20031
			"	                         ^^^^^^^^^^\n" + 
20032
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
20033
			"----------\n" + 
20034
			"2. WARNING in X.java (at line 5)\n" + 
20035
			"	a.addAll(b);\n" + 
20036
			"	^^^^^^^^^^^\n" + 
20037
			"Type safety: The method addAll(Collection) belongs to the raw type Collection. References to generic type Collection<E> should be parameterized\n" + 
20038
			"----------\n" + 
20039
			"3. ERROR in X.java (at line 7)\n" + 
20040
			"	Zork z;\n" + 
20041
			"	^^^^\n" + 
20042
			"Zork cannot be resolved to a type\n" + 
20043
			"----------\n");
20044
	}		
20045
	public void test0654() {
20046
	    this.runNegativeTest(
20047
            new String[] {
20048
                "X.java",
20049
				"import java.util.*;\n" + 
20050
				"\n" + 
20051
				"public class X {\n" + 
20052
				"	public static void main(String[] args) {\n" + 
20053
				"		Map myMap = new HashMap();\n" + 
20054
				"		myMap.put(\"key1\", \"1\");\n" + 
20055
				"\n" + 
20056
				"		for (Map.Entry e : myMap.entrySet())\n" + 
20057
				"			System.out.println(\"Key = \" + e.getKey() + \" Value = \" + e.getValue());\n" + 
20058
				"		Set<Map.Entry> set = myMap.entrySet();\n" + 
20059
				"		for (Map.Entry e : set)\n" + 
20060
				"			System.out.println(\"Key = \" + e.getKey() + \" Value = \" + e.getValue());\n" + 
20061
				"	}\n" + 
20062
				"}\n",
20063
	        },
20064
	        "----------\n" + 
20065
			"1. WARNING in X.java (at line 5)\n" + 
20066
			"	Map myMap = new HashMap();\n" + 
20067
			"	^^^\n" + 
20068
			"Map is a raw type. References to generic type Map<K,V> should be parameterized\n" + 
20069
			"----------\n" + 
20070
			"2. WARNING in X.java (at line 5)\n" + 
20071
			"	Map myMap = new HashMap();\n" + 
20072
			"	                ^^^^^^^\n" + 
20073
			"HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized\n" + 
20074
			"----------\n" + 
20075
			"3. WARNING in X.java (at line 6)\n" + 
20076
			"	myMap.put(\"key1\", \"1\");\n" + 
20077
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
20078
			"Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map<K,V> should be parameterized\n" + 
20079
			"----------\n" + 
20080
			"4. WARNING in X.java (at line 8)\n" + 
20081
			"	for (Map.Entry e : myMap.entrySet())\n" + 
20082
			"	     ^^^^^^^^^\n" + 
20083
			"Map.Entry is a raw type. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
20084
			"----------\n" + 
20085
			"5. ERROR in X.java (at line 8)\n" + 
20086
			"	for (Map.Entry e : myMap.entrySet())\n" + 
20087
			"	                   ^^^^^^^^^^^^^^^^\n" + 
20088
			"Type mismatch: cannot convert from element type Object to Map.Entry\n" + 
20089
			"----------\n" + 
20090
			"6. WARNING in X.java (at line 10)\n" + 
20091
			"	Set<Map.Entry> set = myMap.entrySet();\n" + 
20092
			"	    ^^^^^^^^^\n" + 
20093
			"Map.Entry is a raw type. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
20094
			"----------\n" + 
20095
			"7. WARNING in X.java (at line 10)\n" + 
20096
			"	Set<Map.Entry> set = myMap.entrySet();\n" + 
20097
			"	                     ^^^^^^^^^^^^^^^^\n" + 
20098
			"Type safety: The expression of type Set needs unchecked conversion to conform to Set<Map.Entry>\n" + 
20099
			"----------\n" + 
20100
			"8. WARNING in X.java (at line 11)\n" + 
20101
			"	for (Map.Entry e : set)\n" + 
20102
			"	     ^^^^^^^^^\n" + 
20103
			"Map.Entry is a raw type. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
20104
			"----------\n");
20105
	}			
20106
// **
20107
public void test0655() {
20108
	this.runNegativeTest(
20109
		new String[] {
20110
			"X.java",
20111
			"public class X {\n" + 
20112
			"    static class BB<T, S> { }\n" + 
20113
			"    static class BD<T> extends BB<T, T> { }\n" + 
20114
			"    void f() {\n" + 
20115
			"        BB<? extends Number, ? super Integer> bb = null;\n" + 
20116
			"        Object o = (BD<Number>) bb;\n" + 
20117
			"    }\n" + 
20118
			"    Zork z;\n" + 
20119
			"}\n",
20120
		},
20121
		"----------\n" + 
20122
		"1. WARNING in X.java (at line 6)\n" + 
20123
		"	Object o = (BD<Number>) bb;\n" + 
20124
		"	           ^^^^^^^^^^^^^^^\n" + 
20125
		"Type safety: Unchecked cast from X.BB<capture#1-of ? extends Number,capture#2-of ? super Integer> to X.BD<Number>\n" + 
20126
		"----------\n" + 
20127
		"2. WARNING in X.java (at line 6)\n" + 
20128
		"	Object o = (BD<Number>) bb;\n" + 
20129
		"	           ^^^^^^^^^^^^^^^\n" + 
20130
		"Unnecessary cast from X.BB<capture#1-of ? extends Number,capture#2-of ? super Integer> to X.BD<Number>\n" + 
20131
		"----------\n" + 
20132
		"3. ERROR in X.java (at line 8)\n" + 
20133
		"	Zork z;\n" + 
20134
		"	^^^^\n" + 
20135
		"Zork cannot be resolved to a type\n" + 
20136
		"----------\n");
20137
}	
20138
public void test0656() {
20139
	this.runConformTest(
20140
		new String[] {
20141
			"X.java",
20142
			"import java.util.*;\n" + 
20143
			"\n" + 
20144
			"public class X {\n" + 
20145
			"	protected Vector<String> v = null;\n" + 
20146
			"\n" + 
20147
			"	public void f() {\n" + 
20148
			"		((String) (v.elementAt(0))).charAt(0);\n" + 
20149
			"	}\n" + 
20150
			"\n" + 
20151
			"	public static void main(String[] args) {\n" + 
20152
			"		System.out.println(\"SUCCESS\");\n" + 
20153
			"	}\n" + 
20154
			"}\n",
20155
		},
20156
		"SUCCESS");
20157
}	
20158
public void test0657() {
20159
	this.runConformTest(
20160
		new String[] {
20161
			"X.java",
20162
			"public class X{\n" + 
20163
			"	\n" + 
20164
			"	private static class GenericWrapper<Elem>  {\n" + 
20165
			"		private Elem theObject;\n" + 
20166
			"		public GenericWrapper(Elem arg) {\n" + 
20167
			"			theObject = arg;\n" + 
20168
			"		}\n" + 
20169
			"		public <T extends Elem> GenericWrapper (GenericWrapper<T> other) {\n" + 
20170
			"			this.theObject = other.theObject;\n" + 
20171
			"		}\n" + 
20172
			"		public String toString() {\n" + 
20173
			"			return theObject.toString();\n" + 
20174
			"		}\n" + 
20175
			"	}\n" + 
20176
			"	private static GenericWrapper<String> method (Object wrappedString) {\n" + 
20177
			"		return (GenericWrapper<String>) wrappedString;\n" + 
20178
			"	}\n" + 
20179
			"\n" + 
20180
			"	public static void main(String[] args) {\n" + 
20181
			"		System.out.print(method(new GenericWrapper<String>(\"abc\")));\n" + 
20182
			"		System.out.println(method(new GenericWrapper<Exception>(new Exception())));\n" + 
20183
			"	}\n" + 
20184
			"}\n",
20185
		},
20186
		"abcjava.lang.Exception");
20187
}	
20188
public void test0658() {
20189
	this.runNegativeTest(
20190
		new String[] {
20191
			"X.java",
20192
			"public class X{\n" + 
20193
			"	\n" + 
20194
			"	private static class GenericWrapper<Elem>  {\n" + 
20195
			"		Zork z;\n" +
20196
			"		private Elem theObject;\n" + 
20197
			"		public GenericWrapper(Elem arg) {\n" + 
20198
			"			theObject = arg;\n" + 
20199
			"		}\n" + 
20200
			"		public <T extends Elem> GenericWrapper (GenericWrapper<T> other) {\n" + 
20201
			"			this.theObject = other.theObject;\n" + 
20202
			"		}\n" + 
20203
			"		public String toString() {\n" + 
20204
			"			return theObject.toString();\n" + 
20205
			"		}\n" + 
20206
			"	}\n" + 
20207
			"	private static GenericWrapper<String> method (Object wrappedString) {\n" + 
20208
			"		return (GenericWrapper<String>) wrappedString;\n" + 
20209
			"	}\n" + 
20210
			"\n" + 
20211
			"	public static void main(String[] args) {\n" + 
20212
			"		System.out.print(method(new GenericWrapper<String>(\"abc\")));\n" + 
20213
			"		System.out.println(method(new GenericWrapper<Exception>(new Exception())));\n" + 
20214
			"	}\n" + 
20215
			"}\n",
20216
		},
20217
		"----------\n" + 
20218
		"1. ERROR in X.java (at line 4)\n" + 
20219
		"	Zork z;\n" + 
20220
		"	^^^^\n" + 
20221
		"Zork cannot be resolved to a type\n" + 
20222
		"----------\n" + 
20223
		"2. WARNING in X.java (at line 12)\n" + 
20224
		"	public String toString() {\n" + 
20225
		"	              ^^^^^^^^^^\n" + 
20226
		"The method toString() of type X.GenericWrapper<Elem> should be tagged with @Override since it actually overrides a superclass method\n" + 
20227
		"----------\n" + 
20228
		"3. WARNING in X.java (at line 17)\n" + 
20229
		"	return (GenericWrapper<String>) wrappedString;\n" + 
20230
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
20231
		"Type safety: Unchecked cast from Object to X.GenericWrapper<String>\n" + 
20232
		"----------\n");
20233
}	
20234
public void test0659() {
20235
	this.runNegativeTest(
20236
		new String[] {
20237
			"X.java",
20238
			"import java.lang.ref.*;\n" + 
20239
			"\n" + 
20240
			"@SuppressWarnings(\"unused\")\n" + 
20241
			"public class X<K, V> extends WeakReference<V> {\n" + 
20242
			"	Zork z;\n" + 
20243
			"	static ReferenceQueue<Integer> queue = new ReferenceQueue<Integer>();\n" + 
20244
			"\n" + 
20245
			"	private K key;\n" + 
20246
			"\n" + 
20247
			"	public X(K key, V value, ReferenceQueue<V> queue) {\n" + 
20248
			"		super(value, queue);\n" + 
20249
			"	}\n" + 
20250
			"\n" + 
20251
			"	public K getKey() {\n" + 
20252
			"		return key;\n" + 
20253
			"	}\n" + 
20254
			"	@Override\n" + 
20255
			"	public String toString() {\n" + 
20256
			"		return \"key:\" + key;\n" + 
20257
			"	}\n" + 
20258
			"\n" + 
20259
			"	public static void main(String[] arg) throws Exception {\n" + 
20260
			"		X<String, Integer> ref = new X<String, Integer>(\"Dummy Key\", new Integer(5), queue);\n" + 
20261
			"		new Thread() {\n" + 
20262
			"			@Override\n" + 
20263
			"			public void run() {\n" + 
20264
			"				for (;;) {\n" + 
20265
			"					// force ref to be cleared\n" + 
20266
			"					System.gc();\n" + 
20267
			"				}\n" + 
20268
			"			}\n" + 
20269
			"		}.start();\n" + 
20270
			"\n" + 
20271
			"		X<String, Integer> fromQueue = (X<String, Integer>) queue.remove();\n" + 
20272
			"		System.out.println(fromQueue);\n" + 
20273
			"		System.exit(0);\n" + 
20274
			"	}\n" + 
20275
			"}\n",
20276
		},
20277
		"----------\n" + 
20278
		"1. ERROR in X.java (at line 5)\n" + 
20279
		"	Zork z;\n" + 
20280
		"	^^^^\n" + 
20281
		"Zork cannot be resolved to a type\n" + 
20282
		"----------\n" + 
20283
		"2. WARNING in X.java (at line 34)\n" + 
20284
		"	X<String, Integer> fromQueue = (X<String, Integer>) queue.remove();\n" + 
20285
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
20286
		"Type safety: Unchecked cast from Reference<capture#1-of ? extends Integer> to X<String,Integer>\n" + 
20287
		"----------\n");
20288
}	
20289
public void test0660() {
20290
	this.runConformTest(
20291
		new String[] {
20292
			"X.java",
20293
			"public class X {\n" + 
20294
			"\n" + 
20295
			"	boolean run(X x) {\n" + 
20296
			"		return false;\n" + 
20297
			"	}\n" + 
20298
			"	<T> void run(Class<T> ct) {\n" + 
20299
			"	}\n" + 
20300
			"\n" + 
20301
			"	public static void main(String[] args) {\n" + 
20302
			"		boolean b = new X().run(new X(){});\n" + 
20303
			"		System.out.println(\"SUCCESS\");\n" + 
20304
			"	}\n" + 
20305
			"}\n",
20306
		},
20307
		"SUCCESS");
20308
}	
20309
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95066
20310
public void test0661() {
20311
	this.runNegativeTest(
20312
		new String[] {
20313
			"X.java",
20314
			"public class X<S extends Comparable<S>> {\n" + 
20315
			"   public X() {\n" + 
20316
			"       S a = (S)(Integer)3;\n" + 
20317
			"   }\n" + 
20318
			"	Zork z;\n" +
20319
			"}\n",
20320
		},
20321
		"----------\n" + 
20322
		"1. WARNING in X.java (at line 3)\n" + 
20323
		"	S a = (S)(Integer)3;\n" + 
20324
		"	      ^^^^^^^^^^^^^\n" + 
20325
		"Type safety: Unchecked cast from Integer to S\n" + 
20326
		"----------\n" + 
20327
		"2. WARNING in X.java (at line 3)\n" + 
20328
		"	S a = (S)(Integer)3;\n" + 
20329
		"	         ^^^^^^^^^^\n" + 
20330
		"Unnecessary cast from int to Integer\n" + 
20331
		"----------\n" + 
20332
		"3. ERROR in X.java (at line 5)\n" + 
20333
		"	Zork z;\n" + 
20334
		"	^^^^\n" + 
20335
		"Zork cannot be resolved to a type\n" + 
20336
		"----------\n");
20337
}	
20338
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95066 - variation
20339
public void test0662() {
20340
	this.runNegativeTest(
20341
		new String[] {
20342
			"X.java",
20343
			"public class X<S extends Comparable<String>> {\n" + 
20344
			"   public X() {\n" + 
20345
			"       S a = (S)(Integer)3; // this should fail\n" + 
20346
			"   }\n" +
20347
			"	Zork z;\n" +
20348
			"}",
20349
		},
20350
		"----------\n" + 
20351
		"1. ERROR in X.java (at line 3)\n" + 
20352
		"	S a = (S)(Integer)3; // this should fail\n" + 
20353
		"	      ^^^^^^^^^^^^^\n" + 
20354
		"Cannot cast from Integer to S\n" + 
20355
		"----------\n" + 
20356
		"2. WARNING in X.java (at line 3)\n" + 
20357
		"	S a = (S)(Integer)3; // this should fail\n" + 
20358
		"	         ^^^^^^^^^^\n" + 
20359
		"Unnecessary cast from int to Integer\n" + 
20360
		"----------\n" + 
20361
		"3. ERROR in X.java (at line 5)\n" + 
20362
		"	Zork z;\n" + 
20363
		"	^^^^\n" + 
20364
		"Zork cannot be resolved to a type\n" + 
20365
		"----------\n");
20366
}	
20367
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95066 - variation
20368
public void test0663() {
20369
	this.runNegativeTest(
20370
		new String[] {
20371
			"X.java",
20372
			"import java.util.List;\n" + 
20373
			"\n" + 
20374
			"public class X {\n" + 
20375
			"   Object foo(Comparable<Integer> c) {\n" + 
20376
			"	   return (Comparable<S>) c;\n" + 
20377
			"   }\n" + 
20378
			"   <U extends Throwable, V extends Runnable> void foo(List<V> lv) {\n" + 
20379
			"	   List l = (List<U>) lv;\n" + 
20380
			"   }\n" + 
20381
			"   <U extends Throwable, V extends Runnable> void foo2(List<List<V>> lv) {\n" + 
20382
			"	   List l = (List<List<U>>) lv;\n" + 
20383
			"   }\n" + 
20384
			"}\n",
20385
		},
20386
		"----------\n" + 
20387
		"1. ERROR in X.java (at line 5)\n" + 
20388
		"	return (Comparable<S>) c;\n" + 
20389
		"	                   ^\n" + 
20390
		"S cannot be resolved to a type\n" + 
20391
		"----------\n" + 
20392
		"2. WARNING in X.java (at line 8)\n" + 
20393
		"	List l = (List<U>) lv;\n" + 
20394
		"	^^^^\n" + 
20395
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
20396
		"----------\n" + 
20397
		"3. WARNING in X.java (at line 8)\n" + 
20398
		"	List l = (List<U>) lv;\n" + 
20399
		"	         ^^^^^^^^^^^^\n" + 
20400
		"Type safety: Unchecked cast from List<V> to List<U>\n" + 
20401
		"----------\n" + 
20402
		"4. WARNING in X.java (at line 8)\n" + 
20403
		"	List l = (List<U>) lv;\n" + 
20404
		"	         ^^^^^^^^^^^^\n" + 
20405
		"Unnecessary cast from List<V> to List<U>\n" + 
20406
		"----------\n" + 
20407
		"5. WARNING in X.java (at line 11)\n" + 
20408
		"	List l = (List<List<U>>) lv;\n" + 
20409
		"	^^^^\n" + 
20410
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
20411
		"----------\n" + 
20412
		"6. ERROR in X.java (at line 11)\n" + 
20413
		"	List l = (List<List<U>>) lv;\n" + 
20414
		"	         ^^^^^^^^^^^^^^^^^^\n" + 
20415
		"Cannot cast from List<List<V>> to List<List<U>>\n" + 
20416
		"----------\n" + 
20417
		"7. WARNING in X.java (at line 11)\n" + 
20418
		"	List l = (List<List<U>>) lv;\n" + 
20419
		"	         ^^^^^^^^^^^^^^^^^^\n" + 
20420
		"Unnecessary cast from List<List<V>> to List<List<U>>\n" + 
20421
		"----------\n");
20422
}	
20423
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95066 - variation
20424
public void test0664() {
20425
	this.runNegativeTest(
20426
		new String[] {
20427
			"X.java",
20428
			"public class X<S extends Comparable<String>> {\n" + 
20429
			"   public X(X2 x2) {\n" + 
20430
			"       S a = (S)x2;\n" + 
20431
			"   }\n" + 
20432
			"}\n" + 
20433
			"abstract class X2 implements Comparable<X2> {\n" + 
20434
			"}\n",
20435
		},
20436
		"----------\n" + 
20437
		"1. ERROR in X.java (at line 3)\n" + 
20438
		"	S a = (S)x2;\n" + 
20439
		"	      ^^^^^\n" + 
20440
		"Cannot cast from X2 to S\n" + 
20441
		"----------\n");
20442
}	
20443
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95066 - variation
20444
public void test0665() {
20445
	this.runNegativeTest(
20446
		new String[] {
20447
			"Test.java",
20448
			"public class Test<S> {\n" + 
20449
			"	void foo() {\n" + 
20450
			"		A a = new A();\n" + 
20451
			"		Comparable<Object> c = (Comparable<Object>) a; // Fails as expected\n" + 
20452
			"		Comparable<S> c2 = (Comparable<S>) a; // Should fail?\n" + 
20453
			"	}\n" + 
20454
			"\n" + 
20455
			"}\n" + 
20456
			"\n" + 
20457
			"final class A implements Comparable<A> {\n" + 
20458
			"	public int compareTo(A o) {\n" + 
20459
			"		return 0;\n" + 
20460
			"	}\n" + 
20461
			"}\n",
20462
		},
20463
		"----------\n" + 
20464
		"1. ERROR in Test.java (at line 4)\n" + 
20465
		"	Comparable<Object> c = (Comparable<Object>) a; // Fails as expected\n" + 
20466
		"	                       ^^^^^^^^^^^^^^^^^^^^^^\n" + 
20467
		"Cannot cast from A to Comparable<Object>\n" + 
20468
		"----------\n" + 
20469
		"2. WARNING in Test.java (at line 5)\n" + 
20470
		"	Comparable<S> c2 = (Comparable<S>) a; // Should fail?\n" + 
20471
		"	                   ^^^^^^^^^^^^^^^^^\n" + 
20472
		"Type safety: Unchecked cast from A to Comparable<S>\n" + 
20473
		"----------\n");
20474
}	
20475
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89940
20476
public void test0666() {
20477
	this.runNegativeTest(
20478
		new String[] {
20479
			"X.java",
20480
			"import java.util.List;\n" + 
20481
			"\n" + 
20482
			"public class X {\n" + 
20483
			"	void foo(List<Object> objects, List raw) {\n" + 
20484
			"\n" + 
20485
			"	    List<Number> numbers;\n" + 
20486
			"	    List<? extends Number> ext;\n" + 
20487
			"	    \n" + 
20488
			"	    numbers= (List<Number>) objects; // correct - cast error\n" + 
20489
			"	    ext= (List<? extends Number>) objects; // wrong, should fail\n" + 
20490
			"\n" + 
20491
			"	    ext= raw; // correct - raw conversion warning issued\n" + 
20492
			"	    numbers= raw; // correct - raw conversion warning issued\n" + 
20493
			"	}\n" + 
20494
			"}\n",
20495
		},
20496
		"----------\n" + 
20497
		"1. WARNING in X.java (at line 4)\n" + 
20498
		"	void foo(List<Object> objects, List raw) {\n" + 
20499
		"	                               ^^^^\n" + 
20500
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
20501
		"----------\n" + 
20502
		"2. ERROR in X.java (at line 9)\n" + 
20503
		"	numbers= (List<Number>) objects; // correct - cast error\n" + 
20504
		"	         ^^^^^^^^^^^^^^^^^^^^^^\n" + 
20505
		"Cannot cast from List<Object> to List<Number>\n" + 
20506
		"----------\n" + 
20507
		"3. WARNING in X.java (at line 10)\n" + 
20508
		"	ext= (List<? extends Number>) objects; // wrong, should fail\n" + 
20509
		"	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
20510
		"Type safety: Unchecked cast from List<Object> to List<? extends Number>\n" + 
20511
		"----------\n" + 
20512
		"4. WARNING in X.java (at line 12)\n" + 
20513
		"	ext= raw; // correct - raw conversion warning issued\n" + 
20514
		"	     ^^^\n" + 
20515
		"Type safety: The expression of type List needs unchecked conversion to conform to List<? extends Number>\n" + 
20516
		"----------\n" + 
20517
		"5. WARNING in X.java (at line 13)\n" + 
20518
		"	numbers= raw; // correct - raw conversion warning issued\n" + 
20519
		"	         ^^^\n" + 
20520
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Number>\n" + 
20521
		"----------\n");
20522
}	
20523
public void _test0667() {
20524
	this.runNegativeTest(
20525
		new String[] {
20526
			"X.java",
20527
			"import java.util.*;\n" + 
20528
			"\n" + 
20529
			"public class X {\n" + 
20530
			"    public static void foo(List<? super Object[]> l) {    }\n" + 
20531
			" \n" + 
20532
			"    public static void foo2(List<Object[]> l) {    }\n" + 
20533
			" \n" + 
20534
			"    public static void foo3(List<? extends Object[]> l) {    }\n" + 
20535
			" \n" + 
20536
			"    public static void bar(List<? super Object> l) {    }\n" + 
20537
			" \n" + 
20538
			"    public static void bar2(List<Object> l) {    }\n" + 
20539
			" \n" + 
20540
			"    public static void bar3(List<? extends Object> l) {    }\n" + 
20541
			" \n" + 
20542
			"    public static void bar4(List<?> l) {    }\n" + 
20543
			" \n" + 
20544
			"    public static void main(String[] args) {\n" + 
20545
			"        {   // can be { Object, Object[] }\n" + 
20546
			"            List<? super Object[]> l = new ArrayList<Object[]>();\n" + 
20547
			"            l.add(l.get(0));  // illegal [01]\n" + 
20548
			"            l.add((Object) null);  // illegal [02]\n" + 
20549
			"            l.add((Integer) null);  // illegal [03]\n" + 
20550
			"            l.add((Object []) null); // illegal [04]\n" + 
20551
			"            l.add((Integer []) null); // illegal [05]\n" + 
20552
			"            l.add((Integer [][]) null); // illegal [06]\n" + 
20553
			" \n" + 
20554
			"            foo(l); // List<? super Object[]> - legal [07]\n" + 
20555
			"            foo2(l); // List<Object[]> - illegal [08]\n" + 
20556
			"            foo3(l); // List<? extends Object[]> - illegal [09]\n" + 
20557
			"            bar(l); // List<? super Object> - illegal [10]\n" + 
20558
			"            bar2(l); // List<Object> - illegal [11]\n" + 
20559
			"            bar3(l); // List<? extends Object> - legal [12]\n" + 
20560
			"            bar4(l); // List<?> - legal [13]\n" + 
20561
			"        }\n" + 
20562
			"        {   // can be Object[] or (? extends Object)[]\n" + 
20563
			"            List<Object[]> l = new ArrayList<Object[]>();\n" + 
20564
			"            l.add(l.get(0));  // legal [14]\n" + 
20565
			"            l.add((Object) null);  // illegal [15]\n" + 
20566
			"            l.add((Integer) null);  // illegal [16]\n" + 
20567
			"            l.add((Object []) null); // legal [17]\n" + 
20568
			"            l.add((Integer []) null); // legal [18]\n" + 
20569
			"            l.add((Integer [][]) null); // legal [19]\n" + 
20570
			" \n" + 
20571
			"            foo(l); // List<? super Object[]> - legal [20]\n" + 
20572
			"            foo2(l); // List<Object[]> - legal [21]\n" + 
20573
			"            foo3(l); // List<? extends Object[]> - legal [22]\n" + 
20574
			"            bar(l); // List<? super Object> - illegal [23]\n" + 
20575
			"            bar2(l); // List<Object> - illegal [24]\n" + 
20576
			"            bar3(l); // List<? extends Object> - legal [25]\n" + 
20577
			"            bar4(l); // List<?> - legal [26]\n" + 
20578
			"        }\n" + 
20579
			"        {   // Only allows wildcards, Object is illegal.\n" + 
20580
			"            List<? extends Object[]> l = new ArrayList<Object[]>();\n" + 
20581
			"            l.add(l.get(0));  // illegal [27]\n" + 
20582
			"            l.add((Object) null);  // illegal [28]\n" + 
20583
			"            l.add((Integer) null);  // illegal [29]\n" + 
20584
			"            l.add((Object []) null); // illegal [30]\n" + 
20585
			"            l.add((Integer []) null); // illegal [31]\n" + 
20586
			"            l.add((Integer [][]) null); // illegal [32]\n" + 
20587
			" \n" + 
20588
			"            foo(l); // List<? super Object[]> - illegal [33]\n" + 
20589
			"            foo2(l); // List<Object[]> - illegal [34]\n" + 
20590
			"            foo3(l); // List<? extends Object[]> - legal [35]\n" + 
20591
			"            bar(l); // List<? super Object> - illegal [36]\n" + 
20592
			"            bar2(l); // List<Object> - illegal [37]\n" + 
20593
			"            bar3(l); // List<? extends Object> - legal [38]\n" + 
20594
			"            bar4(l); // List<?> - legal [39]\n" + 
20595
			"        }\n" + 
20596
			"        {   // can add non-arrays but can only match ? super Object, ? super Object[], or ? extends Object, but not Object  \n" + 
20597
			"            List<? super Object> l = new ArrayList<Object>();\n" + 
20598
			"            l.add(l.get(0));  // legal [40]\n" + 
20599
			"            l.add((Object) null);  // legal [41]\n" + 
20600
			"            l.add((Integer) null);  // legal [42]\n" + 
20601
			"            l.add((Object []) null); // illegal [43]\n" + 
20602
			"            l.add((Integer []) null); // illegal [44]\n" + 
20603
			"            l.add((Integer [][]) null); // illegal [45]\n" + 
20604
			" \n" + 
20605
			"            foo(l); // legal [46]\n" + 
20606
			"            foo2(l); // illegal [47]\n" + 
20607
			"            foo3(l); // illegal [48]\n" + 
20608
			"            bar(l); // legal [49]\n" + 
20609
			"            bar2(l); // illegal [50]\n" + 
20610
			"            bar3(l); // legal [51]\n" + 
20611
			"            bar4(l); // legal [52]\n" + 
20612
			"        }\n" + 
20613
			"        {   // can add array but cannot call a method which expects an array. 100% !\n" + 
20614
			"            List<Object> l = new ArrayList<Object>();\n" + 
20615
			"            l.get(0).toString();\n" + 
20616
			"            l.add(l.get(0));  // legal [53]\n" + 
20617
			"            l.add((Object) null);  // legal [54]\n" + 
20618
			"            l.add((Integer) null);  // legal [55]\n" + 
20619
			"            l.add((Object []) null); // legal [56]\n" + 
20620
			"            l.add((Integer []) null); // legal [57]\n" + 
20621
			"            l.add((Integer [][]) null); // legal [58]\n" + 
20622
			" \n" + 
20623
			"            foo(l); // legal [59]\n" + 
20624
			"            foo2(l); // illegal [60]\n" + 
20625
			"            foo3(l); // illegal [61]\n" + 
20626
			"            bar(l); // legal [62]\n" + 
20627
			"            bar2(l); // legal [63]\n" + 
20628
			"            bar3(l); // legal [64]\n" + 
20629
			"            bar4(l); // legal [65]\n" + 
20630
			"        }\n" + 
20631
			"        {   // cannot add any type but can match ? or ? extends Object.\n" + 
20632
			"            List<? extends Object> l = new ArrayList<Object>();\n" + 
20633
			"            l.add(l.get(0));  // illegal [66]\n" + 
20634
			"            l.add((Object) null);  // illegal [67]\n" + 
20635
			"            l.add((Integer) null);  // illegal [68]\n" + 
20636
			"            l.add((Object []) null); // illegal [69]\n" + 
20637
			"            l.add((Integer []) null); // illegal [70]\n" + 
20638
			"            l.add((Integer [][]) null); // illegal [71]\n" + 
20639
			" \n" + 
20640
			"            foo(l); // List<? super Object[]> - illegal [72]\n" + 
20641
			"            foo2(l); // List<Object[]> - illegal [73]\n" + 
20642
			"            foo3(l); // List<? extends Object[]> - illegal [74]\n" + 
20643
			"            bar(l); // List<? super Object> - illegal [75]\n" + 
20644
			"            bar2(l); // List<Object> - illegal [76]\n" + 
20645
			"            bar3(l); // List<? extends Object> - legal [77]\n" + 
20646
			"            bar4(l); // List<?> - legal [78]\n" + 
20647
			"        }\n" + 
20648
			"        {   // same as ? extends Object.\n" + 
20649
			"            List<?> l = new ArrayList<Object>();\n" + 
20650
			"            l.add(l.get(0));  // illegal [79]\n" + 
20651
			"            l.add((Object) null);  // illegal [80]\n" + 
20652
			"            l.add((Integer) null);  // illegal [81]\n" + 
20653
			"            l.add((Object []) null); // illegal [82]\n" + 
20654
			"            l.add((Integer []) null); // illegal [83]\n" + 
20655
			"            l.add((Integer [][]) null); // illegal [84]\n" + 
20656
			" \n" + 
20657
			"            foo(l); // List<? super Object[]> - illegal [85]\n" + 
20658
			"            foo2(l); // List<Object[]> - illegal [86]\n" + 
20659
			"            foo3(l); // List<? extends Object[]> - illegal [87]\n" + 
20660
			"            bar(l); // List<? super Object> - illegal [88]\n" + 
20661
			"            bar2(l); // List<Object> - illegal [89]\n" + 
20662
			"            bar3(l); // List<? extends Object> - legal [90]\n" + 
20663
			"            bar4(l); // List<?> - legal [91]\n" + 
20664
			"        }\n" + 
20665
			"    }\n" + 
20666
			"}\n",
20667
		},
20668
		"----------\n" + 
20669
		"1. ERROR in X.java (at line 21)\n" + 
20670
		"	l.add(l.get(0));  // illegal [01]\n" + 
20671
		"	  ^^^\n" + 
20672
		"The method add(capture-of ? super Object[]) in the type List<capture-of ? super Object[]> is not applicable for the arguments (capture-of ? super Object[])\n" + 
20673
		"----------\n" + 
20674
		"2. ERROR in X.java (at line 22)\n" + 
20675
		"	l.add((Object) null);  // illegal [02]\n" + 
20676
		"	  ^^^\n" + 
20677
		"The method add(capture-of ? super Object[]) in the type List<capture-of ? super Object[]> is not applicable for the arguments (Object)\n" + 
20678
		"----------\n" + 
20679
		"3. ERROR in X.java (at line 23)\n" + 
20680
		"	l.add((Integer) null);  // illegal [03]\n" + 
20681
		"	  ^^^\n" + 
20682
		"The method add(capture-of ? super Object[]) in the type List<capture-of ? super Object[]> is not applicable for the arguments (Integer)\n" + 
20683
		"----------\n" + 
20684
		"4. ERROR in X.java (at line 24)\n" + 
20685
		"	l.add((Object []) null); // illegal [04]\n" + 
20686
		"	  ^^^\n" + 
20687
		"The method add(capture-of ? super Object[]) in the type List<capture-of ? super Object[]> is not applicable for the arguments (Object[])\n" + 
20688
		"----------\n" + 
20689
		"5. ERROR in X.java (at line 25)\n" + 
20690
		"	l.add((Integer []) null); // illegal [05]\n" + 
20691
		"	  ^^^\n" + 
20692
		"The method add(capture-of ? super Object[]) in the type List<capture-of ? super Object[]> is not applicable for the arguments (Integer[])\n" + 
20693
		"----------\n" + 
20694
		"6. ERROR in X.java (at line 26)\n" + 
20695
		"	l.add((Integer [][]) null); // illegal [06]\n" + 
20696
		"	  ^^^\n" + 
20697
		"The method add(capture-of ? super Object[]) in the type List<capture-of ? super Object[]> is not applicable for the arguments (Integer[][])\n" + 
20698
		"----------\n" + 
20699
		"7. ERROR in X.java (at line 28)\n" + 
20700
		"	foo(l); // List<? super Object[]> - legal [07]\n" + 
20701
		"	^^^\n" + 
20702
		"The method foo(List<? super Object[]>) in the type X is not applicable for the arguments (List<capture-of ? super Object[]>)\n" + 
20703
		"----------\n" + 
20704
		"8. ERROR in X.java (at line 29)\n" + 
20705
		"	foo2(l); // List<Object[]> - illegal [08]\n" + 
20706
		"	^^^^\n" + 
20707
		"The method foo2(List<Object[]>) in the type X is not applicable for the arguments (List<capture-of ? super Object[]>)\n" + 
20708
		"----------\n" + 
20709
		"9. ERROR in X.java (at line 30)\n" + 
20710
		"	foo3(l); // List<? extends Object[]> - illegal [09]\n" + 
20711
		"	^^^^\n" + 
20712
		"The method foo3(List<? extends Object[]>) in the type X is not applicable for the arguments (List<capture-of ? super Object[]>)\n" + 
20713
		"----------\n" + 
20714
		"10. ERROR in X.java (at line 31)\n" + 
20715
		"	bar(l); // List<? super Object> - illegal [10]\n" + 
20716
		"	^^^\n" + 
20717
		"The method bar(List<? super Object>) in the type X is not applicable for the arguments (List<capture-of ? super Object[]>)\n" + 
20718
		"----------\n" + 
20719
		"11. ERROR in X.java (at line 32)\n" + 
20720
		"	bar2(l); // List<Object> - illegal [11]\n" + 
20721
		"	^^^^\n" + 
20722
		"The method bar2(List<Object>) in the type X is not applicable for the arguments (List<capture-of ? super Object[]>)\n" + 
20723
		"----------\n" + 
20724
		"12. ERROR in X.java (at line 39)\n" + 
20725
		"	l.add((Object) null);  // illegal [15]\n" + 
20726
		"	  ^^^\n" + 
20727
		"The method add(Object[]) in the type List<Object[]> is not applicable for the arguments (Object)\n" + 
20728
		"----------\n" + 
20729
		"13. ERROR in X.java (at line 40)\n" + 
20730
		"	l.add((Integer) null);  // illegal [16]\n" + 
20731
		"	  ^^^\n" + 
20732
		"The method add(Object[]) in the type List<Object[]> is not applicable for the arguments (Integer)\n" + 
20733
		"----------\n" + 
20734
		"14. ERROR in X.java (at line 48)\n" + 
20735
		"	bar(l); // List<? super Object> - illegal [23]\n" + 
20736
		"	^^^\n" + 
20737
		"The method bar(List<? super Object>) in the type X is not applicable for the arguments (List<Object[]>)\n" + 
20738
		"----------\n" + 
20739
		"15. ERROR in X.java (at line 49)\n" + 
20740
		"	bar2(l); // List<Object> - illegal [24]\n" + 
20741
		"	^^^^\n" + 
20742
		"The method bar2(List<Object>) in the type X is not applicable for the arguments (List<Object[]>)\n" + 
20743
		"----------\n" + 
20744
		"16. ERROR in X.java (at line 55)\n" + 
20745
		"	l.add(l.get(0));  // illegal [27]\n" + 
20746
		"	  ^^^\n" + 
20747
		"The method add(capture-of ? extends Object[]) in the type List<capture-of ? extends Object[]> is not applicable for the arguments (capture-of ? extends Object[])\n" + 
20748
		"----------\n" + 
20749
		"17. ERROR in X.java (at line 56)\n" + 
20750
		"	l.add((Object) null);  // illegal [28]\n" + 
20751
		"	  ^^^\n" + 
20752
		"The method add(capture-of ? extends Object[]) in the type List<capture-of ? extends Object[]> is not applicable for the arguments (Object)\n" + 
20753
		"----------\n" + 
20754
		"18. ERROR in X.java (at line 57)\n" + 
20755
		"	l.add((Integer) null);  // illegal [29]\n" + 
20756
		"	  ^^^\n" + 
20757
		"The method add(capture-of ? extends Object[]) in the type List<capture-of ? extends Object[]> is not applicable for the arguments (Integer)\n" + 
20758
		"----------\n" + 
20759
		"19. ERROR in X.java (at line 58)\n" + 
20760
		"	l.add((Object []) null); // illegal [30]\n" + 
20761
		"	  ^^^\n" + 
20762
		"The method add(capture-of ? extends Object[]) in the type List<capture-of ? extends Object[]> is not applicable for the arguments (Object[])\n" + 
20763
		"----------\n" + 
20764
		"20. ERROR in X.java (at line 59)\n" + 
20765
		"	l.add((Integer []) null); // illegal [31]\n" + 
20766
		"	  ^^^\n" + 
20767
		"The method add(capture-of ? extends Object[]) in the type List<capture-of ? extends Object[]> is not applicable for the arguments (Integer[])\n" + 
20768
		"----------\n" + 
20769
		"21. ERROR in X.java (at line 60)\n" + 
20770
		"	l.add((Integer [][]) null); // illegal [32]\n" + 
20771
		"	  ^^^\n" + 
20772
		"The method add(capture-of ? extends Object[]) in the type List<capture-of ? extends Object[]> is not applicable for the arguments (Integer[][])\n" + 
20773
		"----------\n" + 
20774
		"22. ERROR in X.java (at line 62)\n" + 
20775
		"	foo(l); // List<? super Object[]> - illegal [33]\n" + 
20776
		"	^^^\n" + 
20777
		"The method foo(List<? super Object[]>) in the type X is not applicable for the arguments (List<capture-of ? extends Object[]>)\n" + 
20778
		"----------\n" + 
20779
		"23. ERROR in X.java (at line 63)\n" + 
20780
		"	foo2(l); // List<Object[]> - illegal [34]\n" + 
20781
		"	^^^^\n" + 
20782
		"The method foo2(List<Object[]>) in the type X is not applicable for the arguments (List<capture-of ? extends Object[]>)\n" + 
20783
		"----------\n" + 
20784
		"24. ERROR in X.java (at line 65)\n" + 
20785
		"	bar(l); // List<? super Object> - illegal [36]\n" + 
20786
		"	^^^\n" + 
20787
		"The method bar(List<? super Object>) in the type X is not applicable for the arguments (List<capture-of ? extends Object[]>)\n" + 
20788
		"----------\n" + 
20789
		"25. ERROR in X.java (at line 66)\n" + 
20790
		"	bar2(l); // List<Object> - illegal [37]\n" + 
20791
		"	^^^^\n" + 
20792
		"The method bar2(List<Object>) in the type X is not applicable for the arguments (List<capture-of ? extends Object[]>)\n" + 
20793
		"----------\n" + 
20794
		"26. ERROR in X.java (at line 75)\n" + 
20795
		"	l.add((Object []) null); // illegal [43]\n" + 
20796
		"	  ^^^\n" + 
20797
		"The method add(capture-of ? super Object) in the type List<capture-of ? super Object> is not applicable for the arguments (Object[])\n" + 
20798
		"----------\n" + 
20799
		"27. ERROR in X.java (at line 76)\n" + 
20800
		"	l.add((Integer []) null); // illegal [44]\n" + 
20801
		"	  ^^^\n" + 
20802
		"The method add(capture-of ? super Object) in the type List<capture-of ? super Object> is not applicable for the arguments (Integer[])\n" + 
20803
		"----------\n" + 
20804
		"28. ERROR in X.java (at line 77)\n" + 
20805
		"	l.add((Integer [][]) null); // illegal [45]\n" + 
20806
		"	  ^^^\n" + 
20807
		"The method add(capture-of ? super Object) in the type List<capture-of ? super Object> is not applicable for the arguments (Integer[][])\n" + 
20808
		"----------\n" + 
20809
		"29. ERROR in X.java (at line 79)\n" + 
20810
		"	foo(l); // legal [46]\n" + 
20811
		"	^^^\n" + 
20812
		"The method foo(List<? super Object[]>) in the type X is not applicable for the arguments (List<capture-of ? super Object>)\n" + 
20813
		"----------\n" + 
20814
		"30. ERROR in X.java (at line 80)\n" + 
20815
		"	foo2(l); // illegal [47]\n" + 
20816
		"	^^^^\n" + 
20817
		"The method foo2(List<Object[]>) in the type X is not applicable for the arguments (List<capture-of ? super Object>)\n" + 
20818
		"----------\n" + 
20819
		"31. ERROR in X.java (at line 81)\n" + 
20820
		"	foo3(l); // illegal [48]\n" + 
20821
		"	^^^^\n" + 
20822
		"The method foo3(List<? extends Object[]>) in the type X is not applicable for the arguments (List<capture-of ? super Object>)\n" + 
20823
		"----------\n" + 
20824
		"32. ERROR in X.java (at line 83)\n" + 
20825
		"	bar2(l); // illegal [50]\n" + 
20826
		"	^^^^\n" + 
20827
		"The method bar2(List<Object>) in the type X is not applicable for the arguments (List<capture-of ? super Object>)\n" + 
20828
		"----------\n" + 
20829
		"33. ERROR in X.java (at line 98)\n" + 
20830
		"	foo2(l); // illegal [60]\n" + 
20831
		"	^^^^\n" + 
20832
		"The method foo2(List<Object[]>) in the type X is not applicable for the arguments (List<Object>)\n" + 
20833
		"----------\n" + 
20834
		"34. ERROR in X.java (at line 99)\n" + 
20835
		"	foo3(l); // illegal [61]\n" + 
20836
		"	^^^^\n" + 
20837
		"The method foo3(List<? extends Object[]>) in the type X is not applicable for the arguments (List<Object>)\n" + 
20838
		"----------\n" + 
20839
		"35. ERROR in X.java (at line 107)\n" + 
20840
		"	l.add(l.get(0));  // illegal [66]\n" + 
20841
		"	  ^^^\n" + 
20842
		"The method add(capture-of ? extends Object) in the type List<capture-of ? extends Object> is not applicable for the arguments (capture-of ? extends Object)\n" + 
20843
		"----------\n" + 
20844
		"36. ERROR in X.java (at line 108)\n" + 
20845
		"	l.add((Object) null);  // illegal [67]\n" + 
20846
		"	  ^^^\n" + 
20847
		"The method add(capture-of ? extends Object) in the type List<capture-of ? extends Object> is not applicable for the arguments (Object)\n" + 
20848
		"----------\n" + 
20849
		"37. ERROR in X.java (at line 109)\n" + 
20850
		"	l.add((Integer) null);  // illegal [68]\n" + 
20851
		"	  ^^^\n" + 
20852
		"The method add(capture-of ? extends Object) in the type List<capture-of ? extends Object> is not applicable for the arguments (Integer)\n" + 
20853
		"----------\n" + 
20854
		"38. ERROR in X.java (at line 110)\n" + 
20855
		"	l.add((Object []) null); // illegal [69]\n" + 
20856
		"	  ^^^\n" + 
20857
		"The method add(capture-of ? extends Object) in the type List<capture-of ? extends Object> is not applicable for the arguments (Object[])\n" + 
20858
		"----------\n" + 
20859
		"39. ERROR in X.java (at line 111)\n" + 
20860
		"	l.add((Integer []) null); // illegal [70]\n" + 
20861
		"	  ^^^\n" + 
20862
		"The method add(capture-of ? extends Object) in the type List<capture-of ? extends Object> is not applicable for the arguments (Integer[])\n" + 
20863
		"----------\n" + 
20864
		"40. ERROR in X.java (at line 112)\n" + 
20865
		"	l.add((Integer [][]) null); // illegal [71]\n" + 
20866
		"	  ^^^\n" + 
20867
		"The method add(capture-of ? extends Object) in the type List<capture-of ? extends Object> is not applicable for the arguments (Integer[][])\n" + 
20868
		"----------\n" + 
20869
		"41. ERROR in X.java (at line 114)\n" + 
20870
		"	foo(l); // List<? super Object[]> - illegal [72]\n" + 
20871
		"	^^^\n" + 
20872
		"The method foo(List<? super Object[]>) in the type X is not applicable for the arguments (List<capture-of ? extends Object>)\n" + 
20873
		"----------\n" + 
20874
		"42. ERROR in X.java (at line 115)\n" + 
20875
		"	foo2(l); // List<Object[]> - illegal [73]\n" + 
20876
		"	^^^^\n" + 
20877
		"The method foo2(List<Object[]>) in the type X is not applicable for the arguments (List<capture-of ? extends Object>)\n" + 
20878
		"----------\n" + 
20879
		"43. ERROR in X.java (at line 116)\n" + 
20880
		"	foo3(l); // List<? extends Object[]> - illegal [74]\n" + 
20881
		"	^^^^\n" + 
20882
		"The method foo3(List<? extends Object[]>) in the type X is not applicable for the arguments (List<capture-of ? extends Object>)\n" + 
20883
		"----------\n" + 
20884
		"44. ERROR in X.java (at line 117)\n" + 
20885
		"	bar(l); // List<? super Object> - illegal [75]\n" + 
20886
		"	^^^\n" + 
20887
		"The method bar(List<? super Object>) in the type X is not applicable for the arguments (List<capture-of ? extends Object>)\n" + 
20888
		"----------\n" + 
20889
		"45. ERROR in X.java (at line 118)\n" + 
20890
		"	bar2(l); // List<Object> - illegal [76]\n" + 
20891
		"	^^^^\n" + 
20892
		"The method bar2(List<Object>) in the type X is not applicable for the arguments (List<capture-of ? extends Object>)\n" + 
20893
		"----------\n" + 
20894
		"46. ERROR in X.java (at line 124)\n" + 
20895
		"	l.add(l.get(0));  // illegal [79]\n" + 
20896
		"	  ^^^\n" + 
20897
		"The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (capture-of ?)\n" + 
20898
		"----------\n" + 
20899
		"47. ERROR in X.java (at line 125)\n" + 
20900
		"	l.add((Object) null);  // illegal [80]\n" + 
20901
		"	  ^^^\n" + 
20902
		"The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (Object)\n" + 
20903
		"----------\n" + 
20904
		"48. ERROR in X.java (at line 126)\n" + 
20905
		"	l.add((Integer) null);  // illegal [81]\n" + 
20906
		"	  ^^^\n" + 
20907
		"The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (Integer)\n" + 
20908
		"----------\n" + 
20909
		"49. ERROR in X.java (at line 127)\n" + 
20910
		"	l.add((Object []) null); // illegal [82]\n" + 
20911
		"	  ^^^\n" + 
20912
		"The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (Object[])\n" + 
20913
		"----------\n" + 
20914
		"50. ERROR in X.java (at line 128)\n" + 
20915
		"	l.add((Integer []) null); // illegal [83]\n" + 
20916
		"	  ^^^\n" + 
20917
		"The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (Integer[])\n" + 
20918
		"----------\n" + 
20919
		"51. ERROR in X.java (at line 129)\n" + 
20920
		"	l.add((Integer [][]) null); // illegal [84]\n" + 
20921
		"	  ^^^\n" + 
20922
		"The method add(capture-of ?) in the type List<capture-of ?> is not applicable for the arguments (Integer[][])\n" + 
20923
		"----------\n" + 
20924
		"52. ERROR in X.java (at line 131)\n" + 
20925
		"	foo(l); // List<? super Object[]> - illegal [85]\n" + 
20926
		"	^^^\n" + 
20927
		"The method foo(List<? super Object[]>) in the type X is not applicable for the arguments (List<capture-of ?>)\n" + 
20928
		"----------\n" + 
20929
		"53. ERROR in X.java (at line 132)\n" + 
20930
		"	foo2(l); // List<Object[]> - illegal [86]\n" + 
20931
		"	^^^^\n" + 
20932
		"The method foo2(List<Object[]>) in the type X is not applicable for the arguments (List<capture-of ?>)\n" + 
20933
		"----------\n" + 
20934
		"54. ERROR in X.java (at line 133)\n" + 
20935
		"	foo3(l); // List<? extends Object[]> - illegal [87]\n" + 
20936
		"	^^^^\n" + 
20937
		"The method foo3(List<? extends Object[]>) in the type X is not applicable for the arguments (List<capture-of ?>)\n" + 
20938
		"----------\n" + 
20939
		"55. ERROR in X.java (at line 134)\n" + 
20940
		"	bar(l); // List<? super Object> - illegal [88]\n" + 
20941
		"	^^^\n" + 
20942
		"The method bar(List<? super Object>) in the type X is not applicable for the arguments (List<capture-of ?>)\n" + 
20943
		"----------\n" + 
20944
		"56. ERROR in X.java (at line 135)\n" + 
20945
		"	bar2(l); // List<Object> - illegal [89]\n" + 
20946
		"	^^^^\n" + 
20947
		"The method bar2(List<Object>) in the type X is not applicable for the arguments (List<capture-of ?>)\n" + 
20948
		"----------\n");
20949
}	
20950
public void test0668() {
20951
	this.runConformTest(
20952
		new String[] {
20953
			"X.java",
20954
			"import java.util.List;\n" + 
20955
			" \n" + 
20956
			"public class X {\n" + 
20957
			"    void foo(List<? super Object[]> l) {\n" + 
20958
			"        l.add(new Object[0]);\n" + 
20959
			"    }\n" + 
20960
			"}\n",
20961
		},
20962
		"");
20963
}	
20964
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95289
20965
public void test0669() {
20966
	this.runConformTest(
20967
		new String[] {
20968
			"X.java",
20969
			"import java.util.*;\n" + 
20970
			"\n" + 
20971
			"public class X {\n" + 
20972
			"private static<T> int indexOf(final T[] array,final T elem) {\n" + 
20973
			"	return 0;\n" + 
20974
			"}\n" + 
20975
			"public static void meth(AContainer ac, AInfo[] aiArray) {\n" + 
20976
			"  for(AInfo ai: aiArray) {\n" + 
20977
			"	int index1 = indexOf(ac.getAs(),ai.a);\n" + 
20978
			"	int index2 = indexOf(ac.getAs(),ai); // ai.class!=ai.a.class!!!\n" + 
20979
			"  }\n" + 
20980
			"}\n" + 
20981
			"}\n" + 
20982
			"\n" + 
20983
			"class AContainer {\n" + 
20984
			"   public A[] getAs(){ return null; }\n" + 
20985
			"}\n" + 
20986
			"\n" + 
20987
			"class AInfo {\n" + 
20988
			"   public A a;\n" + 
20989
			"}\n" + 
20990
			"\n" + 
20991
			"class A {\n" + 
20992
			"}\n",
20993
		},
20994
		"");
20995
}	
20996
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95021 (ensure not even a warning)
20997
// **
20998
public void test0670() {
20999
	this.runConformTest(
21000
		new String[] {
21001
			"X.java",
21002
			"import java.util.Map;\n" + 
21003
			"\n" + 
21004
			"interface MethodProperty<ActualType extends MethodProperty<ActualType>> {\n" + 
21005
			"	public void copyFrom(ActualType other);\n" + 
21006
			"}\n" + 
21007
			"\n" + 
21008
			"class MethodPropertyDatabase<Property extends MethodProperty<Property>> {\n" + 
21009
			"	Map<String, Property> propertyMap;\n" + 
21010
			"	\n" + 
21011
			"	void read(String fileName) {\n" + 
21012
			"	}\n" + 
21013
			"}\n" + 
21014
			"\n" + 
21015
			"class FooProperty implements MethodProperty<FooProperty> {\n" + 
21016
			"	String value;\n" + 
21017
			"\n" + 
21018
			"	public void copyFrom(FooProperty other) {\n" + 
21019
			"		this.value = other.value;\n" + 
21020
			"	}\n" + 
21021
			"}\n" + 
21022
			"\n" + 
21023
			"class FooPropertyDatabase extends MethodPropertyDatabase<FooProperty> {\n" + 
21024
			"}\n" + 
21025
			"\n" + 
21026
			"public class X {\n" + 
21027
			"	FooPropertyDatabase fooDatabase;\n" + 
21028
			"	\n" + 
21029
			"	public void readDatabase() {\n" + 
21030
			"		FooPropertyDatabase database = new FooPropertyDatabase();\n" + 
21031
			"		\n" + 
21032
			"		fooDatabase = readDatabase(database, \"foodatabase.db\"); // Bug reported on this line\n" + 
21033
			"	}\n" + 
21034
			"	\n" + 
21035
			"	private<\n" + 
21036
			"		Property extends MethodProperty<Property>,\n" + 
21037
			"		DatabaseType extends MethodPropertyDatabase<Property>\n" + 
21038
			"		> DatabaseType readDatabase(DatabaseType database, String fileName) {\n" + 
21039
			"			database.read(fileName);\n" + 
21040
			"			return database;\n" + 
21041
			"		}\n" + 
21042
			"	\n" + 
21043
			"}\n",
21044
		},
21045
		"");
21046
}	
21047
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95021 - variation: ensure not even a warning
21048
public void test0671() {
21049
	this.runNegativeTest(
21050
		new String[] {
21051
			"X.java",
21052
			"import java.util.Map;\n" + 
21053
			"\n" + 
21054
			"interface MethodProperty<ActualType extends MethodProperty<ActualType>> {\n" + 
21055
			"	public void copyFrom(ActualType other);\n" + 
21056
			"}\n" + 
21057
			"\n" + 
21058
			"class MethodPropertyDatabase<Property extends MethodProperty<Property>> {\n" + 
21059
			"	Map<String, Property> propertyMap;\n" + 
21060
			"	\n" + 
21061
			"	void read(String fileName) {\n" + 
21062
			"	}\n" + 
21063
			"}\n" + 
21064
			"\n" + 
21065
			"class FooProperty implements MethodProperty<FooProperty> {\n" + 
21066
			"	String value;\n" + 
21067
			"\n" + 
21068
			"	public void copyFrom(FooProperty other) {\n" + 
21069
			"		this.value = other.value;\n" + 
21070
			"	}\n" + 
21071
			"}\n" + 
21072
			"\n" + 
21073
			"class FooPropertyDatabase extends MethodPropertyDatabase<FooProperty> {\n" + 
21074
			"}\n" + 
21075
			"\n" + 
21076
			"public class X {\n" + 
21077
			"  Zork z;\n" +
21078
			"	FooPropertyDatabase fooDatabase;\n" + 
21079
			"	\n" + 
21080
			"	public void readDatabase() {\n" + 
21081
			"		FooPropertyDatabase database = new FooPropertyDatabase();\n" + 
21082
			"		\n" + 
21083
			"		fooDatabase = readDatabase(database, \"foodatabase.db\"); // Bug reported on this line\n" + 
21084
			"	}\n" + 
21085
			"	\n" + 
21086
			"	private<\n" + 
21087
			"		Property extends MethodProperty<Property>,\n" + 
21088
			"		DatabaseType extends MethodPropertyDatabase<Property>\n" + 
21089
			"		> DatabaseType readDatabase(DatabaseType database, String fileName) {\n" + 
21090
			"			database.read(fileName);\n" + 
21091
			"			return database;\n" + 
21092
			"		}\n" + 
21093
			"	\n" + 
21094
			"}\n",
21095
		},
21096
		"----------\n" + 
21097
		"1. ERROR in X.java (at line 26)\n" + 
21098
		"	Zork z;\n" + 
21099
		"	^^^^\n" + 
21100
		"Zork cannot be resolved to a type\n" + 
21101
		"----------\n");
21102
}	
21103
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95021 - variation: ensure not even a warning
21104
public void test0672() {
21105
	this.runNegativeTest(
21106
		new String[] {
21107
			"X.java",
21108
			"interface Foo<T extends Foo<T>> {\n" + 
21109
			"}\n" + 
21110
			"\n" + 
21111
			"class Bar<Q> {\n" + 
21112
			"}\n" + 
21113
			"\n" + 
21114
			"\n" + 
21115
			"public class X {\n" + 
21116
			"	Zork z;\n" +
21117
			"	void readDatabase() {\n" + 
21118
			"		Bar<Foo> bar = new Bar<Foo>();\n" + 
21119
			"		read(bar, \"sadasd\");\n" + 
21120
			"	}\n" + 
21121
			"	\n" + 
21122
			"	<P extends Foo<P>, D extends Bar<P>> \n" + 
21123
			"	D read(D d, String s) {\n" + 
21124
			"			return d;\n" + 
21125
			"	}\n" + 
21126
			"}\n",
21127
		},
21128
		"----------\n" + 
21129
		"1. ERROR in X.java (at line 9)\n" + 
21130
		"	Zork z;\n" + 
21131
		"	^^^^\n" + 
21132
		"Zork cannot be resolved to a type\n" + 
21133
		"----------\n" + 
21134
		"2. WARNING in X.java (at line 11)\n" + 
21135
		"	Bar<Foo> bar = new Bar<Foo>();\n" + 
21136
		"	    ^^^\n" + 
21137
		"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
21138
		"----------\n" + 
21139
		"3. WARNING in X.java (at line 11)\n" + 
21140
		"	Bar<Foo> bar = new Bar<Foo>();\n" + 
21141
		"	                       ^^^\n" + 
21142
		"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
21143
		"----------\n" + 
21144
		"4. WARNING in X.java (at line 12)\n" + 
21145
		"	read(bar, \"sadasd\");\n" + 
21146
		"	^^^^^^^^^^^^^^^^^^^\n" + 
21147
		"Type safety: Unchecked invocation read(Bar<Foo>, String) of the generic method read(D, String) of type X\n" + 
21148
		"----------\n");
21149
}	
21150
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95638 
21151
public void test0673() {
21152
	this.runConformTest(
21153
		new String[] {
21154
			"X.java",
21155
			"import java.util.List;\n" + 
21156
			"\n" + 
21157
			"class Key<E, F extends Type<E, F>> {\n" + 
21158
			"}\n" + 
21159
			"\n" + 
21160
			"class State<S extends State> {\n" + 
21161
			"}\n" + 
21162
			"\n" + 
21163
			"class Type<T, U extends Type<T, U>> {\n" + 
21164
			"}\n" + 
21165
			"\n" + 
21166
			"class Store<A, B extends Type<A, B>, C extends Key<A, B>, D extends State<D>> {\n" + 
21167
			"}\n" + 
21168
			"\n" + 
21169
			"public class X<K> {\n" + 
21170
			"	List<Store<K, ?, ? extends Key<K, ?>, ? extends State<?>>> stores;\n" + 
21171
			"}\n",
21172
		},
21173
		"");
21174
}	
21175
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95638 - variation
21176
public void test0674() {
21177
	this.runConformTest(
21178
		new String[] {
21179
			"X.java",
21180
			"class Key<E extends Key<E>> {}\n" + 
21181
			"class Store<F extends Key<F>> {}\n" + 
21182
			"\n" + 
21183
			"public class X<T extends Key<T>> {\n" + 
21184
			"	Store<? extends Key<T>> store;\n" + 
21185
			"}\n",
21186
		},
21187
		"");
21188
}	
21189
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95638 - variation
21190
public void test0675() {
21191
	this.runNegativeTest(
21192
		new String[] {
21193
			"X.java",
21194
			"class Key<E extends Key<E>> {}\n" + 
21195
			"class Store<F extends Key<F>> {}\n" + 
21196
			"\n" + 
21197
			"public class X<T> {\n" + 
21198
			"	Store<? extends Key<T>> store1;\n" + 
21199
			"	Store<? extends Key<? extends T>> store2;\n" + 
21200
			"}\n",
21201
		},
21202
		"----------\n" + 
21203
		"1. ERROR in X.java (at line 5)\n" + 
21204
		"	Store<? extends Key<T>> store1;\n" + 
21205
		"	                    ^\n" + 
21206
		"Bound mismatch: The type T is not a valid substitute for the bounded parameter <E extends Key<E>> of the type Key<E>\n" + 
21207
		"----------\n" + 
21208
		"2. ERROR in X.java (at line 6)\n" + 
21209
		"	Store<? extends Key<? extends T>> store2;\n" + 
21210
		"	                    ^^^^^^^^^^^\n" + 
21211
		"Bound mismatch: The type ? extends T is not a valid substitute for the bounded parameter <E extends Key<E>> of the type Key<E>\n" + 
21212
		"----------\n");
21213
}	
21214
//check fault tolerance, in spite of bound mismatch, still pass param type for further resolving message send
21215
public void test0676() {
21216
	this.runNegativeTest(
21217
		new String[] {
21218
			"X.java",
21219
			"public class X<T extends Throwable> {\n" + 
21220
			"	T get() { return null; }\n" + 
21221
			"	\n" + 
21222
			"	void foo(X<String> xs) {\n" + 
21223
			"		xs.get().printStackTrace();\n" + 
21224
			"	}\n" + 
21225
			"}\n",
21226
		},
21227
		"----------\n" + 
21228
		"1. ERROR in X.java (at line 4)\n" + 
21229
		"	void foo(X<String> xs) {\n" + 
21230
		"	           ^^^^^^\n" + 
21231
		"Bound mismatch: The type String is not a valid substitute for the bounded parameter <T extends Throwable> of the type X<T>\n" + 
21232
		"----------\n" + 
21233
		"2. ERROR in X.java (at line 5)\n" + 
21234
		"	xs.get().printStackTrace();\n" + 
21235
		"	         ^^^^^^^^^^^^^^^\n" + 
21236
		"The method printStackTrace() is undefined for the type String\n" + 
21237
		"----------\n");
21238
}	
21239
public void test0677() {
21240
	this.runNegativeTest(
21241
		new String[] {
21242
			"X.java",
21243
			"import java.util.*;\n" + 
21244
			"public class X {\n" + 
21245
			"	public static void main(String[] args) {\n" + 
21246
			"		{\n" + 
21247
			"			ArrayList<Number> arrayList = new ArrayList<Integer>(); // compile error\n" + 
21248
			"			Number number = arrayList.get(0);\n" + 
21249
			"		}\n" + 
21250
			"		{\n" + 
21251
			"			ArrayList<? extends Number> arrayList = new ArrayList<Integer>(); //correct\n" + 
21252
			"			Number number = arrayList.get(0);\n" + 
21253
			"		}\n" + 
21254
			"		{\n" + 
21255
			"			ArrayList<? super Integer> arrayList = new ArrayList<Number>();\n" + 
21256
			"			Object number = arrayList.get(0); //returns java.lang.Object\n" + 
21257
			"		}\n" + 
21258
			"	}\n" + 
21259
			"}\n",
21260
		},
21261
		"----------\n" + 
21262
		"1. ERROR in X.java (at line 5)\n" + 
21263
		"	ArrayList<Number> arrayList = new ArrayList<Integer>(); // compile error\n" + 
21264
		"	                              ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
21265
		"Type mismatch: cannot convert from ArrayList<Integer> to ArrayList<Number>\n" + 
21266
		"----------\n");
21267
}	
21268
public void test0678() {
21269
	this.runNegativeTest(
21270
		new String[] {
21271
			"X.java",
21272
			"import java.io.Serializable;\n" + 
21273
			"\n" + 
21274
			"public class X<T, T2 extends T & Serializable > {\n" + 
21275
			"	\n" + 
21276
			"	X<Object, Serializable> right1;\n" + 
21277
			"	X<String, Serializable> wrong1;\n" + 
21278
			"	X<Y, Y> right2;\n" + 
21279
			"	\n" + 
21280
			"	static class Y implements Serializable {\n" + 
21281
			"	}\n" + 
21282
			"}\n",
21283
		},
21284
		"----------\n" + 
21285
		"1. ERROR in X.java (at line 3)\n" + 
21286
		"	public class X<T, T2 extends T & Serializable > {\n" + 
21287
		"	                                 ^^^^^^^^^^^^\n" + 
21288
		"Cannot specify any additional bound Serializable when first bound is a type parameter\n" + 
21289
		"----------\n" + 
21290
		"2. ERROR in X.java (at line 6)\n" + 
21291
		"	X<String, Serializable> wrong1;\n" + 
21292
		"	          ^^^^^^^^^^^^\n" + 
21293
		"Bound mismatch: The type Serializable is not a valid substitute for the bounded parameter <T2 extends T & Serializable> of the type X<T,T2>\n" + 
21294
		"----------\n" + 
21295
		"3. WARNING in X.java (at line 9)\n" + 
21296
		"	static class Y implements Serializable {\n" + 
21297
		"	             ^\n" + 
21298
		"The serializable class Y does not declare a static final serialVersionUID field of type long\n" + 
21299
		"----------\n");
21300
}	
21301
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95638 - variation
21302
public void test0679() {
21303
	this.runConformTest(
21304
		new String[] {
21305
			"X.java",
21306
			"class Key<E, F extends Key<E, F>> {}\n" + 
21307
			"class Store<A, B extends Key<A, B>> {}\n" + 
21308
			"\n" + 
21309
			"public class X<K extends Key<?, K>> {\n" + 
21310
			"	Store<K, ? extends Key<K, ?>> store;\n" + 
21311
			"}\n",
21312
		},
21313
		"");
21314
}	
21315
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95638 - variation
21316
public void test0680() {
21317
	this.runConformTest(
21318
		new String[] {
21319
			"X.java",
21320
			"import java.util.List;\n" + 
21321
			"\n" + 
21322
			"class Key<E, F extends Type<E, F, G, H>, G extends Key<E, F, G, H>, H extends State<H>> {}\n" + 
21323
			"class State<S extends State> {}\n" + 
21324
			"class Type<T, U extends Type<T, U, V, W>, V extends Key<T, U, V, W>, W extends State<W>> {}\n" + 
21325
			"class Store<A, B extends Type<A, B, C, D>, C extends Key<A, B, C, D>, D extends State<D>> {}\n" + 
21326
			"\n" + 
21327
			"public class X<K extends Key<K, ?,?,?>> {\n" + 
21328
			"	List<Store<K, ?, ? extends Key<K, ?, ?, ?>, ? extends State<?>>> stores;\n" + 
21329
			"}\n",
21330
		},
21331
		"");
21332
}	
21333
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95638 - variation
21334
public void test0681() {
21335
	this.runConformTest(
21336
		new String[] {
21337
			"X.java",
21338
			"class Key<E, K extends Key<E, K>> {\n" + 
21339
			"}\n" + 
21340
			"class Store<E, K extends Key<E, K>> {\n" + 
21341
			"}\n" + 
21342
			"class X<E> {\n" + 
21343
			"	Store<E, ?> store1;\n" + 
21344
			"	Store<E, ? extends Key<E, ?>> store2;\n" + 
21345
			"\n" + 
21346
			"	class StoreHolder <F extends Key<E, F>> {\n" + 
21347
			"		Store<E, F> store;\n" + 
21348
			"	}\n" + 
21349
			"}\n" + 
21350
			"class Y<T, U extends Y<T, U>> {\n" + 
21351
			"	Y<?, ?> y;\n" + 
21352
			"}\n",
21353
		},
21354
		"");
21355
}	
21356
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95963
21357
public void test0682() {
21358
	this.runNegativeTest(
21359
		new String[] {
21360
			"X.java",
21361
			"class X extends A<X.M> {}\n" + 
21362
			"class A<T> {}\n"
21363
		},
21364
		"----------\n" + 
21365
		"1. ERROR in X.java (at line 1)\n" + 
21366
		"	class X extends A<X.M> {}\n" + 
21367
		"	                  ^^^\n" + 
21368
		"X.M cannot be resolved to a type\n" + 
21369
		"----------\n"
21370
	);
21371
}
21372
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=96085
21373
public void test0683() {
21374
	this.runConformTest(
21375
		new String[] {
21376
			"P.java",
21377
			"public interface P<V> {\n" + 
21378
			"    interface A {}\n" + 
21379
			"}\n",
21380
			"P2.java",
21381
			"public class P2 implements P.A {\n" + 
21382
			"    P2(P.A problem) {}\n" + 
21383
			"}\n",
21384
			"P3.java",
21385
			"public class P3 {\n" + 
21386
			"    void test() {P.A o = new P2((P.A) null);}\n" + 
21387
			"}\n",
21388
		},
21389
		"");
21390
	this.runConformTest(
21391
		new String[] {
21392
			"P3.java",
21393
			"class P3 {\n" + 
21394
			"    void test() {P.A o = new P2((P.A) null);}\n" + 
21395
			"}\n",
21396
		},
21397
		"",
21398
		null,
21399
		false,
21400
		null);
21401
}
21402
public void test0684() {
21403
	this.runNegativeTest(
21404
		new String[] {
21405
			"X.java",
21406
			"public class X<T> {\n" + 
21407
			"	<U> U foo(U u1, U u2) {\n" + 
21408
			"		return u1;\n" + 
21409
			"	}\n" + 
21410
			"	void bar(X<? extends Throwable> x1, X<? extends Runnable> x2) {\n" + 
21411
			"		X<String> x = foo(x1, x2);\n" + 
21412
			"	}\n" + 
21413
			"}\n",
21414
		},
21415
		"----------\n" + 
21416
		"1. ERROR in X.java (at line 6)\n" + 
21417
		"	X<String> x = foo(x1, x2);\n" + 
21418
		"	              ^^^^^^^^^^^\n" + 
21419
		"Type mismatch: cannot convert from X<capture#3-of ? extends Object> to X<String>\n" + 
21420
		"----------\n");
21421
}	
21422
public void test0685() {
21423
	this.runNegativeTest(
21424
		new String[] {
21425
			"X.java",
21426
			"public class X<T> {\n" + 
21427
			"	<U> U foo(U u1, U u2) {\n" + 
21428
			"		return u1;\n" + 
21429
			"	}\n" + 
21430
			"	void bar(X<? extends Throwable> x1, X<? extends Runnable> x2) {\n" + 
21431
			"		X<String> x = foo(x1, x2);\n" + 
21432
			"	}\n" + 
21433
			"}\n",
21434
		},
21435
		"----------\n" + 
21436
		"1. ERROR in X.java (at line 6)\n" + 
21437
		"	X<String> x = foo(x1, x2);\n" + 
21438
		"	              ^^^^^^^^^^^\n" + 
21439
		"Type mismatch: cannot convert from X<capture#3-of ? extends Object> to X<String>\n" + 
21440
		"----------\n");
21441
}	
21442
// check wildcard bounds wrt variable boundCheck
21443
public void test0686() {
21444
	this.runNegativeTest(
21445
		new String[] {
21446
			"X.java",
21447
			"import java.util.List;\n" + 
21448
			"class Other<T extends List<? extends Runnable>> {\n" + 
21449
			"}\n" + 
21450
			"\n" + 
21451
			"public class X {\n" + 
21452
			"	Other<? extends List<? extends Throwable>> other1;\n" + 
21453
			"	Other<? extends List<? super String>> other2;	\n" + 
21454
			"	Other<? extends List<? extends String>> other3;		\n" + 
21455
			"	Other<? extends List<? extends Runnable>> other7 = other1;\n" + 
21456
			"}\n",
21457
		},
21458
		"----------\n" + 
21459
		"1. ERROR in X.java (at line 7)\n" + 
21460
		"	Other<? extends List<? super String>> other2;	\n" + 
21461
		"	      ^^^^^^^^^^^^^^\n" + 
21462
		"Bound mismatch: The type ? extends List<? super String> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21463
		"----------\n" + 
21464
		"2. ERROR in X.java (at line 8)\n" + 
21465
		"	Other<? extends List<? extends String>> other3;		\n" + 
21466
		"	      ^^^^^^^^^^^^^^\n" + 
21467
		"Bound mismatch: The type ? extends List<? extends String> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21468
		"----------\n");
21469
}
21470
// check wildcard bounds wrt variable boundCheck
21471
public void test0687() {
21472
	this.runNegativeTest(
21473
		new String[] {
21474
			"X.java",
21475
			"import java.util.List;\n" + 
21476
			"class Other<T extends List<? extends Runnable>> {\n" + 
21477
			"}\n" + 
21478
			"\n" + 
21479
			"public class X {\n" + 
21480
			"	Other<? extends List<?>> other2;\n" + 
21481
			"	Other<? extends List<? super Throwable>> other3;\n" + 
21482
			"	Other<? super List<? extends Throwable>> other4;\n" + 
21483
			"	Other<? super List<?>> other5;\n" + 
21484
			"	Other<? super List<? super Throwable>> other6;\n" + 
21485
			"}\n",
21486
		},
21487
		"----------\n" + 
21488
		"1. ERROR in X.java (at line 7)\n" + 
21489
		"	Other<? extends List<? super Throwable>> other3;\n" + 
21490
		"	      ^^^^^^^^^^^^^^\n" + 
21491
		"Bound mismatch: The type ? extends List<? super Throwable> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21492
		"----------\n" + 
21493
		"2. ERROR in X.java (at line 8)\n" + 
21494
		"	Other<? super List<? extends Throwable>> other4;\n" + 
21495
		"	      ^^^^^^^^^^^^\n" + 
21496
		"Bound mismatch: The type ? super List<? extends Throwable> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21497
		"----------\n" + 
21498
		"3. ERROR in X.java (at line 9)\n" + 
21499
		"	Other<? super List<?>> other5;\n" + 
21500
		"	      ^^^^^^^^^^^^\n" + 
21501
		"Bound mismatch: The type ? super List<?> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21502
		"----------\n" + 
21503
		"4. ERROR in X.java (at line 10)\n" + 
21504
		"	Other<? super List<? super Throwable>> other6;\n" + 
21505
		"	      ^^^^^^^^^^^^\n" + 
21506
		"Bound mismatch: The type ? super List<? super Throwable> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21507
		"----------\n");
21508
}
21509
// check wildcard bounds wrt variable boundCheck
21510
public void test0688() {
21511
	this.runConformTest(
21512
		new String[] {
21513
			"X.java",
21514
			"import java.util.List;\n" + 
21515
			"class Other<T extends List<? extends Runnable>> {\n" + 
21516
			"}\n" + 
21517
			"\n" + 
21518
			"public class X {\n" + 
21519
			"	Other<? super List<? extends Runnable>> other5;\n" + 
21520
			"}\n",
21521
		},
21522
		"");
21523
}
21524
// check wildcard bounds wrt variable boundCheck
21525
public void test0689() {
21526
	this.runNegativeTest(
21527
		new String[] {
21528
			"X.java",
21529
			"import java.util.List;\n" + 
21530
			"class Other<T extends List<? extends Runnable>> {\n" + 
21531
			"}\n" + 
21532
			"\n" + 
21533
			"public class X {\n" + 
21534
			"	Other<? super List<? super Runnable>> other5;\n" + 
21535
			"}\n",
21536
		},
21537
		"----------\n" + 
21538
		"1. ERROR in X.java (at line 6)\n" + 
21539
		"	Other<? super List<? super Runnable>> other5;\n" + 
21540
		"	      ^^^^^^^^^^^^\n" + 
21541
		"Bound mismatch: The type ? super List<? super Runnable> is not a valid substitute for the bounded parameter <T extends List<? extends Runnable>> of the type Other<T>\n" + 
21542
		"----------\n");
21543
}
21544
// check assignment rules across param types with wildcards
21545
public void test0690() {
21546
	this.runNegativeTest(
21547
		new String[] {
21548
			"X.java",
21549
			"import java.util.List;\n" + 
21550
			"public class X {\n" + 
21551
			"	void foo(List<? extends Runnable> lr, List<?> la) {\n" + 
21552
			"		lr = la;\n" + 
21553
			"		la = lr;\n" + 
21554
			"	}\n" + 
21555
			"}         \n" + 
21556
			"\n",
21557
		},
21558
		"----------\n" + 
21559
		"1. ERROR in X.java (at line 4)\n" + 
21560
		"	lr = la;\n" + 
21561
		"	     ^^\n" + 
21562
		"Type mismatch: cannot convert from List<capture#2-of ?> to List<? extends Runnable>\n" + 
21563
		"----------\n");
21564
}
21565
// check that final class bound is more restrictive
21566
public void test0691() {
21567
	this.runNegativeTest(
21568
		new String[] {
21569
			"XX.java",
21570
			"public class XX<T extends Runnable> {\n" + 
21571
			"	void foo(XX<?> lhs, XX<? extends String> rhs) {\n" + 
21572
			"		lhs = rhs;\n" + 
21573
			"	}\n" + 
21574
			"}\n",
21575
		},
21576
		"----------\n" + 
21577
		"1. ERROR in XX.java (at line 2)\n" + 
21578
		"	void foo(XX<?> lhs, XX<? extends String> rhs) {\n" + 
21579
		"	                       ^^^^^^^^^^^^^^^^\n" + 
21580
		"Bound mismatch: The type ? extends String is not a valid substitute for the bounded parameter <T extends Runnable> of the type XX<T>\n" + 
21581
		"----------\n");
21582
}
21583
// check wildcard bounds wrt variable boundCheck
21584
public void test0692() {
21585
	this.runNegativeTest(
21586
		new String[] {
21587
			"X.java",
21588
			"import java.util.List;\n" + 
21589
			"\n" + 
21590
			"public class X<T extends List<Object>> {\n" + 
21591
			"	\n" + 
21592
			"	void foo(X<? extends List<String>> x) {\n" + 
21593
			"	}\n" + 
21594
			"}\n",
21595
		},
21596
		"----------\n" + 
21597
		"1. ERROR in X.java (at line 5)\n" + 
21598
		"	void foo(X<? extends List<String>> x) {\n" + 
21599
		"	           ^^^^^^^^^^^^^^\n" + 
21600
		"Bound mismatch: The type ? extends List<String> is not a valid substitute for the bounded parameter <T extends List<Object>> of the type X<T>\n" + 
21601
		"----------\n");
21602
}	
21603
// bound checks
21604
public void test0693() {
21605
	this.runNegativeTest(
21606
		new String[] {
21607
			"X.java",
21608
			"public class X<T extends Runnable> {\n" + 
21609
			"	X<X<String>> x1;\n" + 
21610
			"	X<? extends String> x2;\n" + 
21611
			"}\n",
21612
		},
21613
		"----------\n" + 
21614
		"1. ERROR in X.java (at line 2)\n" + 
21615
		"	X<X<String>> x1;\n" + 
21616
		"	  ^\n" + 
21617
		"Bound mismatch: The type X<String> is not a valid substitute for the bounded parameter <T extends Runnable> of the type X<T>\n" + 
21618
		"----------\n" + 
21619
		"2. ERROR in X.java (at line 2)\n" + 
21620
		"	X<X<String>> x1;\n" + 
21621
		"	    ^^^^^^\n" + 
21622
		"Bound mismatch: The type String is not a valid substitute for the bounded parameter <T extends Runnable> of the type X<T>\n" + 
21623
		"----------\n" + 
21624
		"3. ERROR in X.java (at line 3)\n" + 
21625
		"	X<? extends String> x2;\n" + 
21626
		"	  ^^^^^^^^^^^^^^^^\n" + 
21627
		"Bound mismatch: The type ? extends String is not a valid substitute for the bounded parameter <T extends Runnable> of the type X<T>\n" + 
21628
		"----------\n");
21629
}	
21630
// bound checks
21631
public void test0694() {
21632
	this.runNegativeTest(
21633
		new String[] {
21634
			"X.java",
21635
			"public class X<T extends X<T>> {\n" + 
21636
			"	X<X<X<String>>> x1;\n" + 
21637
			"	X<? extends X<? extends X<String>>> x2;\n" + 
21638
			"}\n",
21639
		},
21640
		"----------\n" + 
21641
		"1. ERROR in X.java (at line 2)\n" + 
21642
		"	X<X<X<String>>> x1;\n" + 
21643
		"	  ^\n" + 
21644
		"Bound mismatch: The type X<X<String>> is not a valid substitute for the bounded parameter <T extends X<T>> of the type X<T>\n" + 
21645
		"----------\n" + 
21646
		"2. ERROR in X.java (at line 2)\n" + 
21647
		"	X<X<X<String>>> x1;\n" + 
21648
		"	    ^\n" + 
21649
		"Bound mismatch: The type X<String> is not a valid substitute for the bounded parameter <T extends X<T>> of the type X<T>\n" + 
21650
		"----------\n" + 
21651
		"3. ERROR in X.java (at line 2)\n" + 
21652
		"	X<X<X<String>>> x1;\n" + 
21653
		"	      ^^^^^^\n" + 
21654
		"Bound mismatch: The type String is not a valid substitute for the bounded parameter <T extends X<T>> of the type X<T>\n" + 
21655
		"----------\n" + 
21656
		"4. ERROR in X.java (at line 3)\n" + 
21657
		"	X<? extends X<? extends X<String>>> x2;\n" + 
21658
		"	  ^^^^^^^^^^^\n" + 
21659
		"Bound mismatch: The type ? extends X<? extends X<String>> is not a valid substitute for the bounded parameter <T extends X<T>> of the type X<T>\n" + 
21660
		"----------\n" + 
21661
		"5. ERROR in X.java (at line 3)\n" + 
21662
		"	X<? extends X<? extends X<String>>> x2;\n" + 
21663
		"	              ^^^^^^^^^^^\n" + 
21664
		"Bound mismatch: The type ? extends X<String> is not a valid substitute for the bounded parameter <T extends X<T>> of the type X<T>\n" + 
21665
		"----------\n" + 
21666
		"6. ERROR in X.java (at line 3)\n" + 
21667
		"	X<? extends X<? extends X<String>>> x2;\n" + 
21668
		"	                          ^^^^^^\n" + 
21669
		"Bound mismatch: The type String is not a valid substitute for the bounded parameter <T extends X<T>> of the type X<T>\n" + 
21670
		"----------\n");
21671
}	
21672
// bound checks
21673
public void test0695() {
21674
	this.runConformTest(
21675
		new String[] {
21676
			"I.java",
21677
			"interface I<T extends I<? extends T>> {\n" + 
21678
			"}\n",
21679
		},
21680
		"");
21681
}
21682
public void test0696() {
21683
	this.runNegativeTest(
21684
		new String[] {
21685
			"X.java",
21686
			"class Key<E extends Key<E>> {}\n" + 
21687
			"class Store<F extends Key<F>> {}\n" + 
21688
			"\n" + 
21689
			"public class X<T> {\n" + 
21690
			"	Store<? extends Key<T>> store = new Store<Key<T>>();\n" + 
21691
			"}\n",
21692
		},
21693
		"----------\n" + 
21694
		"1. ERROR in X.java (at line 5)\n" + 
21695
		"	Store<? extends Key<T>> store = new Store<Key<T>>();\n" + 
21696
		"	                    ^\n" + 
21697
		"Bound mismatch: The type T is not a valid substitute for the bounded parameter <E extends Key<E>> of the type Key<E>\n" + 
21698
		"----------\n" + 
21699
		"2. ERROR in X.java (at line 5)\n" + 
21700
		"	Store<? extends Key<T>> store = new Store<Key<T>>();\n" + 
21701
		"	                                          ^^^\n" + 
21702
		"Bound mismatch: The type Key<T> is not a valid substitute for the bounded parameter <F extends Key<F>> of the type Store<F>\n" + 
21703
		"----------\n" + 
21704
		"3. ERROR in X.java (at line 5)\n" + 
21705
		"	Store<? extends Key<T>> store = new Store<Key<T>>();\n" + 
21706
		"	                                              ^\n" + 
21707
		"Bound mismatch: The type T is not a valid substitute for the bounded parameter <E extends Key<E>> of the type Key<E>\n" + 
21708
		"----------\n");
21709
}
21710
public void test0697() {
21711
	this.runConformTest(
21712
		new String[] {
21713
			"X.java",
21714
			"import java.util.List;\n" + 
21715
			"public class X<U, V extends List<U>> {\n" + 
21716
			"	V v;\n" + 
21717
			"	\n" + 
21718
			"	void foo(X<String, ?> x1, X<Object, ?> x2) {\n" + 
21719
			"		String s =x1.v.get(0);\n" + 
21720
			"		Object o = x2.v.get(0);\n" + 
21721
			"		\n" + 
21722
			"	}\n" + 
21723
			"}\n",
21724
		},
21725
		"");
21726
}
21727
public void test0698() {
21728
	this.runNegativeTest(
21729
		new String[] {
21730
			"X.java",
21731
			"import java.util.List;\n" + 
21732
			"\n" + 
21733
			"public class X<U extends List<Object>, V extends List<String>> {\n" + 
21734
			"	\n" + 
21735
			"	X<? super Exception, ? super Exception> x;\n" + 
21736
			"}\n",
21737
		},
21738
		"----------\n" + 
21739
		"1. ERROR in X.java (at line 5)\n" + 
21740
		"	X<? super Exception, ? super Exception> x;\n" + 
21741
		"	  ^^^^^^^^^^^^^^^^^\n" + 
21742
		"Bound mismatch: The type ? super Exception is not a valid substitute for the bounded parameter <U extends List<Object>> of the type X<U,V>\n" + 
21743
		"----------\n" + 
21744
		"2. ERROR in X.java (at line 5)\n" + 
21745
		"	X<? super Exception, ? super Exception> x;\n" + 
21746
		"	                     ^^^^^^^^^^^^^^^^^\n" + 
21747
		"Bound mismatch: The type ? super Exception is not a valid substitute for the bounded parameter <V extends List<String>> of the type X<U,V>\n" + 
21748
		"----------\n");
21749
}
21750
public void test0699() {
21751
	this.runNegativeTest(
21752
		new String[] {
21753
			"X2.java",
21754
			"import java.util.List;\n" + 			
21755
			"class Other2<T extends List< Runnable>> {\n" + 
21756
			"}\n" + 
21757
			"\n" + 
21758
			"class X2 {\n" + 
21759
			"	Other2<? extends List<Throwable>> other1;\n" + 
21760
			"	Other2<? extends List<? super String>> other2;	\n" + 
21761
			"	Other2<? extends List<? extends String>> other3;		\n" + 
21762
			"	Other2<? extends List<? extends Runnable>> other7 = other1;\n" + 
21763
			"}\n",
21764
		},
21765
		"----------\n" + 
21766
		"1. ERROR in X2.java (at line 6)\n" + 
21767
		"	Other2<? extends List<Throwable>> other1;\n" + 
21768
		"	       ^^^^^^^^^^^^^^\n" + 
21769
		"Bound mismatch: The type ? extends List<Throwable> is not a valid substitute for the bounded parameter <T extends List<Runnable>> of the type Other2<T>\n" + 
21770
		"----------\n" + 
21771
		"2. ERROR in X2.java (at line 7)\n" + 
21772
		"	Other2<? extends List<? super String>> other2;	\n" + 
21773
		"	       ^^^^^^^^^^^^^^\n" + 
21774
		"Bound mismatch: The type ? extends List<? super String> is not a valid substitute for the bounded parameter <T extends List<Runnable>> of the type Other2<T>\n" + 
21775
		"----------\n" + 
21776
		"3. ERROR in X2.java (at line 8)\n" + 
21777
		"	Other2<? extends List<? extends String>> other3;		\n" + 
21778
		"	       ^^^^^^^^^^^^^^\n" + 
21779
		"Bound mismatch: The type ? extends List<? extends String> is not a valid substitute for the bounded parameter <T extends List<Runnable>> of the type Other2<T>\n" + 
21780
		"----------\n");
21781
}
21782
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=96646
21783
public void test0700() {
21784
	this.runConformTest(
21785
		new String[] {
21786
			"X.java",
21787
			"abstract class BaseFactory<T> {\n" + 
21788
			"	public T create() throws Exception {\n" + 
21789
			"		return getType().newInstance();\n" + 
21790
			"	}\n" + 
21791
			"	public abstract Class<T> getType();\n" + 
21792
			"}\n" + 
21793
			"interface StringFactory {\n" + 
21794
			"	public String create() throws Exception;\n" + 
21795
			"}\n" + 
21796
			"public class X extends BaseFactory<String> implements StringFactory {\n" + 
21797
			"	@Override\n" + 
21798
			"	public Class<String> getType() {\n" + 
21799
			"		return String.class;\n" + 
21800
			"	}\n" + 
21801
			"	public static void main(String[] args) throws Exception {\n" + 
21802
			"		String emptyString = new X().create();\n" + 
21803
			"		System.out.printf(\"SUCCESS\");\n" + 
21804
			"	}\n" + 
21805
			"}\n",
21806
		},
21807
		"SUCCESS");
21808
}
21809
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97303
21810
public void test0701() {
21811
	this.runNegativeTest(
21812
		new String[] {
21813
			"X.java",
21814
			"import java.util.Arrays;\n" + 
21815
			"import java.util.List;\n" + 
21816
			"\n" + 
21817
			"class Deejay {\n" + 
21818
			"	class Counter<T> {}\n" + 
21819
			"\n" + 
21820
			"	Counter<Song> songCounter = new Counter<Song>();\n" + 
21821
			"	Counter<Genre> genreCounter = new Counter<Genre>();\n" + 
21822
			"\n" + 
21823
			"	List<Counter<?>> list1 = Arrays.asList(songCounter, genreCounter);\n" + 
21824
			"	List<Counter<? extends Object>> list2 = Arrays.asList(songCounter, genreCounter);\n" + 
21825
			"	List<Counter<?>> list3 = Arrays.<Counter<?>>asList(songCounter, genreCounter);\n" + 
21826
			"	List<Counter<?>> list4 = Arrays.asList(new Counter<?>[] {songCounter, genreCounter});\n" + 
21827
			"	List<Counter<? extends String>> list5 = Arrays.asList(songCounter, genreCounter);\n" + 
21828
			"}\n" + 
21829
			"class Genre {}\n" +
21830
			"class Song {}\n",
21831
		},
21832
		"----------\n" + 
21833
		"1. WARNING in X.java (at line 10)\n" + 
21834
		"	List<Counter<?>> list1 = Arrays.asList(songCounter, genreCounter);\n" + 
21835
		"	                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
21836
		"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" + 
21837
		"----------\n" + 
21838
		"2. WARNING in X.java (at line 11)\n" + 
21839
		"	List<Counter<? extends Object>> list2 = Arrays.asList(songCounter, genreCounter);\n" + 
21840
		"	                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
21841
		"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" + 
21842
		"----------\n" + 
21843
		"3. ERROR in X.java (at line 14)\n" + 
21844
		"	List<Counter<? extends String>> list5 = Arrays.asList(songCounter, genreCounter);\n" + 
21845
		"	                                ^^^^^\n" + 
21846
		"Type mismatch: cannot convert from List<Deejay.Counter<? extends Object>> to List<Deejay.Counter<? extends String>>\n" + 
21847
		"----------\n" + 
21848
		"4. WARNING in X.java (at line 14)\n" + 
21849
		"	List<Counter<? extends String>> list5 = Arrays.asList(songCounter, genreCounter);\n" + 
21850
		"	                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
21851
		"Type safety : A generic array of Deejay.Counter<? extends Object> is created for a varargs parameter\n" + 
21852
		"----------\n");
21853
}
21854
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97303 - variation
21855
public void test0702() {
21856
	this.runNegativeTest(
21857
		new String[] {
21858
			"X.java",
21859
			"public class X<T extends Runnable> implements Runnable {\n" + 
21860
			"	\n" + 
21861
			"	void foo0(X<X<?>> lhs, X<X<? extends Runnable>> rhs) {\n" + 
21862
			"		lhs = rhs; // 0\n" + 
21863
			"	}\n" + 
21864
			"	void foo1(X<X<?>> lhs, X<X<? extends Object>> rhs) {\n" + 
21865
			"		lhs = rhs; // 1\n" + // TODO (philippe) should be ok using capture rules for equivalence
21866
			"	}\n" + 
21867
			"	void foo2(X<X<? extends Cloneable>> lhs, X<X<? extends Object>> rhs) {\n" + 
21868
			"		lhs = rhs; // 2\n" + 
21869
			"	}\n" + 
21870
			"	void foo3(X<X<? extends Runnable>> lhs, X<X<? extends Object>> rhs) {\n" + 
21871
			"		lhs = rhs; // 3\n" + 
21872
			"	}\n" + 
21873
			"	void foo4(X<X<? extends Runnable>> lhs, X<X<?>> rhs) {\n" + 
21874
			"		lhs = rhs; // 4\n" + 
21875
			"	}\n" + 
21876
			"	void foo5(X<X<?>> lhs, X<X<? extends Cloneable>> rhs) {\n" + 
21877
			"		lhs = rhs; // 5\n" + 
21878
			"	}\n" + 
21879
			"	void foo6(X<X<X<X<X<?>>>>> lhs, X<X<X<X<X<? extends Runnable>>>>> rhs) {\n" + 
21880
			"		lhs = rhs; // 6\n" + 
21881
			"	}	\n" + 
21882
			"	public void run() {\n" + 
21883
			"	}\n" + 
21884
			"}\n",
21885
		},
21886
		"----------\n" + 
21887
		"1. ERROR in X.java (at line 7)\n" + 
21888
		"	lhs = rhs; // 1\n" + 
21889
		"	      ^^^\n" + 
21890
		"Type mismatch: cannot convert from X<X<? extends Object>> to X<X<?>>\n" + 
21891
		"----------\n" + 
21892
		"2. ERROR in X.java (at line 10)\n" + 
21893
		"	lhs = rhs; // 2\n" + 
21894
		"	      ^^^\n" + 
21895
		"Type mismatch: cannot convert from X<X<? extends Object>> to X<X<? extends Cloneable>>\n" + 
21896
		"----------\n" + 
21897
		"3. ERROR in X.java (at line 13)\n" + 
21898
		"	lhs = rhs; // 3\n" + 
21899
		"	      ^^^\n" + 
21900
		"Type mismatch: cannot convert from X<X<? extends Object>> to X<X<? extends Runnable>>\n" + 
21901
		"----------\n" + 
21902
		"4. ERROR in X.java (at line 19)\n" + 
21903
		"	lhs = rhs; // 5\n" + 
21904
		"	      ^^^\n" + 
21905
		"Type mismatch: cannot convert from X<X<? extends Cloneable>> to X<X<?>>\n" + 
21906
		"----------\n");
21907
}
21908
public void test0703() {
21909
	this.runConformTest(
21910
		new String[] {
21911
			"X.java",
21912
			"public class X<T extends X<T>> {}\n" + 
21913
			"class Y extends X<Y> {\n" + 
21914
			"    X<?> p = (Y)null;\n" + 
21915
			"}\n",
21916
		},
21917
		"");
21918
}
21919
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97800
21920
public void test0704() {
21921
	this.runNegativeTest(
21922
		new String[] {
21923
			"X.java",
21924
			"import java.util.*;\n" + 
21925
			"public class X {\n" + 
21926
			"		 public static void main(String[] args) {\n" + 
21927
			"		 		 List<String> l = (List<String>)Collections.emptyList();\n" + 
21928
			"		 }	 \n" + 
21929
			"}\n",
21930
		},
21931
		"----------\n" + 
21932
		"1. ERROR in X.java (at line 4)\n" + 
21933
		"	List<String> l = (List<String>)Collections.emptyList();\n" + 
21934
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
21935
		"Cannot cast from List<Object> to List<String>\n" + 
21936
		"----------\n");
21937
}
21938
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97480
21939
public void test0705() {
21940
	this.runNegativeTest(
21941
		new String[] {
21942
			"X.java",
21943
			"import java.util.*;\n" + 
21944
			"\n" + 
21945
			"public class X {\n" + 
21946
			"  void f(Object o){\n" + 
21947
			"		 ((Map.Entry)o).setValue(\"bug\");\n" + 
21948
			"		 		 \n" + 
21949
			"		 Map.Entry me= (Map.Entry)o; \n" + 
21950
			"		 me.setValue(\"ok\");\n" + 
21951
			"		 		 \n" + 
21952
			"		 ((Vector)o).add(\"ok\");\n" + 
21953
			"  }\n" + 
21954
			" Zork z;\n" +
21955
			"}\n",
21956
		},
21957
		"----------\n" + 
21958
		"1. WARNING in X.java (at line 5)\n" + 
21959
		"	((Map.Entry)o).setValue(\"bug\");\n" + 
21960
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
21961
		"Type safety: The method setValue(Object) belongs to the raw type Map.Entry. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
21962
		"----------\n" + 
21963
		"2. WARNING in X.java (at line 5)\n" + 
21964
		"	((Map.Entry)o).setValue(\"bug\");\n" + 
21965
		"	  ^^^^^^^^^\n" + 
21966
		"Map.Entry is a raw type. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
21967
		"----------\n" + 
21968
		"3. WARNING in X.java (at line 7)\n" + 
21969
		"	Map.Entry me= (Map.Entry)o; \n" + 
21970
		"	^^^^^^^^^\n" + 
21971
		"Map.Entry is a raw type. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
21972
		"----------\n" + 
21973
		"4. WARNING in X.java (at line 7)\n" + 
21974
		"	Map.Entry me= (Map.Entry)o; \n" + 
21975
		"	               ^^^^^^^^^\n" + 
21976
		"Map.Entry is a raw type. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
21977
		"----------\n" + 
21978
		"5. WARNING in X.java (at line 8)\n" + 
21979
		"	me.setValue(\"ok\");\n" + 
21980
		"	^^^^^^^^^^^^^^^^^\n" + 
21981
		"Type safety: The method setValue(Object) belongs to the raw type Map.Entry. References to generic type Map<K,V>.Entry<K,V> should be parameterized\n" + 
21982
		"----------\n" + 
21983
		"6. WARNING in X.java (at line 10)\n" + 
21984
		"	((Vector)o).add(\"ok\");\n" + 
21985
		"	^^^^^^^^^^^^^^^^^^^^^\n" + 
21986
		"Type safety: The method add(Object) belongs to the raw type Vector. References to generic type Vector<E> should be parameterized\n" + 
21987
		"----------\n" + 
21988
		"7. WARNING in X.java (at line 10)\n" + 
21989
		"	((Vector)o).add(\"ok\");\n" + 
21990
		"	  ^^^^^^\n" + 
21991
		"Vector is a raw type. References to generic type Vector<E> should be parameterized\n" + 
21992
		"----------\n" + 
21993
		"8. ERROR in X.java (at line 12)\n" + 
21994
		"	Zork z;\n" + 
21995
		"	^^^^\n" + 
21996
		"Zork cannot be resolved to a type\n" + 
21997
		"----------\n");
21998
}
21999
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22000
public void test0706() {
22001
	this.runConformTest(
22002
		new String[] {
22003
			"X.java",
22004
			"public class X {\n" + 
22005
			"	void foo() {\n" + 
22006
			"		BB bb = new BB();\n" + 
22007
			"		bb.<Object>test();\n" + 
22008
			"		((AA<CC>) bb).test();\n" + 
22009
			"	}\n" + 
22010
			"}\n" + 
22011
			"class AA<T> { AA<Object> test() {return null;} }\n" + 
22012
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22013
			"class CC {}\n",
22014
		},
22015
		""
22016
	);
22017
}
22018
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22019
public void test0706a() {
22020
	this.runNegativeTest(
22021
		new String[] {
22022
			"X.java",
22023
			"public class X {\n" + 
22024
			"	void foo() {\n" + 
22025
			"		BB bb = new BB();\n" + 
22026
			"		AA<Object> res1 = bb.test();\n" + 
22027
			"		AA res3 = bb.test();\n" + 
22028
			"	}\n" + 
22029
			"}\n" + 
22030
			"class AA<T> { AA<Object> test() {return null;} }\n" + 
22031
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22032
			"class CC {}\n",
22033
		},
22034
		"----------\n" + 
22035
		"1. ERROR in X.java (at line 4)\n" + 
22036
		"	AA<Object> res1 = bb.test();\n" + 
22037
		"	                     ^^^^\n" + 
22038
		"The method test() is ambiguous for the type BB\n" + 
22039
		"----------\n" + 
22040
		"2. WARNING in X.java (at line 5)\n" + 
22041
		"	AA res3 = bb.test();\n" + 
22042
		"	^^\n" + 
22043
		"AA is a raw type. References to generic type AA<T> should be parameterized\n" + 
22044
		"----------\n" + 
22045
		"3. ERROR in X.java (at line 5)\n" + 
22046
		"	AA res3 = bb.test();\n" + 
22047
		"	             ^^^^\n" + 
22048
		"The method test() is ambiguous for the type BB\n" + 
22049
		"----------\n"
22050
		// 4: reference to test is ambiguous, both method test() in AA<CC> and method <U>test() in BB match
22051
		// 5: reference to test is ambiguous, both method test() in AA<CC> and method <U>test() in BB match
22052
	);
22053
}
22054
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97219
22055
public void test0706b() {
22056
	this.runNegativeTest(
22057
		new String[] {
22058
			"X.java",
22059
			"public class X {\n" + 
22060
			"	void foo() {\n" + 
22061
			"		BB bb = new BB();\n" + 
22062
			"		AA<CC> res = bb.test();\n" + 
22063
			"		BB res2 = bb.test();\n" + 
22064
			"	}\n" + 
22065
			"}\n" + 
22066
			"class AA<T> { AA<Object> test() {return null;} }\n" + 
22067
			"class BB extends AA<CC> { <U> BB test() {return null;} }\n" + 
22068
			"class CC {}\n",
22069
		},
22070
		"----------\n" + 
22071
		"1. ERROR in X.java (at line 4)\n" + 
22072
		"	AA<CC> res = bb.test();\n" + 
22073
		"	                ^^^^\n" + 
22074
		"The method test() is ambiguous for the type BB\n" + 
22075
		"----------\n" + 
22076
		"2. ERROR in X.java (at line 5)\n" + 
22077
		"	BB res2 = bb.test();\n" + 
22078
		"	             ^^^^\n" + 
22079
		"The method test() is ambiguous for the type BB\n" + 
22080
		"----------\n"
22081
		// 4: reference to test is ambiguous, both method test() in AA<CC> and method <U>test() in BB match
22082
		// 4: incompatible types on the assignment
22083
		// 5: reference to test is ambiguous, both method test() in AA<CC> and method <U>test() in BB match
22084
		// 5: incompatible types on the assignment
22085
	);
22086
	this.runNegativeTest(
22087
		new String[] {
22088
			"X.java",
22089
			"public class X {\n" + 
22090
			"	void foo() {\n" + 
22091
			"		BB bb = new BB();\n" + 
22092
			"		AA<CC> res = bb.test();\n" + 
22093
			"		BB res2 = bb.test();\n" + 
22094
			"	}\n" + 
22095
			"}\n" + 
22096
			"class AA<T> { AA<Object> test() {return null;} }\n" + 
22097
			"class BB extends AA<CC> { }\n" + 
22098
			"class CC {}\n",
22099
		},
22100
		"----------\n" + 
22101
		"1. ERROR in X.java (at line 4)\n" + 
22102
		"	AA<CC> res = bb.test();\n" + 
22103
		"	             ^^^^^^^^^\n" + 
22104
		"Type mismatch: cannot convert from AA<Object> to AA<CC>\n" + 
22105
		"----------\n" + 
22106
		"2. ERROR in X.java (at line 5)\n" + 
22107
		"	BB res2 = bb.test();\n" + 
22108
		"	          ^^^^^^^^^\n" + 
22109
		"Type mismatch: cannot convert from AA<Object> to BB\n" + 
22110
		"----------\n"
22111
		// incompatible types on both assignments
22112
	);
22113
}
22114
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98079
22115
public void test0707() {
22116
	this.runConformTest(
22117
		new String[] {
22118
			"X.java",
22119
			"public class X<T> {\n" + 
22120
			"\n" + 
22121
			"    B<? extends T> b() {\n" + 
22122
			"        return a();\n" + 
22123
			"    }\n" + 
22124
			"    \n" + 
22125
			"    <U extends T> B<U> a() {\n" + 
22126
			"        return null;\n" + 
22127
			"    }\n" + 
22128
			"    \n" + 
22129
			"    static class B<V> { }\n" + 
22130
			"}\n",
22131
		},
22132
		"");
22133
}
22134
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95684
22135
public void test0708() {
22136
	this.runConformTest(
22137
		new String[] {
22138
			"UserClass.java",
22139
			"public class UserClass<K> {\n" + 
22140
			"    protected class DataHolder {}\n" + 
22141
			"    protected void loadHook(DataHolder data) {}\n" + 
22142
			"}\n",
22143
		},
22144
		"");
22145
	this.runConformTest(
22146
		new String[] {
22147
			"ChildClass.java",
22148
			"public class ChildClass extends UserClass<Object> {\n" + 
22149
			"    @Override protected void loadHook(DataHolder data) {}\n" + 
22150
			"}\n",
22151
		},
22152
		"",
22153
		null,
22154
		false,
22155
		null);	
22156
}
22157
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95684 - variation
22158
public void test0709() {
22159
	this.runConformTest(
22160
		new String[] {
22161
			"UserClass.java",
22162
			"public class UserClass<K> {\n" + 
22163
			"    protected class DataHolder {}\n" + 
22164
			"    protected void loadHook(DataHolder[] data) {}\n" + 
22165
			"}\n",
22166
		},
22167
		"");
22168
	this.runConformTest(
22169
		new String[] {
22170
			"ChildClass.java",
22171
			"public class ChildClass extends UserClass<Object> {\n" + 
22172
			"    @Override protected void loadHook(DataHolder[] data) {}\n" + 
22173
			"}\n",
22174
		},
22175
		"",
22176
		null,
22177
		false,
22178
		null);	
22179
}
22180
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=96713
22181
public void test0710() {
22182
	this.runConformTest(
22183
		new String[] {
22184
			"X.java",
22185
			"public class X {\n" + 
22186
			"	public static <V, P extends Persistent<V>> P createDataObject(V value) {\n" + 
22187
			"		return null;\n" + 
22188
			"	}\n" + 
22189
			"	public static void testCreateDataObject(Object v) {\n" + 
22190
			"		Persistent d = createDataObject(v);\n" + 
22191
			"	}\n" + 
22192
			"\n" + 
22193
			"	private interface Persistent<V> {\n" + 
22194
			"		public V getValueObject();\n" + 
22195
			"	}\n" + 
22196
			"}\n",
22197
		},
22198
		"");
22199
}
22200
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97108
22201
public void test0711(){
22202
	this.runConformTest(
22203
		new String[] {
22204
			"X.java",
22205
			"import java.util.ArrayList;\n" + 
22206
			"import java.util.HashMap;\n" + 
22207
			"import java.util.List;\n" + 
22208
			"import java.util.Map;\n" + 
22209
			"\n" + 
22210
			"public class X<T> {\n" + 
22211
			"	static private Map<String, XX> m1 = new HashMap<String, XX>();\n" + 
22212
			"	private List<XX> m2 = new ArrayList<XX>();\n" + 
22213
			"	static protected XX foo()\n" + 
22214
			"	{\n" + 
22215
			"		return null;\n" + 
22216
			"	}\n" + 
22217
			"	static public abstract class XX<TT>\n" + 
22218
			"	{\n" + 
22219
			"	}\n" + 
22220
			"}\n",
22221
		},
22222
	    "");
22223
	
22224
	this.runConformTest(
22225
		new String[] {
22226
			"Y.java",
22227
			"public class Y extends X<Object>  \n" + 
22228
			"{        \n" + 
22229
			"}\n"
22230
		},
22231
	    "",
22232
	    null,
22233
	    false,
22234
	    null);
22235
}
22236
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97108
22237
// The case that works
22238
public void test0712(){
22239
	this.runConformTest(
22240
		new String[] {
22241
			"X.java",
22242
			"import java.util.ArrayList;\n" + 
22243
			"import java.util.HashMap;\n" + 
22244
			"import java.util.List;\n" + 
22245
			"import java.util.Map;\n" + 
22246
			"\n" + 
22247
			"public class X<T> {\n" + 
22248
			"	static private Map<String, XX> m1 = new HashMap<String, XX>();\n" + 
22249
			"	private List<XX<T>> m2 = new ArrayList<XX<T>>();\n" + 
22250
			"	static protected XX foo()\n" + 
22251
			"	{\n" + 
22252
			"		return null;\n" + 
22253
			"	}\n" + 
22254
			"	static public abstract class XX<TT>\n" + 
22255
			"	{\n" + 
22256
			"	}\n" + 
22257
			"}\n",
22258
		},
22259
        "");
22260
	this.runConformTest(
22261
		new String[] {
22262
			"Y.java",
22263
			"public class Y extends X<Object>  \n" + 
22264
			"{        \n" + 
22265
			"}\n"
22266
		},
22267
        "",
22268
        null,
22269
        false,
22270
        null);
22271
}
22272
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=96713
22273
public void test0713() {
22274
	this.runNegativeTest(
22275
		new String[] {
22276
			"X.java",
22277
			"public class X<T> {\n" + 
22278
			"	int i = 0;\n" + 
22279
			"	interface Y {\n" + 
22280
			"		java.util.List<T> lt = null;\n" + 
22281
			"		int j = i;\n" + 
22282
			"		void m1(T t);		\n" + 
22283
			"	}\n" + 
22284
			"}\n",
22285
		},
22286
		"----------\n" + 
22287
		"1. ERROR in X.java (at line 4)\n" + 
22288
		"	java.util.List<T> lt = null;\n" + 
22289
		"	               ^\n" + 
22290
		"Cannot make a static reference to the non-static type T\n" + 
22291
		"----------\n" + 
22292
		"2. ERROR in X.java (at line 5)\n" + 
22293
		"	int j = i;\n" + 
22294
		"	        ^\n" + 
22295
		"Cannot make a static reference to the non-static field i\n" + 
22296
		"----------\n" + 
22297
		"3. ERROR in X.java (at line 6)\n" + 
22298
		"	void m1(T t);		\n" + 
22299
		"	        ^\n" + 
22300
		"Cannot make a static reference to the non-static type T\n" + 
22301
		"----------\n");
22302
}
22303
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98232
22304
public void test0714() {	
22305
	this.runConformTest(
22306
		new String[] {
22307
			"B.java",
22308
			"import java.util.Map;\n" + 
22309
			"import java.util.Set;\n" + 
22310
			"import java.util.SortedSet;\n" + 
22311
			"\n" + 
22312
			"public class B  {\n" + 
22313
			"	static Set<Map.Entry> foo(SortedSet<Map.Entry> set) {\n" + 
22314
			"		return null;\n" + 
22315
			"	}\n" + 
22316
			"}\n" + 
22317
			"\n",
22318
		},
22319
        "");
22320
	this.runConformTest(
22321
		new String[] {
22322
			"A.java",
22323
			"public class A {\n" + 
22324
			"	A() {\n" + 
22325
			"		B.foo(null);\n" + 
22326
			"	}\n" + 
22327
			"}\n"
22328
		},
22329
        "",
22330
        null,
22331
        false,
22332
        null);
22333
}
22334
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98393
22335
public void test0715() {
22336
	this.runNegativeTest(
22337
		new String[] {
22338
			"X.java",
22339
			"public class X {\n" + 
22340
			"    void foo() {\n" + 
22341
			"    	Comparable<String> c = (java.util.List)bar(5, 5.0);\n" + 
22342
			"    }\n" + 
22343
			"    \n" + 
22344
			"    <T> T bar(T t1, T t2) { return t1; }\n" + 
22345
			"}\n",
22346
		},
22347
		"----------\n" + 
22348
		"1. ERROR in X.java (at line 3)\n" + 
22349
		"	Comparable<String> c = (java.util.List)bar(5, 5.0);\n" + 
22350
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
22351
		"Type mismatch: cannot convert from List to Comparable<String>\n" + 
22352
		"----------\n" + 
22353
		"2. WARNING in X.java (at line 3)\n" + 
22354
		"	Comparable<String> c = (java.util.List)bar(5, 5.0);\n" + 
22355
		"	                        ^^^^^^^^^^^^^^\n" + 
22356
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
22357
		"----------\n");
22358
}
22359
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98396
22360
// **
22361
public void test0716() {
22362
	this.runNegativeTest(
22363
		new String[] {
22364
			"X.java",
22365
			"public class X<T extends Number & Comparable<String>> {\n" + 
22366
			"    void foo(T t) {\n" + 
22367
			"    		 Comparable<Integer> ci = (Comparable<Integer>) t;  \n" + 
22368
			"    }\n" + 
22369
			"}\n",
22370
		},
22371
		"----------\n" + 
22372
		"1. ERROR in X.java (at line 3)\n" + 
22373
		"	Comparable<Integer> ci = (Comparable<Integer>) t;  \n" + 
22374
		"	                         ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
22375
		"Cannot cast from T to Comparable<Integer>\n" + 
22376
		"----------\n");
22377
}
22378
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=98396 - variation
22379
public void test0717() {
22380
	this.runNegativeTest(
22381
		new String[] {
22382
			"X.java",
22383
			"import java.util.List;\n" + 
22384
			"public class X<T extends Comparable<String> & List<Integer>> {\n" + 
22385
			"    void foo(T t) {\n" + 
22386
			"    		 Comparable<Integer> ci = (Comparable<Integer>) t;  \n" + 
22387
			"    }\n" + 
22388
			"}\n",
22389
		},
22390
		"----------\n" + 
22391
		"1. ERROR in X.java (at line 4)\n" + 
22392
		"	Comparable<Integer> ci = (Comparable<Integer>) t;  \n" + 
22393
		"	                         ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
22394
		"Cannot cast from T to Comparable<Integer>\n" + 
22395
		"----------\n");
22396
}
22397
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98478
22398
public void test0718() {
22399
	this.runNegativeTest(
22400
		new String[] {
22401
			"X.java",
22402
			"import java.util.Collections;\n" + 
22403
			"import java.util.Set;\n" + 
22404
			"import java.util.TreeSet;\n" + 
22405
			"\n" + 
22406
			"public class X {\n" + 
22407
			"    \n" + 
22408
			"    public interface Base {\n" + 
22409
			"    }\n" + 
22410
			"    \n" + 
22411
			"    abstract class Action<T extends Base> {\n" + 
22412
			"    }\n" + 
22413
			"\n" + 
22414
			"    public class ActionImpl<T extends Base> extends Action<T> implements Comparable<ActionImpl> {\n" + 
22415
			"        public int compareTo(ActionImpl o) {\n" + 
22416
			"            return 0;\n" + 
22417
			"        }\n" + 
22418
			"    }\n" + 
22419
			"\n" + 
22420
			"    public void test() {\n" + 
22421
			"        Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + 
22422
			"        Collections.max(set);\n" + 
22423
			"    }\n" + 
22424
			"   Zork z;\n" +
22425
			"}\n",
22426
		},
22427
		"----------\n" + 
22428
		"1. WARNING in X.java (at line 13)\n" + 
22429
		"	public class ActionImpl<T extends Base> extends Action<T> implements Comparable<ActionImpl> {\n" + 
22430
		"	                                                                                ^^^^^^^^^^\n" + 
22431
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22432
		"----------\n" + 
22433
		"2. WARNING in X.java (at line 14)\n" + 
22434
		"	public int compareTo(ActionImpl o) {\n" + 
22435
		"	                     ^^^^^^^^^^\n" + 
22436
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22437
		"----------\n" + 
22438
		"3. WARNING in X.java (at line 20)\n" + 
22439
		"	Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + 
22440
		"	    ^^^^^^^^^^\n" + 
22441
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22442
		"----------\n" + 
22443
		"4. WARNING in X.java (at line 20)\n" + 
22444
		"	Set<ActionImpl> set = new TreeSet<ActionImpl>();\n" + 
22445
		"	                                  ^^^^^^^^^^\n" + 
22446
		"X.ActionImpl is a raw type. References to generic type X.ActionImpl<T> should be parameterized\n" + 
22447
		"----------\n" + 
22448
		"5. WARNING in X.java (at line 21)\n" + 
22449
		"	Collections.max(set);\n" + 
22450
		"	^^^^^^^^^^^^^^^^^^^^\n" + 
22451
		"Type safety: Unchecked invocation max(Collection<? extends X.ActionImpl>) of the generic method max(Collection<? extends T>) of type Collections\n" + 
22452
		"----------\n" + 
22453
		"6. ERROR in X.java (at line 23)\n" + 
22454
		"	Zork z;\n" + 
22455
		"	^^^^\n" + 
22456
		"Zork cannot be resolved to a type\n" + 
22457
		"----------\n");
22458
}
22459
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98364
22460
public void test0719() {
22461
	this.runNegativeTest(
22462
		new String[] {
22463
			"X.java",
22464
			"import java.util.Iterator;\n" + 
22465
			"import java.util.ListIterator;\n" + 
22466
			"\n" + 
22467
			"interface IntegerIterator extends Iterator {}\n" + 
22468
			"interface IntegerListIterator extends ListIterator<Integer>, IntegerIterator {}\n" + 
22469
			"\n",
22470
		},
22471
		"----------\n" + 
22472
		"1. WARNING in X.java (at line 4)\n" + 
22473
		"	interface IntegerIterator extends Iterator {}\n" + 
22474
		"	                                  ^^^^^^^^\n" + 
22475
		"Iterator is a raw type. References to generic type Iterator<E> should be parameterized\n" + 
22476
		"----------\n" + 
22477
		"2. ERROR in X.java (at line 5)\n" + 
22478
		"	interface IntegerListIterator extends ListIterator<Integer>, IntegerIterator {}\n" + 
22479
		"	          ^^^^^^^^^^^^^^^^^^^\n" + 
22480
		"The interface Iterator cannot be implemented more than once with different arguments: Iterator and Iterator<Integer>\n" + 
22481
		"----------\n");
22482
}
22483
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98364 - variation
22484
public void test0720() {
22485
	this.runNegativeTest(
22486
		new String[] {
22487
			"X.java",
22488
			"interface Foo<T> {}\n" + 
22489
			"interface Bar extends Foo<Integer> {}\n" + 
22490
			"interface Baz extends Bar, Foo {}\n" + 
22491
			"\n" + 
22492
			"class XSuper implements Foo {}\n" + 
22493
			"class XSub extends XSuper implements Foo<Integer> {}\n" + 
22494
			"\n" + 
22495
			"public class X implements Bar, Foo {}\n",
22496
		},
22497
		"----------\n" + 
22498
		"1. ERROR in X.java (at line 3)\n" + 
22499
		"	interface Baz extends Bar, Foo {}\n" + 
22500
		"	          ^^^\n" + 
22501
		"The interface Foo cannot be implemented more than once with different arguments: Foo and Foo<Integer>\n" + 
22502
		"----------\n" + 
22503
		"2. WARNING in X.java (at line 3)\n" + 
22504
		"	interface Baz extends Bar, Foo {}\n" + 
22505
		"	                           ^^^\n" + 
22506
		"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
22507
		"----------\n" + 
22508
		"3. WARNING in X.java (at line 5)\n" + 
22509
		"	class XSuper implements Foo {}\n" + 
22510
		"	                        ^^^\n" + 
22511
		"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
22512
		"----------\n" + 
22513
		"4. ERROR in X.java (at line 6)\n" + 
22514
		"	class XSub extends XSuper implements Foo<Integer> {}\n" + 
22515
		"	      ^^^^\n" + 
22516
		"The interface Foo cannot be implemented more than once with different arguments: Foo and Foo<Integer>\n" + 
22517
		"----------\n" + 
22518
		"5. ERROR in X.java (at line 8)\n" + 
22519
		"	public class X implements Bar, Foo {}\n" + 
22520
		"	             ^\n" + 
22521
		"The interface Foo cannot be implemented more than once with different arguments: Foo and Foo<Integer>\n" + 
22522
		"----------\n" + 
22523
		"6. WARNING in X.java (at line 8)\n" + 
22524
		"	public class X implements Bar, Foo {}\n" + 
22525
		"	                               ^^^\n" + 
22526
		"Foo is a raw type. References to generic type Foo<T> should be parameterized\n" + 
22527
		"----------\n");
22528
}
22529
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98561
22530
public void test0721() {
22531
	this.runConformTest(
22532
			new String[] {
22533
				"Foo.java",
22534
				"public class Foo<T>\n" +
22535
				"{\n" +
22536
				"	protected abstract class InnerFoo\n" +
22537
				"	{\n" +
22538
				"		protected abstract void doSomething();\n" +
22539
				"	}\n" +
22540
				"	\n" +
22541
				"	protected void run( InnerFoo innerFoo )\n" +
22542
				"	{\n" +
22543
				"		innerFoo.doSomething();\n" +
22544
				"	}\n" +
22545
				"}",
22546
			},
22547
	        "");
22548
		this.runConformTest(
22549
			new String[] {
22550
				"Bar.java",
22551
				"public class Bar extends Foo<Integer>\n" +
22552
				"{\n" +
22553
				"	public void go()\n" +
22554
				"	{\n" +
22555
				"		InnerFoo inner = new InnerFoo()\n" +
22556
				"		{\n" +
22557
				"			protected void doSomething()\n" +
22558
				"			{\n" +
22559
				"				System.out.println( \"hello\" );\n" +
22560
				"			}\n" +
22561
				"		};\n" +
22562
				"		run( inner );\n" +
22563
				"	}\n" +
22564
				"}"
22565
			},
22566
	        "",
22567
	        null,
22568
	        false,
22569
	        null);
22570
}
22571
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98364 - variation
22572
public void test0722() {
22573
	this.runNegativeTest(
22574
		new String[] {
22575
			"X.java",
22576
			"interface I1<T1> {\n" + 
22577
			"}\n" + 
22578
			"\n" + 
22579
			"interface I2<T2> extends I1<T2> {\n" + 
22580
			"}\n" + 
22581
			"\n" + 
22582
			"public class X<U1> implements I1<U1>, I2<U1> {\n" + 
22583
			"}\n",
22584
		},
22585
		"");
22586
}
22587
public void test0723() {
22588
	this.runConformTest(
22589
		new String[] {
22590
			"X.java",
22591
			"interface IA<E> {}\n" + 
22592
			"interface IB<E> extends IA<E> {}\n" + 
22593
			"class A<E> implements IA<E> {}\n" + 
22594
			"class B<E> implements IB<E> {}\n" + 
22595
			"\n" + 
22596
			"public class X {\n" + 
22597
			"\n" + 
22598
			"	public static void main(String[] args) {\n" + 
22599
			"		A<Integer> x = new A<Integer>();\n" + 
22600
			"		B<Integer> y = new B<Integer>();\n" + 
22601
			"		print(x);\n" + 
22602
			"		print(y);\n" + 
22603
			"	}\n" + 
22604
			"	public static <T extends IA<?>> void print(T a) {\n" + 
22605
			"		System.out.print(\"A\");\n" + 
22606
			"	}\n" + 
22607
			"	public static <T extends IB<?>> void print(T a) {\n" + 
22608
			"		System.out.println(\"B\");\n" + 
22609
			"	}\n" + 
22610
			"}\n",
22611
		},
22612
		"AB");
22613
}
22614
public void test0724() {
22615
	this.runConformTest(
22616
		new String[] {
22617
			"X.java",
22618
			"import java.util.HashMap;\n" + 
22619
			"\n" + 
22620
			"public class X {\n" + 
22621
			"\n" + 
22622
			"	public static void main(String[] args) {\n" + 
22623
			"		HashMap<Byte, Byte> subst = new HashMap<Byte, Byte>();\n" + 
22624
			"		subst.put((byte)1, (byte)1);\n" + 
22625
			"		if (1 + subst.get((byte)1) > 0.f) {\n" + 
22626
			"			System.out.println(\"SUCCESS\");\n" + 
22627
			"		}		\n" + 
22628
			"	}\n" + 
22629
			"}\n",
22630
		},
22631
		"SUCCESS");
22632
}
22633
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98500
22634
public void test0725() {
22635
	this.runNegativeTest(
22636
		new String[] {
22637
			"X.java",
22638
			"class AbsC {\n" + 
22639
			"	public <T> T[] resize(T[] src, T[] dest) {\n" + 
22640
			"		return dest;\n" + 
22641
			"	}\n" + 
22642
			"}\n" + 
22643
			"\n" + 
22644
			"class ConrC<T> extends AbsC {\n" + 
22645
			"	T[][] data;\n" + 
22646
			"	protected void allocateChunkSlots(int maxChunkNo) {\n" + 
22647
			"		data = resize(data, new Object[maxChunkNo][]);\n" + 
22648
			"	}\n" + 
22649
			"}\n",
22650
		},
22651
		"----------\n" + 
22652
		"1. ERROR in X.java (at line 10)\n" + 
22653
		"	data = resize(data, new Object[maxChunkNo][]);\n" + 
22654
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
22655
		"Type mismatch: cannot convert from Object[][] to T[][]\n" + 
22656
		"----------\n");
22657
}
22658
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98500
22659
public void test0726() {
22660
	this.runConformTest(
22661
		new String[] {
22662
			"X.java",
22663
			"public class X {\n" + 
22664
			"	\n" + 
22665
			"	void foo() {\n" + 
22666
			"		\n" + 
22667
			"		Controller<?> ctrl = null;\n" + 
22668
			"		foobar(ctrl.getView().getContent()); \n" + 
22669
			"	} \n" + 
22670
			"	\n" + 
22671
			"	static void foobar(X x) {\n" + 
22672
			"	}\n" + 
22673
			"}\n" + 
22674
			"interface Controller<T extends View<?>> {\n" + 
22675
			"    public T getView() ;\n" + 
22676
			"}\n" + 
22677
			"interface View<U extends X> {\n" + 
22678
			"	public U getContent();\n" + 
22679
			"}\n"				
22680
		},
22681
		"");
22682
}
22683
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98500 - variation
22684
public void test0727() {
22685
	this.runConformTest(
22686
		new String[] {
22687
			"X.java",
22688
			"public class X<E> {\n" + 
22689
			"	\n" + 
22690
			"	void foo() {\n" + 
22691
			"		\n" + 
22692
			"		Controller<?> ctrl = null;\n" + 
22693
			"		foobar(ctrl.getView().getContent()); \n" + 
22694
			"	} \n" + 
22695
			"	\n" + 
22696
			"	static void foobar(X<String> x) {\n" + 
22697
			"	}\n" + 
22698
			"}\n" + 
22699
			"interface Controller<T extends View<?>> {\n" + 
22700
			"    public T getView() ;\n" + 
22701
			"}\n" + 
22702
			"interface View<U extends X<String>> {\n" + 
22703
			"	public U getContent();\n" + 
22704
			"}\n"				
22705
		},
22706
		"");
22707
}
22708
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98500 - variation
22709
public void test0728() {
22710
	this.runNegativeTest(
22711
		new String[] {
22712
			"X.java",
22713
			"public class X<E> {\n" + 
22714
			"	\n" + 
22715
			"	public static void main(String[] args) {\n" + 
22716
			"		\n" + 
22717
			"		Controller<?> ctrl = null;\n" + 
22718
			"		foobar(ctrl.getView().getContent()); \n" + 
22719
			"	} \n" + 
22720
			"	\n" + 
22721
			"	static void foobar(X<String> x) {\n" + 
22722
			"	}\n" + 
22723
			"}\n" + 
22724
			"interface Controller<T extends View<?>> {\n" + 
22725
			"    public T getView() ;\n" + 
22726
			"}\n" + 
22727
			"interface View<U extends X<U>> {\n" + 
22728
			"	public U getContent();\n" + 
22729
			"}\n"			
22730
		},
22731
		"----------\n" + 
22732
		"1. ERROR in X.java (at line 6)\n" + 
22733
		"	foobar(ctrl.getView().getContent()); \n" + 
22734
		"	^^^^^^\n" + 
22735
		"The method foobar(X<String>) in the type X<E> is not applicable for the arguments (?)\n" + 
22736
		"----------\n");
22737
}
22738
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=96586
22739
public void test0729() {
22740
	this.runConformTest(
22741
		new String[] {
22742
			"X.java",
22743
			"public class X implements I<Y> {}\n" + 
22744
			"interface I<T> {}\n" + 
22745
			"class Y extends X implements I<Y> {}\n"			
22746
		},
22747
		"");
22748
	this.runNegativeTest(
22749
		new String[] {
22750
			"X.java",
22751
			"public class X implements I<Y> {}\n" + 
22752
			"interface I<T extends I<? super T>> {}\n" + 
22753
			"class Y extends X implements I<X> {}\n"			
22754
		},
22755
		"----------\n" + 
22756
		"1. ERROR in X.java (at line 3)\n" + 
22757
		"	class Y extends X implements I<X> {}\n" + 
22758
		"	      ^\n" + 
22759
		"The interface I cannot be implemented more than once with different arguments: I<Y> and I<X>\n" + 
22760
		"----------\n" + 
22761
		"2. ERROR in X.java (at line 3)\n" + 
22762
		"	class Y extends X implements I<X> {}\n" + 
22763
		"	                               ^\n" + 
22764
		"Bound mismatch: The type X is not a valid substitute for the bounded parameter <T extends I<? super T>> of the type I<T>\n" + 
22765
		"----------\n");
22766
}
22767
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90437
22768
public void test0730() {
22769
	this.runNegativeTest(
22770
		new String[] {
22771
			"X.java",
22772
			"public class X {\n" + 
22773
			"\n" + 
22774
			"    Zork z;\n" +
22775
			"    public interface SuperInterface<A> {\n" + 
22776
			"    }\n" + 
22777
			"\n" + 
22778
			"    public interface SubInterface extends SuperInterface<String> {\n" + 
22779
			"        public String getString();\n" + 
22780
			"    }\n" + 
22781
			"\n" + 
22782
			"    private SuperInterface< ? extends SuperInterface> x = null;\n" + 
22783
			"\n" + 
22784
			"    public void f() {\n" + 
22785
			"        ((SubInterface) this.x).getString();\n" + 
22786
			"    }\n" + 
22787
			"}\n"	
22788
		},
22789
		"----------\n" + 
22790
		"1. ERROR in X.java (at line 3)\n" + 
22791
		"	Zork z;\n" + 
22792
		"	^^^^\n" + 
22793
		"Zork cannot be resolved to a type\n" + 
22794
		"----------\n" + 
22795
		"2. WARNING in X.java (at line 11)\n" + 
22796
		"	private SuperInterface< ? extends SuperInterface> x = null;\n" + 
22797
		"	                                  ^^^^^^^^^^^^^^\n" + 
22798
		"X.SuperInterface is a raw type. References to generic type X.SuperInterface<A> should be parameterized\n" + 
22799
		"----------\n");
22800
}
22801
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97440
22802
public void test0731() {
22803
	this.runConformTest(
22804
		new String[] {
22805
			"X.java",
22806
			"public class X<E> {\n" + 
22807
			"	X<? super E> parent;\n" + 
22808
			"	X<? super E> current;\n" + 
22809
			"\n" + 
22810
			"	X<? extends E> parent2;\n" + 
22811
			"	X<? extends E> current2;\n" + 
22812
			"\n" + 
22813
			"	void foo() {\n" + 
22814
			"		current = current.parent;\n" + 
22815
			"	}\n" + 
22816
			"\n" + 
22817
			"	void bar() {\n" + 
22818
			"		current2 = current2.parent2;\n" + 
22819
			"	}\n" + 
22820
			"}\n"
22821
		},
22822
		"");
22823
}
22824
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331
22825
public void test0732() {
22826
	this.runNegativeTest(
22827
		new String[] {
22828
			"X.java",
22829
			"interface B<T> {}\n" + 
22830
			"interface C extends B<String>{}\n" + 
22831
			"interface D extends B<Integer>{}\n" + 
22832
			"\n" + 
22833
			"public class X {\n" + 
22834
			"             public static void main(String[] args) {\n" + 
22835
			"                         D d = null;\n" + 
22836
			"                         C c = (C)d; // illegal\n" + 
22837
			"             }\n" + 
22838
			"}\n"
22839
		},
22840
		"----------\n" + 
22841
		"1. ERROR in X.java (at line 8)\n" + 
22842
		"	C c = (C)d; // illegal\n" + 
22843
		"	      ^^^^\n" + 
22844
		"Cannot cast from D to C\n" + 
22845
		"----------\n");
22846
}
22847
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22848
public void test0733() {
22849
	this.runConformTest(
22850
		new String[] {
22851
			"X.java",
22852
			"interface B<T> {}\n" + 
22853
			"interface C extends B<String>{}\n" + 
22854
			"interface D<E> extends B<E>{}\n" + 
22855
			"\n" + 
22856
			"\n" + 
22857
			"public class X {\n" + 
22858
			"			Object foo(C c) {\n" + 
22859
			"					return (D<? extends String>) c;\n" + 
22860
			"             }\n" + 
22861
			"}\n"
22862
		},
22863
		"");
22864
}
22865
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22866
public void test0734() {
22867
	this.runConformTest(
22868
		new String[] {
22869
			"X.java",
22870
			"interface B<T> {}\n" + 
22871
			"interface C extends B<String>{}\n" + 
22872
			"interface D<E> extends B<E>{}\n" + 
22873
			"\n" + 
22874
			"\n" + 
22875
			"public class X {\n" + 
22876
			"			Object foo(C c, D<? extends String> d) {\n" + 
22877
			"					return c != null ? c : d; \n" + 
22878
			"             }\n" + 
22879
			"}\n"
22880
		},
22881
		"");
22882
}
22883
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22884
public void test0735() {
22885
	this.runConformTest(
22886
		new String[] {
22887
			"X.java",
22888
			"interface B<T> {}\n" + 
22889
			"interface C extends B<String>{}\n" + 
22890
			"interface D<E> extends B<E>{}\n" + 
22891
			"\n" + 
22892
			"\n" + 
22893
			"public class X {\n" + 
22894
			"			Object foo(C c, D<? extends Exception> d) {\n" + 
22895
			"					return c != null ? c : d; \n" + 
22896
			"             }\n" + 
22897
			"}\n"
22898
		},
22899
		"");
22900
}
22901
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22902
public void test0736() {
22903
	this.runNegativeTest(
22904
		new String[] {
22905
			"X.java",
22906
			"interface B<T> {}\n" + 
22907
			"interface C extends B<String>{}\n" + 
22908
			"interface D<E> extends B<E>{}\n" + 
22909
			"\n" + 
22910
			"\n" + 
22911
			"public class X {\n" + 
22912
			"			void bar(C c) {\n" + 
22913
			"					D<? extends Exception> d = (D<? extends Exception>) c;\n" + 
22914
			"					foo(d, c);\n" + 
22915
			"             }\n" + 
22916
			"			<U> void foo(U u1, U u2) {\n" + 
22917
			"			}\n" + 
22918
			"}\n"
22919
		},
22920
		"----------\n" + 
22921
		"1. ERROR in X.java (at line 8)\n" + 
22922
		"	D<? extends Exception> d = (D<? extends Exception>) c;\n" + 
22923
		"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
22924
		"Cannot cast from C to D<? extends Exception>\n" + 
22925
		"----------\n");
22926
}
22927
// **
22928
public void test0737() {
22929
	this.runConformTest(
22930
		new String[] {
22931
			"X.java",
22932
			"class Sup {\n" + 
22933
			"}\n" + 
22934
			"\n" + 
22935
			"class Sub1 extends Sup {\n" + 
22936
			"}\n" + 
22937
			"\n" + 
22938
			"class Sub2 extends Sup {\n" + 
22939
			"\n" + 
22940
			"}\n" + 
22941
			"abstract class X {\n" + 
22942
			"	abstract <S, A extends S, B extends S> S method(A la, B lb);\n" + 
22943
			"\n" + 
22944
			"	void m2() {\n" + 
22945
			"		Sup Sup = method(new Sub1(), new Sub2());// <-- compiles?? ( A=Sub1, B=Sub2, S=Sup)\n" + 
22946
			"		Object obj = method(1, \"32\");// <--doesn\'t compile?? ( A=Integer, B=String, S=Object)\n" + 
22947
			"	}\n" + 
22948
			"}\n",
22949
		},
22950
		"");
22951
}
22952
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22953
public void test0738() {
22954
	this.runNegativeTest(
22955
		new String[] {
22956
			"X.java",
22957
			"interface B<T> {}\n" + 
22958
			"class C implements B<String>{}\n" + 
22959
			"interface D extends B<Integer>{}\n" + 
22960
			"\n" + 
22961
			"public class X {\n" + 
22962
			"             public static void main(String[] args) {\n" + 
22963
			"                         D d = null;\n" + 
22964
			"                         C c = (C)d; // illegal\n" + 
22965
			"             }\n" + 
22966
			"}\n"
22967
		},
22968
		"----------\n" + 
22969
		"1. ERROR in X.java (at line 8)\n" + 
22970
		"	C c = (C)d; // illegal\n" + 
22971
		"	      ^^^^\n" + 
22972
		"Cannot cast from D to C\n" + 
22973
		"----------\n");
22974
}
22975
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22976
public void test0739() {
22977
	this.runNegativeTest(
22978
		new String[] {
22979
			"X.java",
22980
			"interface B<T> {}\n" + 
22981
			"interface C extends B<String>{}\n" + 
22982
			"class D implements B<Integer>{}\n" + 
22983
			"\n" + 
22984
			"public class X {\n" + 
22985
			"             public static void main(String[] args) {\n" + 
22986
			"                         D d = null;\n" + 
22987
			"                         C c = (C)d; // illegal\n" + 
22988
			"             }\n" + 
22989
			"}\n"
22990
		},
22991
		"----------\n" + 
22992
		"1. ERROR in X.java (at line 8)\n" + 
22993
		"	C c = (C)d; // illegal\n" + 
22994
		"	      ^^^^\n" + 
22995
		"Cannot cast from D to C\n" + 
22996
		"----------\n");
22997
}
22998
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
22999
public void test0740() {
23000
	this.runNegativeTest(
23001
		new String[] {
23002
			"X.java",
23003
			"interface B<T> {}\n" + 
23004
			"final class C implements B<String>{}\n" + 
23005
			"\n" + 
23006
			"public class X {\n" + 
23007
			"             public static void main(String[] args) {\n" + 
23008
			"                         B<Integer> d = null;\n" + 
23009
			"                         C c = (C)d; // illegal\n" + 
23010
			"             }\n" + 
23011
			"}\n"
23012
		},
23013
		"----------\n" + 
23014
		"1. ERROR in X.java (at line 7)\n" + 
23015
		"	C c = (C)d; // illegal\n" + 
23016
		"	      ^^^^\n" + 
23017
		"Cannot cast from B<Integer> to C\n" + 
23018
		"----------\n");
23019
}
23020
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98331 - variation
23021
public void test0741() {
23022
	this.runNegativeTest(
23023
		new String[] {
23024
			"X.java",
23025
			"interface B<T> {}\n" + 
23026
			"final class D implements B<Integer>{}\n" + 
23027
			"\n" + 
23028
			"public class X {\n" + 
23029
			"             public static void main(String[] args) {\n" + 
23030
			"                         D d = null;\n" + 
23031
			"                         B<String> c = (B<String>)d; // illegal\n" + 
23032
			"             }\n" + 
23033
			"}\n"
23034
		},
23035
		"----------\n" + 
23036
		"1. ERROR in X.java (at line 7)\n" + 
23037
		"	B<String> c = (B<String>)d; // illegal\n" + 
23038
		"	              ^^^^^^^^^^^^\n" + 
23039
		"Cannot cast from D to B<String>\n" + 
23040
		"----------\n");
23041
}
23042
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=98538
23043
// **
23044
public void test0742() {
23045
	this.runNegativeTest(
23046
		new String[] {
23047
			"X.java",
23048
			"import java.util.*;\n" + 
23049
			"\n" + 
23050
			" public class X {\n" + 
23051
			" \n" + 
23052
			"	static abstract class SelfType<T extends SelfType<T>>{\n" + 
23053
			"	}\n" + 
23054
			" \n" + 
23055
			"	static class SuperType extends SelfType<SuperType>{\n" + 
23056
			"	}\n" + 
23057
			" \n" + 
23058
			"	static class SubType extends SuperType{}\n" + 
23059
			" \n" + 
23060
			"	static <T extends SelfType<T>> List<T> makeSingletonList(T t){\n" + 
23061
			"		return Collections.singletonList(t);\n" + 
23062
			"	}\n" + 
23063
			" \n" + 
23064
			"	static <T extends SelfType<T>,S extends T> List<T> makeSingletonList2(S s){\n" + 
23065
			"		return Collections.singletonList((T)s); // #0\n" + 
23066
			"	}\n" + 
23067
			" \n" + 
23068
			"	public static void main(String[] args){\n" + 
23069
			"		makeSingletonList(new SuperType()); // #1 - OK\n" + 
23070
			"		List<SuperType> lsup = makeSingletonList(new SuperType()); // #2 - OK\n" + 
23071
			"		List<SubType> lsub = makeSingletonList(new SubType()); // #3 - ERROR\n" + 
23072
			"		makeSingletonList(new SubType()); // #4 - ERROR\n" + 
23073
			" 		makeSingletonList2(new SubType()); // #5 - ERROR\n" + 
23074
			"		lsup = makeSingletonList2(new SubType()); // #6 - OK\n" + 
23075
			"		lsub = makeSingletonList2(new SubType()); // #7 - ERROR\n" + 
23076
			"		makeSingletonList2(new SuperType()); // #8 - OK\n" + 
23077
			"		lsup = makeSingletonList2(new SuperType()); // #9 - OK\n" + 
23078
			"	}\n" + 
23079
			"}\n"
23080
		},
23081
		"----------\n" + 
23082
		"1. ERROR in X.java (at line 24)\n" + 
23083
		"	List<SubType> lsub = makeSingletonList(new SubType()); // #3 - ERROR\n" + 
23084
		"	                     ^^^^^^^^^^^^^^^^^\n" + 
23085
		"Bound mismatch: The generic method makeSingletonList(T) of type X is not applicable for the arguments (X.SubType). The inferred type X.SubType is not a valid substitute for the bounded parameter <T extends X.SelfType<T>>\n" + 
23086
		"----------\n" + 
23087
		"2. ERROR in X.java (at line 25)\n" + 
23088
		"	makeSingletonList(new SubType()); // #4 - ERROR\n" + 
23089
		"	^^^^^^^^^^^^^^^^^\n" + 
23090
		"Bound mismatch: The generic method makeSingletonList(T) of type X is not applicable for the arguments (X.SubType). The inferred type X.SubType is not a valid substitute for the bounded parameter <T extends X.SelfType<T>>\n" + 
23091
		"----------\n" + 
23092
		"3. ERROR in X.java (at line 26)\n" + 
23093
		"	makeSingletonList2(new SubType()); // #5 - ERROR\n" + 
23094
		"	^^^^^^^^^^^^^^^^^^\n" + 
23095
		"Bound mismatch: The generic method makeSingletonList2(S) of type X is not applicable for the arguments (X.SubType). The inferred type X.SubType is not a valid substitute for the bounded parameter <T extends X.SelfType<T>>\n" + 
23096
		"----------\n" + 
23097
		"4. ERROR in X.java (at line 28)\n" + 
23098
		"	lsub = makeSingletonList2(new SubType()); // #7 - ERROR\n" + 
23099
		"	       ^^^^^^^^^^^^^^^^^^\n" + 
23100
		"Bound mismatch: The generic method makeSingletonList2(S) of type X is not applicable for the arguments (X.SubType). The inferred type X.SubType is not a valid substitute for the bounded parameter <T extends X.SelfType<T>>\n" + 
23101
		"----------\n");
23102
}
23103
23104
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99553
23105
public void test0743() {
23106
	this.runNegativeTest(
23107
		new String[] {
23108
			"X.java",
23109
			"interface TestGeneric2<A> {\n" + 
23110
			"	Nested<A> getNested2(); // super\n" + 
23111
			"\n" + 
23112
			"	class Nested<B> implements TestGeneric2<B> {\n" + 
23113
			"		public Nested<B> getNested2() { // sub\n" + 
23114
			"			return this;//2\n" + 
23115
			"		}\n" + 
23116
			"	}\n" + 
23117
			"}\n" + 
23118
			" \n" + 
23119
			"class TestGeneric3<A> {\n" + 
23120
			"	Nested<A> getNested3() { return null; } // super\n" + 
23121
			"\n" + 
23122
			"	class Nested<B> extends TestGeneric3<B> {\n" + 
23123
			"		@Override public Nested<B> getNested3() { // sub\n" + 
23124
			"			return this;//3\n" + 
23125
			"		}\n" + 
23126
			"	}\n" + 
23127
			"}\n"
23128
		},
23129
		"----------\n" + 
23130
		"1. ERROR in X.java (at line 16)\n" + 
23131
		"	return this;//3\n" + 
23132
		"	       ^^^^\n" + 
23133
		"Type mismatch: cannot convert from TestGeneric3<A>.Nested<B> to TestGeneric3<B>.Nested<B>\n" + 
23134
		"----------\n");
23135
}
23136
public void test0744() {
23137
	this.runNegativeTest(
23138
		new String[] {
23139
			"java/util/X.java",
23140
			"package java.util;\n" + 
23141
			"\n" + 
23142
			"import java.io.*;\n" + 
23143
			"\n" + 
23144
			"public abstract class X<K1, V1> extends HashMap<K1, V1> {\n" + 
23145
			"\n" + 
23146
			"	Entry<K1, V1> h;\n" + 
23147
			"\n" + 
23148
			"	private static class Entry<K2, V2> extends HashMap.Entry<K2, V2> {\n" + 
23149
			"\n" + 
23150
			"		Entry() {\n" + 
23151
			"			super(0, null, null, null);\n" + 
23152
			"		}\n" + 
23153
			"\n" + 
23154
			"		void ab(@SuppressWarnings(\"unused\") Entry<K2, V2> e) {\n" + 
23155
			"		}\n" + 
23156
			"\n" + 
23157
			"		@Override void recordAccess(HashMap<K2, V2> m) {\n" + 
23158
			"			X<K2, V2> x = (X<K2, V2>) m;\n" + 
23159
			"			ab(x.h);\n" + 
23160
			"		}\n" + 
23161
			"	}\n" + 
23162
			"  Zork z;\n" +
23163
			"}\n"
23164
		},
23165
		"----------\n" + 
23166
		"1. ERROR in java\\util\\X.java (at line 23)\n" + 
23167
		"	Zork z;\n" + 
23168
		"	^^^^\n" + 
23169
		"Zork cannot be resolved to a type\n" + 
23170
		"----------\n");
23171
}
23172
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99922
23173
public void test0745() {
23174
	this.runConformTest(
23175
		new String[] {
23176
			"X.java",
23177
			"public class X {\n" + 
23178
			"	void test() {\n" + 
23179
			"		java.util.Arrays.asList(3, 3.1);\n" + 
23180
			"	}\n" + 
23181
			"}\n"
23182
		},
23183
		"");
23184
}
23185
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99922 - variation
23186
public void test0746() {
23187
	this.runNegativeTest(
23188
		new String[] {
23189
			"X.java",
23190
			"public class X {\n" + 
23191
			"	void test() {\n" + 
23192
			"		String s = java.util.Arrays.asList(3, 3.1);\n" + 
23193
			"	}\n" + 
23194
			"}\n"
23195
		},
23196
		"----------\n" + 
23197
		"1. WARNING in X.java (at line 3)\n" + 
23198
		"	String s = java.util.Arrays.asList(3, 3.1);\n" + 
23199
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23200
		"Type safety : A generic array of Number&Comparable<?> is created for a varargs parameter\n" + 
23201
		"----------\n" + 
23202
		"2. ERROR in X.java (at line 3)\n" + 
23203
		"	String s = java.util.Arrays.asList(3, 3.1);\n" + 
23204
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23205
		"Type mismatch: cannot convert from List<Number&Comparable<?>> to String\n" + 
23206
		"----------\n");
23207
}
23208
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99983
23209
public void test0747() {
23210
	this.runNegativeTest(
23211
		new String[] {
23212
			"X.java",
23213
			"public class X<T> {\n" +
23214
			"  interface I {}\n" +
23215
			"  class Y<U extends T & I> {\n" +
23216
			"  }\n" +
23217
			"}",
23218
		},
23219
		"----------\n" + 
23220
		"1. ERROR in X.java (at line 3)\n" + 
23221
		"	class Y<U extends T & I> {\n" + 
23222
		"	                      ^\n" + 
23223
		"Cannot specify any additional bound X.I when first bound is a type parameter\n" + 
23224
		"----------\n");
23225
}
23226
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100007
23227
public void test0748() {
23228
	this.runConformTest(
23229
		new String[] {
23230
			"X.java",
23231
			"public class X {\n" + 
23232
			"	static interface Factory<T> {\n" + 
23233
			"		public <U extends T> U create(Class<U> cl);\n" + 
23234
			"	}\n" + 
23235
			"	\n" + 
23236
			"	static class BytesFactory implements Factory<byte[]> {\n" + 
23237
			"		public byte[] create(Class<byte[]> cl) {\n" + 
23238
			"			return null;\n" + 
23239
			"		}\n" + 
23240
			"	}\n" + 
23241
			"}\n",
23242
		},
23243
		"");
23244
}
23245
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100149
23246
public void test0749() {
23247
	this.runNegativeTest(
23248
		new String[] {
23249
			"X.java",
23250
			"import java.util.List;\n" + 
23251
			"\n" + 
23252
			"public class X<T extends X<?>> {\n" + 
23253
			"	T get() { return null; }\n" + 
23254
			"	void foo(X x) {\n" + 
23255
			"		String s = x.get();\n" + 
23256
			"	}\n" + 
23257
			"}\n",
23258
		},
23259
		"----------\n" + 
23260
		"1. WARNING in X.java (at line 5)\n" + 
23261
		"	void foo(X x) {\n" + 
23262
		"	         ^\n" + 
23263
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
23264
		"----------\n" + 
23265
		"2. ERROR in X.java (at line 6)\n" + 
23266
		"	String s = x.get();\n" + 
23267
		"	           ^^^^^^^\n" + 
23268
		"Type mismatch: cannot convert from X to String\n" + 
23269
		"----------\n");
23270
}
23271
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100149 - variation
23272
public void test0750() {
23273
	this.runNegativeTest(
23274
		new String[] {
23275
			"X.java",
23276
			"import java.util.List;\n" + 
23277
			"\n" + 
23278
			"public class X<T extends List<String>> {\n" + 
23279
			"	T get() { return null; }\n" + 
23280
			"	void foo(X x) {\n" + 
23281
			"		List<Object> l = x.get();\n" + 
23282
			"	}\n" + 
23283
			"  Zork z ;\n" +
23284
			"}\n",
23285
		},
23286
		"----------\n" + 
23287
		"1. WARNING in X.java (at line 5)\n" + 
23288
		"	void foo(X x) {\n" + 
23289
		"	         ^\n" + 
23290
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
23291
		"----------\n" + 
23292
		"2. WARNING in X.java (at line 6)\n" + 
23293
		"	List<Object> l = x.get();\n" + 
23294
		"	                 ^^^^^^^\n" + 
23295
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
23296
		"----------\n" + 
23297
		"3. ERROR in X.java (at line 8)\n" + 
23298
		"	Zork z ;\n" + 
23299
		"	^^^^\n" + 
23300
		"Zork cannot be resolved to a type\n" + 
23301
		"----------\n");
23302
}
23303
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100153
23304
public void test0751() {
23305
	this.runNegativeTest(
23306
		new String[] {
23307
			"X.java",
23308
			"public class X<T extends X<T>> {\n" + 
23309
			"	\n" + 
23310
			"	void foo(X<? extends T> x) {\n" + 
23311
			"		X<T> x2 = x;\n" + 
23312
			"	}\n" + 
23313
			"}\n",
23314
		},
23315
		"----------\n" + 
23316
		"1. ERROR in X.java (at line 4)\n" + 
23317
		"	X<T> x2 = x;\n" + 
23318
		"	          ^\n" + 
23319
		"Type mismatch: cannot convert from X<capture#1-of ? extends T> to X<T>\n" + 
23320
		"----------\n");
23321
}
23322
public void test0752() {
23323
	this.runNegativeTest(
23324
		new String[] {
23325
			"X.java",
23326
			"import java.io.Serializable;\n" + 
23327
			"\n" + 
23328
			"public class X<E extends Serializable> {\n" + 
23329
			"	X<? extends I<E>> parent;\n" + 
23330
			"	X<? extends I<E>> current;\n" + 
23331
			"	void foo() {\n" + 
23332
			"		current = current.parent;\n" + 
23333
			"	}\n" + 
23334
			"}\n" + 
23335
			"\n" + 
23336
			"interface I<T> {\n" + 
23337
			"}\n",
23338
		},
23339
		"----------\n" + 
23340
		"1. ERROR in X.java (at line 7)\n" + 
23341
		"	current = current.parent;\n" + 
23342
		"	          ^^^^^^^^^^^^^^\n" + 
23343
		"Type mismatch: cannot convert from X<capture#3-of ? extends I<capture#2-of ? extends I<E>>> to X<? extends I<E>>\n" + 
23344
		"----------\n");
23345
}
23346
public void test0753() {
23347
	this.runNegativeTest(
23348
		new String[] {
23349
			"X.java",
23350
			"import java.io.Serializable;\n" + 
23351
			"\n" + 
23352
			"public class X<E extends Serializable> {\n" + 
23353
			"	X<? super I<E>> parent;\n" + 
23354
			"	X<? super I<E>> current;\n" + 
23355
			"	void foo() {\n" + 
23356
			"		current = current.parent;\n" + 
23357
			"	}\n" + 
23358
			"}\n" + 
23359
			"\n" + 
23360
			"interface I<T> {\n" + 
23361
			"}\n",
23362
		},
23363
		"----------\n" + 
23364
		"1. ERROR in X.java (at line 4)\n" + 
23365
		"	X<? super I<E>> parent;\n" + 
23366
		"	  ^^^^^^^^^\n" + 
23367
		"Bound mismatch: The type ? super I<E> is not a valid substitute for the bounded parameter <E extends Serializable> of the type X<E>\n" + 
23368
		"----------\n" + 
23369
		"2. ERROR in X.java (at line 5)\n" + 
23370
		"	X<? super I<E>> current;\n" + 
23371
		"	  ^^^^^^^^^\n" + 
23372
		"Bound mismatch: The type ? super I<E> is not a valid substitute for the bounded parameter <E extends Serializable> of the type X<E>\n" + 
23373
		"----------\n" + 
23374
		"3. ERROR in X.java (at line 7)\n" + 
23375
		"	current = current.parent;\n" + 
23376
		"	          ^^^^^^^^^^^^^^\n" + 
23377
		"Type mismatch: cannot convert from X<capture#3-of ? super I<capture#2-of ? super I<E>>> to X<? super I<E>>\n" + 
23378
		"----------\n");
23379
}
23380
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99578
23381
public void test0754() {
23382
	this.runNegativeTest(
23383
		new String[] {
23384
			"X.java",
23385
			"class bugSuper<T extends Object> {\n" + 
23386
			"	public T getData(){\n" + 
23387
			"		return null;\n" + 
23388
			"	}\n" + 
23389
			"}\n" + 
23390
			"\n" + 
23391
			"class bugElement {\n" + 
23392
			"}\n" + 
23393
			"\n" + 
23394
			"class bugClass<T extends bugElement> extends bugSuper<T>{\n" + 
23395
			"}\n" + 
23396
			"\n" + 
23397
			"public class X{\n" + 
23398
			"	public void method(bugClass bc){\n" + 
23399
			"		bugElement be = bc.getData();   //<< here\n" + 
23400
			"	}\n" + 
23401
			"}\n",
23402
		},
23403
		"----------\n" + 
23404
		"1. WARNING in X.java (at line 14)\n" + 
23405
		"	public void method(bugClass bc){\n" + 
23406
		"	                   ^^^^^^^^\n" + 
23407
		"bugClass is a raw type. References to generic type bugClass<T> should be parameterized\n" + 
23408
		"----------\n" + 
23409
		"2. ERROR in X.java (at line 15)\n" + 
23410
		"	bugElement be = bc.getData();   //<< here\n" + 
23411
		"	                ^^^^^^^^^^^^\n" + 
23412
		"Type mismatch: cannot convert from Object to bugElement\n" + 
23413
		"----------\n");
23414
}
23415
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99999
23416
public void test0755() {
23417
	this.runNegativeTest(
23418
		new String[] {
23419
			"X.java",
23420
			"public class X<T> {\n" +
23421
			"  public static class B {}\n" +
23422
			"  public static void main (String... args) {\n" +
23423
			"    X<?>.B[] b = new X<?>.B[1];\n" +
23424
			"  }\n" +
23425
			"}",
23426
		},
23427
		"----------\n" + 
23428
		"1. ERROR in X.java (at line 4)\n" + 
23429
		"	X<?>.B[] b = new X<?>.B[1];\n" + 
23430
		"	^^^^^^^^\n" + 
23431
		"The member type X<?>.B cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X<?>\n" + 
23432
		"----------\n" + 
23433
		"2. ERROR in X.java (at line 4)\n" + 
23434
		"	X<?>.B[] b = new X<?>.B[1];\n" + 
23435
		"	                 ^^^^^^\n" + 
23436
		"The member type X<?>.B cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X<?>\n" + 
23437
		"----------\n");
23438
}
23439
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99999 - variation
23440
// **
23441
public void test0756() {
23442
	this.runConformTest(
23443
		new String[] {
23444
			"X.java",
23445
			"public class X<T> {\n" +
23446
			"  public class B {}\n" +
23447
			"  public static void main (String... args) {\n" +
23448
			"    X<?>.B[] b = new X<?>.B[1];\n" +
23449
			"  }\n" +
23450
			"}",
23451
		},
23452
		"");
23453
}
23454
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100147
23455
public void test0757() {
23456
	this.runNegativeTest(
23457
		new String[] {
23458
			"X.java",
23459
			"public class X<K, V> {\n" + 
23460
			"	static class EntryMap<K, V> {\n" + 
23461
			"		class Entry {\n" + 
23462
			"		}\n" + 
23463
			"	}\n" + 
23464
			"\n" + 
23465
			"	EntryMap.Entry internalGet(Object key) {\n" + 
23466
			"		return null;\n" + 
23467
			"	}\n" + 
23468
			"	\n" + 
23469
			"	void foo(Object key) {\n" + 
23470
			"		EntryMap<K,V>.Entry entry = internalGet(key);\n" + 
23471
			"	}\n" + 
23472
			"  Zork z;\n" +
23473
			"}\n",
23474
		},
23475
		"----------\n" + 
23476
		"1. WARNING in X.java (at line 7)\n" + 
23477
		"	EntryMap.Entry internalGet(Object key) {\n" + 
23478
		"	^^^^^^^^^^^^^^\n" + 
23479
		"X.EntryMap.Entry is a raw type. References to generic type X<K,V>.EntryMap<K,V>.Entry should be parameterized\n" + 
23480
		"----------\n" + 
23481
		"2. WARNING in X.java (at line 12)\n" + 
23482
		"	EntryMap<K,V>.Entry entry = internalGet(key);\n" + 
23483
		"	                            ^^^^^^^^^^^^^^^^\n" + 
23484
		"Type safety: The expression of type X.EntryMap.Entry needs unchecked conversion to conform to X.EntryMap<K,V>.Entry\n" + 
23485
		"----------\n" + 
23486
		"3. ERROR in X.java (at line 14)\n" + 
23487
		"	Zork z;\n" + 
23488
		"	^^^^\n" + 
23489
		"Zork cannot be resolved to a type\n" + 
23490
		"----------\n");
23491
}
23492
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100147 - variation
23493
public void test0758() {
23494
	this.runNegativeTest(
23495
		new String[] {
23496
			"X.java",
23497
			"public class X<K, V> {\n" + 
23498
			"	static class EntryMap<K, V> {\n" + 
23499
			"		class Entry {\n" + 
23500
			"		}\n" + 
23501
			"	}\n" + 
23502
			"\n" + 
23503
			"	EntryMap.Entry internalGet(Object key) {\n" + 
23504
			"		return null;\n" + 
23505
			"	}\n" + 
23506
			"	\n" + 
23507
			"	void foo(Object key) {\n" + 
23508
			"		EntryMap<K,V>.Entry entry = (EntryMap.Entry) internalGet(key);\n" + 
23509
			"	}\n" + 
23510
			"  Zork z;\n" +
23511
			"}\n",
23512
		},
23513
		"----------\n" + 
23514
		"1. WARNING in X.java (at line 7)\n" + 
23515
		"	EntryMap.Entry internalGet(Object key) {\n" + 
23516
		"	^^^^^^^^^^^^^^\n" + 
23517
		"X.EntryMap.Entry is a raw type. References to generic type X<K,V>.EntryMap<K,V>.Entry should be parameterized\n" + 
23518
		"----------\n" + 
23519
		"2. WARNING in X.java (at line 12)\n" + 
23520
		"	EntryMap<K,V>.Entry entry = (EntryMap.Entry) internalGet(key);\n" + 
23521
		"	                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23522
		"Unnecessary cast from X.EntryMap.Entry to X.EntryMap.Entry\n" + 
23523
		"----------\n" + 
23524
		"3. WARNING in X.java (at line 12)\n" + 
23525
		"	EntryMap<K,V>.Entry entry = (EntryMap.Entry) internalGet(key);\n" + 
23526
		"	                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23527
		"Type safety: The expression of type X.EntryMap.Entry needs unchecked conversion to conform to X.EntryMap<K,V>.Entry\n" + 
23528
		"----------\n" + 
23529
		"4. WARNING in X.java (at line 12)\n" + 
23530
		"	EntryMap<K,V>.Entry entry = (EntryMap.Entry) internalGet(key);\n" + 
23531
		"	                             ^^^^^^^^^^^^^^\n" + 
23532
		"X.EntryMap.Entry is a raw type. References to generic type X<K,V>.EntryMap<K,V>.Entry should be parameterized\n" + 
23533
		"----------\n" + 
23534
		"5. ERROR in X.java (at line 14)\n" + 
23535
		"	Zork z;\n" + 
23536
		"	^^^^\n" + 
23537
		"Zork cannot be resolved to a type\n" + 
23538
		"----------\n");
23539
}
23540
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100128
23541
public void test0759() {
23542
	this.runConformTest(
23543
		new String[] {
23544
			"X.java",
23545
			"public class X<E>\n" + 
23546
			"{\n" + 
23547
			"  E[] m;\n" + 
23548
			"  public X()\n" + 
23549
			"  {\n" + 
23550
			"	X<? extends E> x = null;\n" + 
23551
			"	System.out.println(x.m.length);\n" + 
23552
			"  }\n" + 
23553
			"}\n",
23554
		},
23555
		"");
23556
}
23557
public void test0760() {
23558
	this.runNegativeTest(
23559
		new String[] {
23560
			"X.java",
23561
			"import java.util.*;\n" + 
23562
			"\n" + 
23563
			"public class X<U> {\n" + 
23564
			"	public static <T> X<T> make() {\n" + 
23565
			"		return null;\n" + 
23566
			"	}\n" + 
23567
			"	public static <T> T itself(T t) {\n" + 
23568
			"		return t;\n" + 
23569
			"	}\n" + 
23570
			"\n" + 
23571
			"	void foo() {\n" + 
23572
			"		X<Integer> x1 = make();\n" + 
23573
			"		X<Integer> x2 = itself(x1);\n" + 
23574
			"	}\n" + 
23575
			"	void bar() {\n" + 
23576
			"		X<Integer> x2 = itself(make());\n" + 
23577
			"	}\n" + 
23578
			"	void baz() {\n" + 
23579
			"		X<Integer> x2 = itself((X<Integer>)make());\n" + 
23580
			"	}	\n" + 
23581
			"} \n",
23582
		},
23583
		"----------\n" + 
23584
		"1. ERROR in X.java (at line 16)\n" + 
23585
		"	X<Integer> x2 = itself(make());\n" + 
23586
		"	                ^^^^^^^^^^^^^^\n" + 
23587
		"Type mismatch: cannot convert from X<Object> to X<Integer>\n" + 
23588
		"----------\n" + 
23589
		"2. ERROR in X.java (at line 19)\n" + 
23590
		"	X<Integer> x2 = itself((X<Integer>)make());\n" + 
23591
		"	                       ^^^^^^^^^^^^^^^^^^\n" + 
23592
		"Cannot cast from X<Object> to X<Integer>\n" + 
23593
		"----------\n");
23594
}
23595
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100421
23596
public void test0761() {
23597
	this.runConformTest(
23598
		new String[] {
23599
			"X.java",
23600
			"public class X {\n" + 
23601
			"\n" + 
23602
			"  public abstract class ClassA<A, B> {\n" + 
23603
			"    public abstract B method(A param);\n" + 
23604
			"  }\n" + 
23605
			"\n" + 
23606
			"  public class ClassB<C, D extends C> {\n" + 
23607
			"    // the following field declaration causes an error\n" + 
23608
			"    ClassA<? super C, ? extends D> classA;\n" + 
23609
			"\n" + 
23610
			"    public D method(D d) {\n" + 
23611
			"      return classA.method(d);\n" + 
23612
			"    }\n" + 
23613
			"  }\n" + 
23614
			"}\n",
23615
		},
23616
		"");
23617
}
23618
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100421 - variation
23619
public void test0762() {
23620
	this.runConformTest(
23621
		new String[] {
23622
			"X.java",
23623
			"public class X {\n" + 
23624
			"\n" + 
23625
			"  public abstract class ClassA<A, B extends Number> {\n" + 
23626
			"    public abstract B method(A param);\n" + 
23627
			"  }\n" + 
23628
			"\n" + 
23629
			"  public class ClassB<C extends Number, D extends C> {\n" + 
23630
			"    // the following field declaration causes an error\n" + 
23631
			"    ClassA<? super C, ? extends D> classA;\n" + 
23632
			"\n" + 
23633
			"    public D method(D d) {\n" + 
23634
			"      return classA.method(d);\n" + 
23635
			"    }\n" + 
23636
			"  }\n" + 
23637
			"}\n",
23638
		},
23639
		"");
23640
}
23641
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100519
23642
public void test0763() {
23643
	this.runConformTest(
23644
		new String[] {
23645
			"X.java",
23646
			"public class X<E> {\n" + 
23647
			"	public static class InnerClass {\n" + 
23648
			"		public InnerClass() {\n" + 
23649
			"			System.out.println(\"class : \" + InnerClass.this);\n" + 
23650
			"		}\n" + 
23651
			"	}\n" + 
23652
			"}\n",
23653
		},
23654
		"");
23655
}
23656
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100527
23657
public void test0764() {
23658
	this.runNegativeTest(
23659
		new String[] {
23660
			"X.java",
23661
			"import java.util.*;\n" + 
23662
			" \n" + 
23663
			"interface IIfClosure {}\n" + 
23664
			" \n" + 
23665
			"public class X {\n" + 
23666
			"    public X(String label, HashMap<String,Object> bindings) {\n" + 
23667
			"        this(label, bindings, (List<IIfClosure>)Collections.emptyList());\n" + 
23668
			"    }\n" + 
23669
			"    \n" + 
23670
			"    public X(String label, HashMap<String,Object> bindings, Collection<IIfClosure> coll) {\n" + 
23671
			"    }\n" + 
23672
			"}\n",
23673
		},
23674
		"----------\n" + 
23675
		"1. ERROR in X.java (at line 7)\n" + 
23676
		"	this(label, bindings, (List<IIfClosure>)Collections.emptyList());\n" + 
23677
		"	                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
23678
		"Cannot cast from List<Object> to List<IIfClosure>\n" + 
23679
		"----------\n");
23680
}
23681
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98379
23682
// **
23683
public void test0765() {
23684
	this.runConformTest(
23685
		new String[] {
23686
			"X.java",
23687
			"public class X {\n" + 
23688
			"    static <T extends X> T f1() throws Exception{\n" + 
23689
			"    	return null;\n" + 
23690
			"    }\n" + 
23691
			"    static <U extends X> U f2() throws Exception {\n" + 
23692
			"        return f1();\n" + 
23693
			"    }\n" + 
23694
			"}\n",
23695
		},
23696
		"");
23697
}
23698
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99453
23699
public void test0766() {
23700
	this.runNegativeTest(
23701
		new String[] {
23702
			"X.java",
23703
			"import java.util.*;\n" + 
23704
			"\n" + 
23705
			"interface Cloneable<T extends Cloneable<T>> {\n" + 
23706
			"	public T clone();\n" + 
23707
			"}\n" + 
23708
			"\n" + 
23709
			"interface CloneableMap<K, V extends Cloneable<V>> extends Map<K, V>, Cloneable<CloneableMap<K, V>> {\n" + 
23710
			"}\n" + 
23711
			"\n" + 
23712
			"interface C<T extends C<T>> extends Cloneable<T> {\n" + 
23713
			"}\n" + 
23714
			"public class X {\n" + 
23715
			"	void foo() {\n" + 
23716
			"		CloneableMap<String, C<?>> map = null;\n" + 
23717
			"	}\n" + 
23718
			"}\n",
23719
		},
23720
		"----------\n" + 
23721
		"1. ERROR in X.java (at line 14)\n" + 
23722
		"	CloneableMap<String, C<?>> map = null;\n" + 
23723
		"	                     ^\n" + 
23724
		"Bound mismatch: The type C<?> is not a valid substitute for the bounded parameter <V extends Cloneable<V>> of the type CloneableMap<K,V>\n" + 
23725
		"----------\n");
23726
}
23727
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99453 - variation
23728
public void test0767() {
23729
	this.runConformTest(
23730
		new String[] {
23731
			"X.java",
23732
			"import java.util.*;\n" + 
23733
			"\n" + 
23734
			"interface Cloneable<T extends Cloneable<T>> {\n" + 
23735
			"	public T clone();\n" + 
23736
			"}\n" + 
23737
			"\n" + 
23738
			"interface CloneableMap<K, V extends Cloneable<V>> extends Map<K, V>, Cloneable<CloneableMap<K, V>> {\n" + 
23739
			"}\n" + 
23740
			"\n" + 
23741
			"interface C extends Cloneable<C> {\n" + 
23742
			"}\n" + 
23743
			"public class X {\n" + 
23744
			"	void foo() {\n" + 
23745
			"		CloneableMap<String, C> map = null;\n" + 
23746
			"	}\n" + 
23747
			"}\n",
23748
		},
23749
		"");
23750
}
23751
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100619
23752
public void test0768() {
23753
	this.runNegativeTest(
23754
		new String[] {
23755
			"X.java",
23756
			"public class X {\n" + 
23757
			"	<T extends Runnable, U extends Runnable & T>  T foo1() { return null; }\n" + 
23758
			"	<T extends Y<Object>, U extends Z & T>  T foo2() { return null; }\n" + 
23759
			"	<T extends Y<Object>, U extends T & Z>  T foo3() { return null; }\n" + 
23760
			"	<T extends Y<Object>, U extends W & Z>  T foo4() { return null; }\n" + 
23761
			"}\n" + 
23762
			"\n" + 
23763
			"interface Y<T> {\n" + 
23764
			"}\n" + 
23765
			"\n" + 
23766
			"interface Z extends Y<String> {}\n" + 
23767
			"interface W extends Y<Object> {}\n",
23768
		},
23769
		"----------\n" + 
23770
		"1. ERROR in X.java (at line 2)\n" + 
23771
		"	<T extends Runnable, U extends Runnable & T>  T foo1() { return null; }\n" + 
23772
		"	                                          ^\n" + 
23773
		"The type T is not an interface; it cannot be specified as a bounded parameter\n" + 
23774
		"----------\n" + 
23775
		"2. ERROR in X.java (at line 3)\n" + 
23776
		"	<T extends Y<Object>, U extends Z & T>  T foo2() { return null; }\n" + 
23777
		"	                                    ^\n" + 
23778
		"The type T is not an interface; it cannot be specified as a bounded parameter\n" + 
23779
		"----------\n" + 
23780
		"3. ERROR in X.java (at line 4)\n" + 
23781
		"	<T extends Y<Object>, U extends T & Z>  T foo3() { return null; }\n" + 
23782
		"	                                    ^\n" + 
23783
		"Cannot specify any additional bound Z when first bound is a type parameter\n" + 
23784
		"----------\n" + 
23785
		"4. ERROR in X.java (at line 4)\n" + 
23786
		"	<T extends Y<Object>, U extends T & Z>  T foo3() { return null; }\n" + 
23787
		"	                                    ^\n" + 
23788
		"The interface Y cannot be implemented more than once with different arguments: Y<String> and Y<Object>\n" + 
23789
		"----------\n" + 
23790
		"5. ERROR in X.java (at line 5)\n" + 
23791
		"	<T extends Y<Object>, U extends W & Z>  T foo4() { return null; }\n" + 
23792
		"	                                    ^\n" + 
23793
		"The interface Y cannot be implemented more than once with different arguments: Y<String> and Y<Object>\n" + 
23794
		"----------\n");
23795
}
23796
public void test0769() {
23797
	this.runConformTest(
23798
		new String[] {
23799
			"X.java",
23800
			"class XSuper<T> {\n" + 
23801
			"	T value;\n" + 
23802
			"}\n" + 
23803
			"public class X extends XSuper<String>{\n" + 
23804
			"	public void a() {\n" + 
23805
			"		value += 1;\n" + 
23806
			"		value = value + 1;\n" + 
23807
			"		System.out.println(value);\n" + 
23808
			"	}\n" + 
23809
			"\n" + 
23810
			"	public static void main(final String[] args) {\n" + 
23811
			"		X x = new X();\n" +
23812
			"		x.value = \"[\";\n" +
23813
			"		x.a();\n" + 
23814
			"	}\n" + 
23815
			"}\n",
23816
		},
23817
		"[11");
23818
}
23819
public void test0770() {
23820
	this.runConformTest(
23821
		new String[] {
23822
			"X.java",
23823
			"class XSuper<T> {\n" + 
23824
			"	T value;\n" + 
23825
			"}\n" + 
23826
			"public class X extends XSuper<String>{\n" + 
23827
			"	public void a() {\n" + 
23828
			"		this.value += 1;\n" + 
23829
			"		this.value = this.value + 1;\n" + 
23830
			"		System.out.println(this.value);\n" + 
23831
			"	}\n" + 
23832
			"\n" + 
23833
			"	public static void main(final String[] args) {\n" + 
23834
			"		X x = new X();\n" +
23835
			"		x.value = \"[\";\n" +
23836
			"		x.a();\n" + 
23837
			"	}\n" + 
23838
			"}\n",
23839
		},
23840
		"[11");
23841
}
23842
public void test0771() {
23843
	this.runConformTest(
23844
		new String[] {
23845
			"X.java",
23846
			"class XSuper<T> {\n" + 
23847
			"	T value;\n" + 
23848
			"}\n" + 
23849
			"public class X extends XSuper<String>{\n" + 
23850
			"	public static void a(X x) {\n" + 
23851
			"		x.value += 1;\n" + 
23852
			"		x.value = x.value + 1;\n" + 
23853
			"		System.out.println(x.value);\n" + 
23854
			"	}\n" + 
23855
			"\n" + 
23856
			"	public static void main(final String[] args) {\n" + 
23857
			"		X x = new X();\n" +
23858
			"		x.value = \"[\";\n" +
23859
			"		a(x);\n" + 
23860
			"	}\n" + 
23861
			"}\n",
23862
		},
23863
		"[11");
23864
}
23865
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101794
23866
public void test0772() {
23867
	this.runConformTest(
23868
		new String[] {
23869
			"X.java",
23870
			"interface Foo<T> {\n" + 
23871
			"  public T getIt();\n" + 
23872
			"}\n" + 
23873
			"\n" + 
23874
			"class FooImpl implements Foo {\n" + 
23875
			"  public String getIt() {\n" + 
23876
			"    return null;\n" + 
23877
			"  }\n" + 
23878
			"}\n" + 
23879
			"public class X {\n" + 
23880
			"  public void doIt() {\n" + 
23881
			"    Object s = new FooImpl().getIt();\n" + 
23882
			"  }\n" + 
23883
			"}\n",
23884
		},
23885
		"");
23886
	this.runConformTest(
23887
		new String[] {
23888
			"X.java",
23889
			"public class X {\n" + 
23890
			"  public void doIt() {\n" + 
23891
			"    Object s = new FooImpl().getIt();\n" + 
23892
			"  }\n" + 
23893
			"}\n",
23894
		},
23895
		"",
23896
		null,
23897
		false,
23898
		null);
23899
		String expectedOutput =
23900
			"  // Method descriptor #18 ()Ljava/lang/Object;\n" + 
23901
			"  // Stack: 1, Locals: 1\n" + 
23902
			"  public bridge synthetic java.lang.Object getIt();\n" + 
23903
			"    0  aload_0\n" + 
23904
			"    1  invokevirtual FooImpl.getIt() : java.lang.String [19]\n" + 
23905
			"    4  areturn\n" + 
23906
			"      Line numbers:\n" + 
23907
			"        [pc: 0, line: 1]\n";
23908
		
23909
		try {
23910
			File f = new File(OUTPUT_DIR + File.separator + "FooImpl.class");
23911
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
23912
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
23913
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
23914
			int index = result.indexOf(expectedOutput);
23915
			if (index == -1 || expectedOutput.length() == 0) {
23916
				System.out.println(Util.displayString(result, 3));
23917
			}
23918
			if (index == -1) {
23919
				assertEquals("Wrong contents", expectedOutput, result);
23920
			}
23921
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
23922
			assertTrue(false);
23923
		} catch (IOException e) {
23924
			assertTrue(false);
23925
		}	
23926
}
23927
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101794 - variation
23928
public void test0773() {
23929
	this.runConformTest(
23930
		new String[] {
23931
			"X.java",
23932
			"interface Foo<T extends Exception> {\n" + 
23933
			"  public T getIt() throws T;\n" + 
23934
			"}\n" + 
23935
			"\n" + 
23936
			"class FooImpl implements Foo {\n" + 
23937
			"  public NullPointerException getIt() {\n" + 
23938
			"    return null;\n" + 
23939
			"  }\n" + 
23940
			"}\n" + 
23941
			"public class X {\n" + 
23942
			"  public void doIt() {\n" + 
23943
			"    Object s = new FooImpl().getIt();\n" + 
23944
			"  }\n" + 
23945
			"}\n",
23946
		},
23947
		"");
23948
	this.runConformTest(
23949
		new String[] {
23950
			"X.java",
23951
			"public class X {\n" + 
23952
			"  public void doIt() {\n" + 
23953
			"    Object s = new FooImpl().getIt();\n" + 
23954
			"  }\n" + 
23955
			"}\n",
23956
		},
23957
		"",
23958
		null,
23959
		false,
23960
		null);
23961
		String expectedOutput =
23962
			"  // Method descriptor #18 ()Ljava/lang/Exception;\n" + 
23963
			"  // Stack: 1, Locals: 1\n" + 
23964
			"  public bridge synthetic java.lang.Exception getIt() throws java.lang.Exception;\n" + 
23965
			"    0  aload_0\n" + 
23966
			"    1  invokevirtual FooImpl.getIt() : java.lang.NullPointerException [22]\n" + 
23967
			"    4  areturn\n" + 
23968
			"      Line numbers:\n" + 
23969
			"        [pc: 0, line: 1]\n";
23970
		
23971
		try {
23972
			File f = new File(OUTPUT_DIR + File.separator + "FooImpl.class");
23973
			byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
23974
			ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
23975
			String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
23976
			int index = result.indexOf(expectedOutput);
23977
			if (index == -1 || expectedOutput.length() == 0) {
23978
				System.out.println(Util.displayString(result, 3));
23979
			}
23980
			if (index == -1) {
23981
				assertEquals("Wrong contents", expectedOutput, result);
23982
			}
23983
		} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
23984
			assertTrue(false);
23985
		} catch (IOException e) {
23986
			assertTrue(false);
23987
		}	
23988
}
23989
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=98532
23990
public void test0774() {
23991
	this.runNegativeTest(
23992
		new String[] {
23993
			"X.java",
23994
			"public class X<T> {\n" + 
23995
			"	static class StaticInnerNoParam {\n" + 
23996
			"		T x;\n" + 
23997
			"	}\n" + 
23998
			"	class NonStaticInnerParam<T> {}	\n" + 
23999
			"	static class StaticInnerParam<T> {	}\n" + 
24000
			"	<T> void foo(T t) {}\n" + 
24001
			"	static <T> void bar(T t) {}\n" + 
24002
			"	<T> X(T t) {}\n" + 
24003
			"	\n" + 
24004
			"	class U {}\n" + 
24005
			"	<U> void foo2(U t) {}\n" + 
24006
			"	static <U> void bar2(U t) {}\n" + 
24007
			"	class NonStaticInnerParam2<U> {}	\n" + 
24008
			"	static class StaticInnerParam2<U> {}	\n" + 
24009
			"}\n",
24010
		},
24011
		"----------\n" + 
24012
		"1. ERROR in X.java (at line 3)\n" + 
24013
		"	T x;\n" + 
24014
		"	^\n" + 
24015
		"Cannot make a static reference to the non-static type T\n" + 
24016
		"----------\n" + 
24017
		"2. WARNING in X.java (at line 5)\n" + 
24018
		"	class NonStaticInnerParam<T> {}	\n" + 
24019
		"	                          ^\n" + 
24020
		"The type parameter T is hiding the type T\n" + 
24021
		"----------\n" + 
24022
		"3. WARNING in X.java (at line 7)\n" + 
24023
		"	<T> void foo(T t) {}\n" + 
24024
		"	 ^\n" + 
24025
		"The type parameter T is hiding the type T\n" + 
24026
		"----------\n" + 
24027
		"4. WARNING in X.java (at line 9)\n" + 
24028
		"	<T> X(T t) {}\n" + 
24029
		"	 ^\n" + 
24030
		"The type parameter T is hiding the type T\n" + 
24031
		"----------\n" + 
24032
		"5. WARNING in X.java (at line 12)\n" + 
24033
		"	<U> void foo2(U t) {}\n" + 
24034
		"	 ^\n" + 
24035
		"The type parameter U is hiding the type X<T>.U\n" + 
24036
		"----------\n" + 
24037
		"6. WARNING in X.java (at line 13)\n" + 
24038
		"	static <U> void bar2(U t) {}\n" + 
24039
		"	        ^\n" + 
24040
		"The type parameter U is hiding the type X<T>.U\n" + 
24041
		"----------\n" + 
24042
		"7. WARNING in X.java (at line 14)\n" + 
24043
		"	class NonStaticInnerParam2<U> {}	\n" + 
24044
		"	                           ^\n" + 
24045
		"The type parameter U is hiding the type X<T>.U\n" + 
24046
		"----------\n" + 
24047
		"8. WARNING in X.java (at line 15)\n" + 
24048
		"	static class StaticInnerParam2<U> {}	\n" + 
24049
		"	                               ^\n" + 
24050
		"The type parameter U is hiding the type X<T>.U\n" + 
24051
		"----------\n");
24052
}
24053
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100153
24054
public void test0775() {
24055
	this.runConformTest(
24056
		new String[] {
24057
			"X.java",
24058
			"public class X<T extends X<T>> {\n" + 
24059
			"	void foo1(X<? extends T> x) {}\n" + 
24060
			"	void foo2(X<? super T> x) {}\n" + 
24061
			"}\n",
24062
		},
24063
		"");
24064
}
24065
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103023
24066
public void test0776() {
24067
	this.runConformTest(
24068
		new String[] {
24069
			"X.java",
24070
			"import java.util.*;\n" + 
24071
			"\n" + 
24072
			"public class X<T extends Comparable<? super T>> {\n" + 
24073
			"\n" + 
24074
			"    abstract class Foo<E> implements I<Foo<? extends E>> {}\n" + 
24075
			"\n" + 
24076
			"    abstract class Bar<E> implements I<Bar<? extends E>> {}\n" + 
24077
			"\n" + 
24078
			"    public void bar(List<Foo<T>> f, List<Bar<T>> b) {\n" + 
24079
			"	foo(f, b);\n" + 
24080
			"    }\n" + 
24081
			"\n" + 
24082
			"    <C> void foo(List<? extends C> f, List<? extends C> b) {\n" + 
24083
			"	System.out.println(\"SUCCESS\");\n" + 
24084
			"    }\n" + 
24085
			"    public static void main(String... args) {\n" + 
24086
			"	new X().bar(null, null);\n" + 
24087
			"    }\n" + 
24088
			"}\n" + 
24089
			"interface I<U> {}\n",
24090
		},
24091
		"SUCCESS");
24092
}
24093
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103472
24094
public void test0777() {
24095
	this.runNegativeTest(
24096
		new String[] {
24097
			"X.java",
24098
			"public class X {\n" + 
24099
			"	public interface B<T> {\n" + 
24100
			"		public T a();\n" + 
24101
			"	}\n" + 
24102
			"\n" + 
24103
			"	public interface C extends B {\n" + 
24104
			"	}\n" + 
24105
			"\n" + 
24106
			"	public class D implements B<Integer> {\n" + 
24107
			"		public Integer a() {\n" + 
24108
			"			return 0;\n" + 
24109
			"		}\n" + 
24110
			"	}\n" + 
24111
			"\n" + 
24112
			"	// Illegal\n" + 
24113
			"	public class E implements B<Integer>, C {\n" + 
24114
			"		public Integer a() {\n" + 
24115
			"			return 0;\n" + 
24116
			"		}\n" + 
24117
			"	}\n" + 
24118
			"\n" + 
24119
			"	// why is this allowed?\n" + 
24120
			"	public class F extends D implements C {\n" + 
24121
			"		public Integer a() {\n" + 
24122
			"			return 0;\n" + 
24123
			"		}\n" + 
24124
			"	}\n" + 
24125
			"\n" + 
24126
			"	public interface G<T> {\n" + 
24127
			"		public void a(T pArg);\n" + 
24128
			"	}\n" + 
24129
			"\n" + 
24130
			"	public interface H extends G {\n" + 
24131
			"		public Object b();\n" + 
24132
			"	}\n" + 
24133
			"\n" + 
24134
			"	public class I implements G<Integer> {\n" + 
24135
			"		public void a(Integer pInt) {\n" + 
24136
			"		}\n" + 
24137
			"	}\n" + 
24138
			"\n" + 
24139
			"	// Illegal. Huh?\n" + 
24140
			"	public class J extends I implements G {\n" + 
24141
			"		public Integer a() {\n" + 
24142
			"			return 0;\n" + 
24143
			"		}\n" + 
24144
			"	}\n" + 
24145
			"}\n",
24146
		},
24147
		"----------\n" + 
24148
		"1. WARNING in X.java (at line 6)\n" + 
24149
		"	public interface C extends B {\n" + 
24150
		"	                           ^\n" + 
24151
		"X.B is a raw type. References to generic type X.B<T> should be parameterized\n" + 
24152
		"----------\n" + 
24153
		"2. ERROR in X.java (at line 16)\n" + 
24154
		"	public class E implements B<Integer>, C {\n" + 
24155
		"	             ^\n" + 
24156
		"The interface B cannot be implemented more than once with different arguments: X.B and X.B<Integer>\n" + 
24157
		"----------\n" + 
24158
		"3. ERROR in X.java (at line 23)\n" + 
24159
		"	public class F extends D implements C {\n" + 
24160
		"	             ^\n" + 
24161
		"The interface B cannot be implemented more than once with different arguments: X.B<Integer> and X.B\n" + 
24162
		"----------\n" + 
24163
		"4. WARNING in X.java (at line 24)\n" + 
24164
		"	public Integer a() {\n" + 
24165
		"	               ^^^\n" + 
24166
		"The method a() of type X.F should be tagged with @Override since it actually overrides a superclass method\n" + 
24167
		"----------\n" + 
24168
		"5. WARNING in X.java (at line 33)\n" + 
24169
		"	public interface H extends G {\n" + 
24170
		"	                           ^\n" + 
24171
		"X.G is a raw type. References to generic type X.G<T> should be parameterized\n" + 
24172
		"----------\n" + 
24173
		"6. ERROR in X.java (at line 43)\n" + 
24174
		"	public class J extends I implements G {\n" + 
24175
		"	             ^\n" + 
24176
		"The interface G cannot be implemented more than once with different arguments: X.G<Integer> and X.G\n" + 
24177
		"----------\n" + 
24178
		"7. WARNING in X.java (at line 43)\n" + 
24179
		"	public class J extends I implements G {\n" + 
24180
		"	                                    ^\n" + 
24181
		"X.G is a raw type. References to generic type X.G<T> should be parameterized\n" + 
24182
		"----------\n");
24183
}
24184
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103472 - variation
24185
public void test0778() {
24186
	this.runNegativeTest(
24187
		new String[] {
24188
			"X.java",
24189
			"public class X {\n" + 
24190
			"	interface B<T> {}\n" + 
24191
			"\n" + 
24192
			"	interface C extends B {}\n" + 
24193
			"\n" + 
24194
			"	class D implements B<Integer> {}\n" + 
24195
			"\n" + 
24196
			"	class F extends D implements C {}\n" + 
24197
			"	\n" + 
24198
			"	class V<U extends D & C> {}\n" + 
24199
			"}\n",
24200
		},
24201
		"----------\n" + 
24202
		"1. WARNING in X.java (at line 4)\n" + 
24203
		"	interface C extends B {}\n" + 
24204
		"	                    ^\n" + 
24205
		"X.B is a raw type. References to generic type X.B<T> should be parameterized\n" + 
24206
		"----------\n" + 
24207
		"2. ERROR in X.java (at line 8)\n" + 
24208
		"	class F extends D implements C {}\n" + 
24209
		"	      ^\n" + 
24210
		"The interface B cannot be implemented more than once with different arguments: X.B<Integer> and X.B\n" + 
24211
		"----------\n" + 
24212
		"3. ERROR in X.java (at line 10)\n" + 
24213
		"	class V<U extends D & C> {}\n" + 
24214
		"	                      ^\n" + 
24215
		"The interface B cannot be implemented more than once with different arguments: X.B and X.B<Integer>\n" + 
24216
		"----------\n");
24217
}
24218
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103227
24219
public void test0779() {
24220
	this.runConformTest(
24221
		new String[] {
24222
			"X.java",
24223
			"import java.util.AbstractList;\n" + 
24224
			"import java.util.List;\n" + 
24225
			"\n" + 
24226
			"public class X {\n" + 
24227
			"	private static class Entry {\n" + 
24228
			"		public void doIt(final List<? extends String> args) {\n" + 
24229
			"			List<String> list = new AbstractList<String>() {\n" + 
24230
			"				@Override public int size() { return 0; }\n" + 
24231
			"				@Override public String get(int i) { return args.get(i); }\n" + 
24232
			"			};\n" + 
24233
			"		}\n" + 
24234
			"	}\n" + 
24235
			"	public static void main(String[] args) {\n" + 
24236
			"		new Entry().doIt(null);\n" + 
24237
			"		System.out.println(\"SUCCESS\");\n" + 
24238
			"	}\n" + 
24239
			"}\n",
24240
		},
24241
		"SUCCESS");
24242
	
24243
	String expectedOutput =
24244
		"  // Method descriptor #31 (I)Ljava/lang/Object;\n" + 
24245
		"  // Stack: 2, Locals: 2\n" + 
24246
		"  public bridge synthetic java.lang.Object get(int arg0);\n" + 
24247
		"    0  aload_0\n" + 
24248
		"    1  iload_1\n" + 
24249
		"    2  invokevirtual X$Entry$1.get(int) : java.lang.String [36]\n" + 
24250
		"    5  areturn\n" + 
24251
		"      Line numbers:\n" + 
24252
		"        [pc: 0, line: 1]\n";
24253
	
24254
	// check no unnecessary checkcast on bridge method for X$1
24255
	try {
24256
		File f = new File(OUTPUT_DIR + File.separator + "X$Entry$1.class");
24257
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
24258
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
24259
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
24260
		int index = result.indexOf(expectedOutput);
24261
		if (index == -1 || expectedOutput.length() == 0) {
24262
			System.out.println(Util.displayString(result, 3));
24263
		}
24264
		if (index == -1) {
24265
			assertEquals("Wrong contents", expectedOutput, result);
24266
		}
24267
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
24268
		assertTrue(false);
24269
	} catch (IOException e) {
24270
		assertTrue(false);
24271
	}
24272
}
24273
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103227 - variation
24274
public void test0780() {
24275
	this.runConformTest(
24276
		new String[] {
24277
			"X.java",
24278
			"import java.util.*;\n" + 
24279
			"\n" + 
24280
			"public class X {\n" + 
24281
			"	long foo(List<? extends Long> list) {\n" + 
24282
			"		return list.get(0);\n" + 
24283
			"	}\n" + 
24284
			"	public static void main(String[] args) {\n" + 
24285
			"		List<Long> list = new ArrayList<Long>();\n" + 
24286
			"		list.add(123L);\n" + 
24287
			"		System.out.println(new X().foo(list));\n" + 
24288
			"	}\n" + 
24289
			"}\n",
24290
		},
24291
		"123");
24292
}
24293
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104109
24294
public void test0781() {
24295
	this.runNegativeTest(
24296
		new String[] {
24297
			"X.java",
24298
			"public class X {\n" + 
24299
			"\n" + 
24300
			"    public static <E, T extends E & Comparable<? super T>> Foo<E> doIt(T t) {\n" + 
24301
			"        return null;\n" + 
24302
			"    }\n" + 
24303
			"    \n" + 
24304
			"    interface Foo<E> {\n" + 
24305
			"        boolean ok(E e);\n" + 
24306
			"    }\n" + 
24307
			"}\n",
24308
		},
24309
		"----------\n" + 
24310
		"1. ERROR in X.java (at line 3)\n" + 
24311
		"	public static <E, T extends E & Comparable<? super T>> Foo<E> doIt(T t) {\n" + 
24312
		"	                                ^^^^^^^^^^\n" + 
24313
		"Cannot specify any additional bound Comparable<? super T> when first bound is a type parameter\n" + 
24314
		"----------\n");
24315
}
24316
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104082
24317
public void test0782() {
24318
	this.runConformTest(
24319
		new String[] {
24320
			"X.java",
24321
			"import java.lang.reflect.*;\n" + 
24322
			"import java.util.*;\n" + 
24323
			"\n" + 
24324
			"interface StoredObject {\n" + 
24325
			"	String getUid();\n" + 
24326
			"	String getName();\n" + 
24327
			"	String getDescription();\n" + 
24328
			"}\n" + 
24329
			"\n" + 
24330
			"interface GraphDiagramNode // extends Comparable\n" + 
24331
			"{\n" + 
24332
			"}\n" + 
24333
			"\n" + 
24334
			"public class X<ObjectType extends StoredObject, ParentType extends StoredObject> implements GraphDiagramNode {\n" + 
24335
			"	private final JccsGraphDiagramModel model;\n" + 
24336
			"	private final X<? extends ParentType, ?> parent;\n" + 
24337
			"	private final ObjectType object;\n" + 
24338
			"\n" + 
24339
			"	public class JccsGraphDiagramModel {\n" + 
24340
			"	}\n" + 
24341
			"\n" + 
24342
			"	public interface GraphDiagramModel {\n" + 
24343
			"	}\n" + 
24344
			"\n" + 
24345
			"	public class Dependency {\n" + 
24346
			"\n" + 
24347
			"	}\n" + 
24348
			"\n" + 
24349
			"	public X(JccsGraphDiagramModel argModel, X<? extends ParentType, ?> argParent, ObjectType argObject) {\n" + 
24350
			"		model = argModel;\n" + 
24351
			"		parent = argParent;\n" + 
24352
			"		object = argObject;\n" + 
24353
			"	}\n" + 
24354
			"\n" + 
24355
			"	protected <ChildType extends StoredObject> Collection<? extends X<ChildType, ? super ObjectType>> createChildren(\n" + 
24356
			"			Iterator<ChildType> argData, Class<? extends X<ChildType, ? super ObjectType>> argChildNodeClass,\n" + 
24357
			"			Class<? extends StoredObject> argInterface) {\n" + 
24358
			"		Collection<X<ChildType, ? super ObjectType>> output = new LinkedList<X<ChildType, ? super ObjectType>>();\n" + 
24359
			"\n" + 
24360
			"		try {\n" + 
24361
			"			while (argData.hasNext()) {\n" + 
24362
			"				ChildType next = argData.next();\n" + 
24363
			"				Constructor<? extends X<ChildType, ? super ObjectType>> constructor = argChildNodeClass.getConstructor(\n" + 
24364
			"						JccsGraphDiagramModel.class, getClass(), argInterface);\n" + 
24365
			"\n" + 
24366
			"				output.add(constructor.newInstance(model, this, next));\n" + 
24367
			"			}\n" + 
24368
			"		} catch (Exception x) {\n" + 
24369
			"			x.printStackTrace();\n" + 
24370
			"		}\n" + 
24371
			"\n" + 
24372
			"		return output;\n" + 
24373
			"	}\n" + 
24374
			"}\n",
24375
		},
24376
		"");
24377
}
24378
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104167
24379
public void test0783() {
24380
	this.runNegativeTest(
24381
		new String[] {
24382
			"X.java",
24383
			"public class X<T> {\n" + 
24384
			"  private static class B{\n" + 
24385
			"    private int foo; //incorrectly identified as unused\n" + 
24386
			"  }\n" + 
24387
			"  void bar(B b){\n" + 
24388
			"    if (b.foo == 0)\n" + 
24389
			"      return;\n" + 
24390
			"  }\n" + 
24391
			"  Zork z;\n" +
24392
			"}\n",
24393
		},
24394
		"----------\n" + 
24395
		"1. ERROR in X.java (at line 9)\n" + 
24396
		"	Zork z;\n" + 
24397
		"	^^^^\n" + 
24398
		"Zork cannot be resolved to a type\n" + 
24399
		"----------\n");
24400
}
24401
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104082 - variation
24402
public void test0784() {
24403
	this.runNegativeTest(
24404
		new String[] {
24405
			"X.java",
24406
			"public class X<T, U> {\n" + 
24407
			"	X<? extends U, ?> parent;\n" + 
24408
			"\n" + 
24409
			"	public X(X<? extends U, ?> parent) {\n" + 
24410
			"		this.parent = parent;\n" + 
24411
			"	}\n" + 
24412
			"}\n",
24413
		},
24414
		"");
24415
}
24416
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103528
24417
public void test0785() {
24418
	this.runNegativeTest(
24419
		new String[] {
24420
			"X.java",
24421
			"import java.util.*;\n" + 
24422
			"public class X {\n" + 
24423
			"    <T extends Collection<? extends Number>> T getLonger(T t1, T t2) {\n" + 
24424
			"        return t1.size() > t2.size() ? t1 : t2;\n" + 
24425
			"    }\n" + 
24426
			"    \n" + 
24427
			"    void m(HashSet<?> list, ArrayList<?> set) {\n" + 
24428
			"        getLonger(list, set);\n" + 
24429
			"    }\n" + 
24430
			"}\n",
24431
		},
24432
		"----------\n" + 
24433
		"1. ERROR in X.java (at line 8)\n" + 
24434
		"	getLonger(list, set);\n" + 
24435
		"	^^^^^^^^^\n" + 
24436
		"Bound mismatch: The generic method getLonger(T, T) of type X is not applicable for the arguments (HashSet<capture#1-of ?>, ArrayList<capture#2-of ?>). The inferred type AbstractCollection<? extends Object>&Cloneable&Serializable is not a valid substitute for the bounded parameter <T extends Collection<? extends Number>>\n" + 
24437
		"----------\n");
24438
}
24439
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103528 - variation
24440
public void test0786() {
24441
	this.runConformTest(
24442
		new String[] {
24443
			"X.java",
24444
			"import java.util.*;\n" + 
24445
			"public class X {\n" + 
24446
			"    <T extends Collection<? extends Object>> T getLonger(T t1, T t2) {\n" + 
24447
			"        return t1.size() > t2.size() ? t1 : t2;\n" + 
24448
			"    }\n" + 
24449
			"    \n" + 
24450
			"    void m(HashSet<?> list, ArrayList<?> set) {\n" + 
24451
			"        getLonger(list, set);\n" + 
24452
			"    }\n" + 
24453
			"}\n",
24454
		},
24455
		"");
24456
}
24457
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103528 - variation
24458
public void test0787() {
24459
	this.runNegativeTest(
24460
		new String[] {
24461
			"X.java",
24462
			"import java.util.*;\n" + 
24463
			"public class X<U> {\n" + 
24464
			"    <T extends Collection<? extends U>> T getLonger(T t1, T t2) {\n" + 
24465
			"        return t1.size() > t2.size() ? t1 : t2;\n" + 
24466
			"    }\n" + 
24467
			"    \n" + 
24468
			"    void m(HashSet<?> list, ArrayList<?> set) {\n" + 
24469
			"        getLonger(list, set);\n" + 
24470
			"    }\n" + 
24471
			"}\n",
24472
		},
24473
		"----------\n" + 
24474
		"1. ERROR in X.java (at line 8)\n" + 
24475
		"	getLonger(list, set);\n" + 
24476
		"	^^^^^^^^^\n" + 
24477
		"Bound mismatch: The generic method getLonger(T, T) of type X<U> is not applicable for the arguments (HashSet<capture#1-of ?>, ArrayList<capture#2-of ?>). The inferred type AbstractCollection<? extends Object>&Cloneable&Serializable is not a valid substitute for the bounded parameter <T extends Collection<? extends U>>\n" + 
24478
		"----------\n");
24479
}
24480
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103994
24481
public void test0788() {
24482
	this.runConformTest(
24483
		new String[] {
24484
			"test/A.java",
24485
			"package test;\n" + 
24486
			"\n" + 
24487
			"public class A<C extends java.nio.channels.Channel>\n" + 
24488
			"{\n" + 
24489
			"	class B\n" + 
24490
			"		extends A<java.nio.channels.SocketChannel>\n" + 
24491
			"	{\n" + 
24492
			"	}\n" + 
24493
			"}\n",
24494
			"java/nio/channels/spi/AbstractSelectableChannel.java",
24495
			"package java.nio.channels.spi;\n" + 
24496
			"\n" + 
24497
			"public abstract class AbstractSelectableChannel\n" + 
24498
			"	extends java.nio.channels.SelectableChannel\n" + 
24499
			"{\n" + 
24500
			"}\n", 
24501
		},
24502
		"");
24503
}
24504
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103994 - variation (change ordering of files should have no effect)
24505
public void test0789() {
24506
	this.runConformTest(
24507
		new String[] {
24508
			"java/nio/channels/spi/AbstractSelectableChannel.java",
24509
			"package java.nio.channels.spi;\n" + 
24510
			"\n" + 
24511
			"public abstract class AbstractSelectableChannel\n" + 
24512
			"	extends java.nio.channels.SelectableChannel\n" + 
24513
			"{\n" + 
24514
			"}\n", 
24515
			"test/A.java",
24516
			"package test;\n" + 
24517
			"\n" + 
24518
			"public class A<C extends java.nio.channels.Channel>\n" + 
24519
			"{\n" + 
24520
			"	class B\n" + 
24521
			"		extends A<java.nio.channels.SocketChannel>\n" + 
24522
			"	{\n" + 
24523
			"	}\n" + 
24524
			"}\n",
24525
		},
24526
		"");
24527
}
24528
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=103485
24529
public void test0790() {
24530
	this.runNegativeTest(
24531
		new String[] {
24532
			"X.java",
24533
			"public class X {\n" + 
24534
			"	<T extends Comparable<T>> boolean isGreater(T t1, T t2) {\n" + 
24535
			"		return t1.compareTo(t2) > 0 ? true : false; \n" + 
24536
			"	}\n" + 
24537
			"\n" + 
24538
			"	void method1(Integer i, Double d) {\n" + 
24539
			"		if (isGreater(i, d)) \n" + 
24540
			"			System.out.println(\"GREATER\");\n" + 
24541
			"		else\n" + 
24542
			"			System.out.println(\"LOWER\");\n" + 
24543
			"	}\n" + 
24544
			"	void method2(Integer i, Double d) {\n" + 
24545
			"		Comparable<? extends Number> c1= i;\n" + 
24546
			"		Comparable<? extends Number> c2= d;\n" + 
24547
			"		isGreater(c1, c2);\n" + 
24548
			"	}	\n" + 
24549
			"	void method3(Integer i, Double d) {\n" + 
24550
			"		Comparable c1= i;\n" + 
24551
			"		Comparable c2= d;\n" + 
24552
			"		isGreater(c1, c2);\n" + 
24553
			"	}	\n" + 
24554
			"	public static void main(String[] args) {\n" + 
24555
			"		Integer i = 1;\n" + 
24556
			"		Double d = 2.0;\n" + 
24557
			"		new X().method1(i, d);\n" + 
24558
			"		new X().method2(i, d);\n" + 
24559
			"		new X().method3(i, d);\n" + 
24560
			"	}\n" + 
24561
			"}\n",
24562
		},
24563
		"----------\n" + 
24564
		"1. ERROR in X.java (at line 7)\n" + 
24565
		"	if (isGreater(i, d)) \n" + 
24566
		"	    ^^^^^^^^^\n" + 
24567
		"Bound mismatch: The generic method isGreater(T, T) of type X is not applicable for the arguments (Integer, Double). The inferred type Number&Comparable<?> is not a valid substitute for the bounded parameter <T extends Comparable<T>>\n" + 
24568
		"----------\n" + 
24569
		"2. ERROR in X.java (at line 15)\n" + 
24570
		"	isGreater(c1, c2);\n" + 
24571
		"	^^^^^^^^^\n" + 
24572
		"Bound mismatch: The generic method isGreater(T, T) of type X is not applicable for the arguments (Comparable<capture#1-of ? extends Number>, Comparable<capture#2-of ? extends Number>). The inferred type Comparable<? extends Number> is not a valid substitute for the bounded parameter <T extends Comparable<T>>\n" + 
24573
		"----------\n" + 
24574
		"3. WARNING in X.java (at line 18)\n" + 
24575
		"	Comparable c1= i;\n" + 
24576
		"	^^^^^^^^^^\n" + 
24577
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
24578
		"----------\n" + 
24579
		"4. WARNING in X.java (at line 19)\n" + 
24580
		"	Comparable c2= d;\n" + 
24581
		"	^^^^^^^^^^\n" + 
24582
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
24583
		"----------\n" + 
24584
		"5. WARNING in X.java (at line 20)\n" + 
24585
		"	isGreater(c1, c2);\n" + 
24586
		"	^^^^^^^^^^^^^^^^^\n" + 
24587
		"Type safety: Unchecked invocation isGreater(Comparable, Comparable) of the generic method isGreater(T, T) of type X\n" + 
24588
		"----------\n");
24589
}
24590
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104655
24591
// **
24592
public void test0791() {
24593
	this.runConformTest(
24594
		new String[] {
24595
			"X.java",
24596
			"public class X {\n" + 
24597
			"  <Sup, E1 extends Sup, E2 extends Sup> Sup method1(boolean b, E1 e1, E2 e2) {\n" + 
24598
			"    if (b)\n" + 
24599
			"      return e1;\n" + 
24600
			"    else\n" + 
24601
			"      return e2;\n" + 
24602
			"  }\n" + 
24603
			"\n" + 
24604
			"  <Sup, E1 extends Sup, E2 extends Sup> Sup method2(boolean b, E1 e1, E2 e2) {\n" + 
24605
			"    return b ? e1 : e2;\n" + 
24606
			"  }\n" + 
24607
			"}\n",
24608
		},
24609
		"");
24610
}
24611
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104649
24612
// **
24613
public void test0792() {
24614
	this.runConformTest(
24615
		new String[] {
24616
			"X.java",
24617
			"public class X<E> {\n" + 
24618
			"	void shouldcompile() {\n" + 
24619
			"		java.util.Collections.max(null);\n" + 
24620
			"	}\n" + 
24621
			"}\n",
24622
		},
24623
		"");
24624
}
24625
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105635
24626
public void test0793() {
24627
	this.runNegativeTest(
24628
		new String[] {
24629
			"X.java",
24630
			"class X { \n" +
24631
			"	public java.util.List<Integer> i,j[],k;\n" +
24632
			"	void m() {\n" +
24633
			"		  i[0] = null;\n" +
24634
			"		  j[0] = null;\n" +
24635
			"		  k[0] = null;\n" +
24636
			"	}\n" +
24637
			"}",
24638
		},
24639
		"----------\n" + 
24640
		"1. ERROR in X.java (at line 4)\n" + 
24641
		"	i[0] = null;\n" + 
24642
		"	^^^^\n" + 
24643
		"The type of the expression must be an array type but it resolved to List<Integer>\n" + 
24644
		"----------\n" + 
24645
		"2. ERROR in X.java (at line 6)\n" + 
24646
		"	k[0] = null;\n" + 
24647
		"	^^^^\n" + 
24648
		"The type of the expression must be an array type but it resolved to List<Integer>\n" + 
24649
		"----------\n");
24650
}
24651
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105635
24652
public void test0794() {
24653
	this.runNegativeTest(
24654
		new String[] {
24655
			"X.java",
24656
			"import java.util.List;\n" +
24657
			"class X { \n" +
24658
			"	public List<Integer> i,j[],k;\n" +
24659
			"	void m() {\n" +
24660
			"		  i[0] = null;\n" +
24661
			"		  j[0] = null;\n" +
24662
			"		  k[0] = null;\n" +
24663
			"	}\n" +
24664
			"}",
24665
		},
24666
		"----------\n" + 
24667
		"1. ERROR in X.java (at line 5)\n" + 
24668
		"	i[0] = null;\n" + 
24669
		"	^^^^\n" + 
24670
		"The type of the expression must be an array type but it resolved to List<Integer>\n" + 
24671
		"----------\n" + 
24672
		"2. ERROR in X.java (at line 7)\n" + 
24673
		"	k[0] = null;\n" + 
24674
		"	^^^^\n" + 
24675
		"The type of the expression must be an array type but it resolved to List<Integer>\n" + 
24676
		"----------\n");
24677
}
24678
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106297
24679
public void test0795() {
24680
	this.runConformTest(
24681
		new String[] {
24682
			"X.java",
24683
			"public class X<T> { \n" + 
24684
			"		 class B {\n" + 
24685
			"			 B() {\n" + 
24686
			"				 System.out.println(\"SUCCESS\");\n" + 
24687
			"			 }\n" + 
24688
			"		 }\n" + 
24689
			"		 static { \n" + 
24690
			"		 		 new X<String>().new B() {};\n" + 
24691
			"		 }\n" + 
24692
			"		 public static void main(String[] args) {\n" + 
24693
			"			\n" + 
24694
			"		}\n" + 
24695
			"}\n",
24696
		},
24697
		"SUCCESS");
24698
}
24699
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106297 - variation
24700
public void test0796() {
24701
	this.runNegativeTest(
24702
		new String[] {
24703
			"X.java",
24704
			"public class X<T> { \n" + 
24705
			"		 class B {\n" + 
24706
			"			 B(T t) {\n" + 
24707
			"				 System.out.println(\"SUCCESS\");\n" + 
24708
			"			 }\n" + 
24709
			"		 }\n" + 
24710
			"		 static { \n" + 
24711
			"		 		 new X<String>().new B(12) {};\n" + 
24712
			"		 }\n" + 
24713
			"		 public static void main(String[] args) {\n" + 
24714
			"			\n" + 
24715
			"		}\n" + 
24716
			"}\n",
24717
		},
24718
		"----------\n" + 
24719
		"1. ERROR in X.java (at line 8)\n" + 
24720
		"	new X<String>().new B(12) {};\n" + 
24721
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24722
		"The constructor X<String>.B(int) is undefined\n" + 
24723
		"----------\n");
24724
}
24725
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106297 - variation
24726
public void test0797() {
24727
	this.runConformTest(
24728
		new String[] {
24729
			"X.java",
24730
			"public class X<T> { \n" + 
24731
			"		 class B {\n" + 
24732
			"			 B() {\n" + 
24733
			"				 System.out.println(\"SUCCESS\");\n" + 
24734
			"			 }\n" + 
24735
			"		 }\n" + 
24736
			"		 static { \n" + 
24737
			"		 		 new X<String>().new B();\n" + 
24738
			"		 }\n" + 
24739
			"		 public static void main(String[] args) {\n" + 
24740
			"			\n" + 
24741
			"		}\n" + 
24742
			"}\n",
24743
		},
24744
		"SUCCESS");
24745
}
24746
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106284
24747
public void test0798() {
24748
	this.runNegativeTest(
24749
		new String[] {
24750
			"X.java",
24751
			"import java.math.BigDecimal;\n" + 
24752
			"\n" + 
24753
			"public class X\n" + 
24754
			"{\n" + 
24755
			"    private static <T extends Comparable<? super T>> T max(T... elems)\n" + 
24756
			"    {\n" + 
24757
			"        T max=null;\n" + 
24758
			"        for (T elem : elems)\n" + 
24759
			"            if (max == null || max.compareTo(elem) < 0)\n" + 
24760
			"                max=elem;\n" + 
24761
			"        return max;\n" + 
24762
			"    }\n" + 
24763
			"\n" + 
24764
			"    public static void main(String[] args)\n" + 
24765
			"    {\n" + 
24766
			"        System.out.println(max(1, 2.0, new BigDecimal(Math.PI)));\n" + 
24767
			"    }\n" + 
24768
			"}\n",
24769
		},
24770
		"----------\n" + 
24771
		"1. ERROR in X.java (at line 16)\n" + 
24772
		"	System.out.println(max(1, 2.0, new BigDecimal(Math.PI)));\n" + 
24773
		"	                   ^^^\n" + 
24774
		"Bound mismatch: The generic method max(T...) of type X is not applicable for the arguments (Integer, Double, BigDecimal). The inferred type Number&Comparable<?> is not a valid substitute for the bounded parameter <T extends Comparable<? super T>>\n" + 
24775
		"----------\n");
24776
}
24777
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105531
24778
public void test0799() {
24779
	this.runNegativeTest(
24780
		new String[] {
24781
			"X.java",
24782
			"public class X<T> {\n" + 
24783
			"	Y first;\n" + 
24784
			"	Y first2;\n" + 
24785
			"\n" + 
24786
			"	<U> U foo(U u1, U u2) {\n" + 
24787
			"		return u1;\n" + 
24788
			"	}\n" + 
24789
			"	void bar2(Y<? extends T> ref) {\n" + 
24790
			"		String s = foo(ref, first);\n" + 
24791
			"	}\n" + 
24792
			"	\n" + 
24793
			"	void foo(Y<? extends T> ref) {\n" + 
24794
			"		ref.next = first == null ? ref : first;\n" + 
24795
			"		String s = first == null ? ref : first;\n" + 
24796
			"		ref.next = first2 == null ? ref : first2;\n" + 
24797
			"	}\n" + 
24798
			"	Y<? extends T> bar(Y<? extends T> ref) {\n" + 
24799
			"		return first == null ? ref : first;\n" + 
24800
			"	}\n" + 
24801
			"}\n" + 
24802
			"\n" + 
24803
			"class Y<E> {\n" + 
24804
			"	Y<E> next;\n" + 
24805
			"}\n",
24806
		},
24807
		"----------\n" + 
24808
		"1. WARNING in X.java (at line 2)\n" + 
24809
		"	Y first;\n" + 
24810
		"	^\n" + 
24811
		"Y is a raw type. References to generic type Y<E> should be parameterized\n" + 
24812
		"----------\n" + 
24813
		"2. WARNING in X.java (at line 3)\n" + 
24814
		"	Y first2;\n" + 
24815
		"	^\n" + 
24816
		"Y is a raw type. References to generic type Y<E> should be parameterized\n" + 
24817
		"----------\n" + 
24818
		"3. ERROR in X.java (at line 9)\n" + 
24819
		"	String s = foo(ref, first);\n" + 
24820
		"	           ^^^^^^^^^^^^^^^\n" + 
24821
		"Type mismatch: cannot convert from Y to String\n" + 
24822
		"----------\n" + 
24823
		"4. WARNING in X.java (at line 13)\n" + 
24824
		"	ref.next = first == null ? ref : first;\n" + 
24825
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24826
		"Type safety: The expression of type Y needs unchecked conversion to conform to Y<capture#2-of ? extends T>\n" + 
24827
		"----------\n" + 
24828
		"5. ERROR in X.java (at line 14)\n" + 
24829
		"	String s = first == null ? ref : first;\n" + 
24830
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24831
		"Type mismatch: cannot convert from Y to String\n" + 
24832
		"----------\n" + 
24833
		"6. WARNING in X.java (at line 15)\n" + 
24834
		"	ref.next = first2 == null ? ref : first2;\n" + 
24835
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24836
		"Type safety: The expression of type Y needs unchecked conversion to conform to Y<capture#5-of ? extends T>\n" + 
24837
		"----------\n" + 
24838
		"7. WARNING in X.java (at line 18)\n" + 
24839
		"	return first == null ? ref : first;\n" + 
24840
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24841
		"Type safety: The expression of type Y needs unchecked conversion to conform to Y<? extends T>\n" + 
24842
		"----------\n");
24843
}
24844
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106744
24845
public void test0800() {
24846
	this.runNegativeTest(
24847
		new String[] {
24848
			"X.java",
24849
			"import java.lang.reflect.Constructor;\n" + 
24850
			"\n" + 
24851
			"public class X {\n" + 
24852
			"	public static void main(String[] args) {\n" + 
24853
			"        final Class<Ann> AnnClass = Ann.class;\n" + 
24854
			"	    Constructor[] constrs = X.class.getConstructors();\n" + 
24855
			"        for (Constructor constructor  : constrs) {\n" + 
24856
			"            final String message = constructor.getAnnotation(AnnClass).message();\n" + 
24857
			"            System.out.println(message);\n" + 
24858
			"        }\n" + 
24859
			"	}\n" + 
24860
			"}\n" + 
24861
			"\n" + 
24862
			"@interface Ann {\n" + 
24863
			"	String message();\n" + 
24864
			"}\n",
24865
		},
24866
		"----------\n" + 
24867
		"1. WARNING in X.java (at line 6)\n" + 
24868
		"	Constructor[] constrs = X.class.getConstructors();\n" + 
24869
		"	^^^^^^^^^^^\n" + 
24870
		"Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" + 
24871
		"----------\n" + 
24872
		"2. WARNING in X.java (at line 7)\n" + 
24873
		"	for (Constructor constructor  : constrs) {\n" + 
24874
		"	     ^^^^^^^^^^^\n" + 
24875
		"Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" + 
24876
		"----------\n" + 
24877
		"3. WARNING in X.java (at line 8)\n" + 
24878
		"	final String message = constructor.getAnnotation(AnnClass).message();\n" + 
24879
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24880
		"Type safety: The method getAnnotation(Class) belongs to the raw type Constructor. References to generic type Constructor<T> should be parameterized\n" + 
24881
		"----------\n" + 
24882
		"4. ERROR in X.java (at line 8)\n" + 
24883
		"	final String message = constructor.getAnnotation(AnnClass).message();\n" + 
24884
		"	                                                           ^^^^^^^\n" + 
24885
		"The method message() is undefined for the type Annotation\n" + 
24886
		"----------\n");
24887
}
24888
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106744 - variation
24889
public void test0801() {
24890
	this.runConformTest(
24891
		new String[] {
24892
			"X.java",
24893
			"public class X {\n" + 
24894
			"	public static void main(String[] args) {\n" + 
24895
			"		try {\n" + 
24896
			"		    X.class.getConstructor(new Class[0]).getAnnotation(Ann.class).message();\n" + 
24897
			"		} catch(Exception e) {\n" + 
24898
			"		}\n" + 
24899
			"	}\n" + 
24900
			"}\n" + 
24901
			"\n" + 
24902
			"@interface Ann {\n" + 
24903
			"	String message();\n" + 
24904
			"}\n",
24905
		},
24906
		"");
24907
}
24908
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106744 - variation
24909
public void test0802() {
24910
	this.runNegativeTest(
24911
		new String[] {
24912
			"X.java",
24913
			"public class X<U> {\n" + 
24914
			"    void bar(Y y, X<ZZ> x) {\n" + 
24915
			"    	y.foo(x).zz();\n" + 
24916
			"    }\n" + 
24917
			"}\n" + 
24918
			"class Y<V> {\n" + 
24919
			"    <T extends Z> T foo(X<T> x) { return null; }\n" + 
24920
			"}\n" + 
24921
			"\n" + 
24922
			"class Z {\n" + 
24923
			"}\n" + 
24924
			"class ZZ extends Z {\n" + 
24925
			"	void zz() {}\n" + 
24926
			"}\n",
24927
		},
24928
		"----------\n" + 
24929
		"1. WARNING in X.java (at line 2)\n" + 
24930
		"	void bar(Y y, X<ZZ> x) {\n" + 
24931
		"	         ^\n" + 
24932
		"Y is a raw type. References to generic type Y<V> should be parameterized\n" + 
24933
		"----------\n" + 
24934
		"2. WARNING in X.java (at line 3)\n" + 
24935
		"	y.foo(x).zz();\n" + 
24936
		"	^^^^^^^^\n" + 
24937
		"Type safety: The method foo(X) belongs to the raw type Y. References to generic type Y<V> should be parameterized\n" + 
24938
		"----------\n" + 
24939
		"3. ERROR in X.java (at line 3)\n" + 
24940
		"	y.foo(x).zz();\n" + 
24941
		"	         ^^\n" + 
24942
		"The method zz() is undefined for the type Z\n" + 
24943
		"----------\n");
24944
}
24945
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101831
24946
public void test0803() {
24947
	this.runNegativeTest(
24948
		new String[] {
24949
			"X.java",
24950
			"import java.util.*;\n" + 
24951
			"\n" + 
24952
			"public class X<A> {\n" + 
24953
			"  ArrayList<A> list = new ArrayList<A>();\n" + 
24954
			"  ArrayList<? super A> superList = new ArrayList<A>();\n" + 
24955
			"  ArrayList<? extends A> extendsList = new ArrayList<A>();\n" + 
24956
			"\n" + 
24957
			"  ArrayList<A> getList() {\n" + 
24958
			"    return true ? list : list;\n" + 
24959
			"  }\n" + 
24960
			"\n" + 
24961
			"  ArrayList<? super A> getSuperList() {\n" + 
24962
			"    return true ? superList : superList;\n" + 
24963
			"  }\n" + 
24964
			"\n" + 
24965
			"  ArrayList<? extends A> getExtendsList() {\n" + 
24966
			"    return true ? extendsList : extendsList;\n" + 
24967
			"  }\n" + 
24968
			"}\n",
24969
		},
24970
		"----------\n" + 
24971
		"1. ERROR in X.java (at line 13)\n" + 
24972
		"	return true ? superList : superList;\n" + 
24973
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
24974
		"Type mismatch: cannot convert from ArrayList<capture#3-of ? extends Object> to ArrayList<? super A>\n" + 
24975
		"----------\n");
24976
}
24977
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106865
24978
public void test0804() {
24979
	this.runNegativeTest(
24980
		new String[] {
24981
			"X.java",
24982
			"class Y<E> {\n" + 
24983
			"	void foo(E e) {\n" + 
24984
			"	}\n" + 
24985
			"}\n" + 
24986
			"public class X {\n" + 
24987
			"    void method1(Y<? super Object[]> y, Object[] os) {\n" + 
24988
			"        y.foo(os);\n" + 
24989
			"    }\n" + 
24990
			"    void method2(Y<? super Cloneable> y, Cloneable c) {\n" + 
24991
			"        y.foo(c);\n" + 
24992
			"    }    \n" + 
24993
			"    void method3(Y<? extends Object[]> y, Object[] os) {\n" + 
24994
			"        y.foo(os);\n" + 
24995
			"    }\n" + 
24996
			"    void method4(Y<? extends Cloneable> y, Cloneable c) {\n" + 
24997
			"        y.foo(c);\n" + 
24998
			"    }    \n" + 
24999
			"    \n" + 
25000
			"    void bar(Y<Object> y) {\n" + 
25001
			"    	method2(y, null);\n" + 
25002
			"    }\n" + 
25003
			"}\n",
25004
		},
25005
		"----------\n" + 
25006
		"1. ERROR in X.java (at line 13)\n" + 
25007
		"	y.foo(os);\n" + 
25008
		"	  ^^^\n" + 
25009
		"The method foo(capture#3-of ? extends Object[]) in the type Y<capture#3-of ? extends Object[]> is not applicable for the arguments (Object[])\n" + 
25010
		"----------\n" + 
25011
		"2. ERROR in X.java (at line 16)\n" + 
25012
		"	y.foo(c);\n" + 
25013
		"	  ^^^\n" + 
25014
		"The method foo(capture#4-of ? extends Cloneable) in the type Y<capture#4-of ? extends Cloneable> is not applicable for the arguments (Cloneable)\n" + 
25015
		"----------\n");
25016
}
25017
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106936
25018
public void test0805() {
25019
	this.runNegativeTest(
25020
		new String[] {
25021
			"X.java",
25022
			"public class X {\n" + 
25023
			" 	static <T> T foo(T t1, T t2) { return t1; }\n" + 
25024
			" 	public static void main(String[] args) {\n" + 
25025
			"		Number[] numbers = {}, numbers2, numbers3;\n" + 
25026
			"		Float[] floats = {};\n" + 
25027
			"		Integer[] integers = {};\n" + 
25028
			"\n" + 
25029
			"		numbers2 = foo(numbers, floats);\n" + 
25030
			" 		numbers3 = numbers != null ? numbers : floats;\n" + 
25031
			" 		String s = foo(numbers, floats); 		\n" + 
25032
			"\n" + 
25033
			" 		numbers2 = foo(integers, floats);\n" + 
25034
			" 		numbers3 = integers != null ? integers : floats;\n" + 
25035
			" 		String s2 = foo(integers, floats);\n" + 
25036
			" 	}\n" + 
25037
			"}\n",
25038
		},
25039
		"----------\n" + 
25040
		"1. ERROR in X.java (at line 10)\n" + 
25041
		"	String s = foo(numbers, floats); 		\n" + 
25042
		"	           ^^^^^^^^^^^^^^^^^^^^\n" + 
25043
		"Type mismatch: cannot convert from Number[] to String\n" + 
25044
		"----------\n" + 
25045
		"2. ERROR in X.java (at line 14)\n" + 
25046
		"	String s2 = foo(integers, floats);\n" + 
25047
		"	            ^^^^^^^^^^^^^^^^^^^^^\n" + 
25048
		"Type mismatch: cannot convert from Number&Comparable<? extends Number&Comparable<?>>[] to String\n" + 
25049
		"----------\n");
25050
}
25051
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=107079
25052
public void test0806() {
25053
	this.runNegativeTest(
25054
		new String[] {
25055
			"X.java",
25056
			"import java.util.ArrayList;\n" + 
25057
			"import java.util.List;\n" + 
25058
			"\n" + 
25059
			"/**\n" + 
25060
			" * This class demonstrates a generic program that Eclipse must not compile as it\n" + 
25061
			" * can lead to a ClassCastException despite having no explicit type casts.\n" + 
25062
			" */\n" + 
25063
			"public class X {\n" + 
25064
			"	private static class ValueHolder<T> {\n" + 
25065
			"		public T value;\n" + 
25066
			"	}\n" + 
25067
			"\n" + 
25068
			"	public static void main(final String[] args) {\n" + 
25069
			"		List<ValueHolder<?>> multiList = new ArrayList<ValueHolder<?>>();\n" + 
25070
			"\n" + 
25071
			"		ValueHolder<Integer> intHolder = new ValueHolder<Integer>();\n" + 
25072
			"		intHolder.value = 1;\n" + 
25073
			"\n" + 
25074
			"		ValueHolder<Double> doubleHolder = new ValueHolder<Double>();\n" + 
25075
			"		doubleHolder.value = 1.5;\n" + 
25076
			"\n" + 
25077
			"		multiList.add(intHolder);\n" + 
25078
			"		multiList.add(doubleHolder);\n" + 
25079
			"\n" + 
25080
			"		// I believe this line is being erroneously treated as a capture\n" + 
25081
			"        // conversion under 3.1 JDT.\n" + 
25082
			"		// I believe the problem is that ? cannot be captured except in a first\n" + 
25083
			"        // level wildcard.\n" + 
25084
			"		swapFirstTwoValues(multiList);\n" + 
25085
			"\n" + 
25086
			"		// this line causes a ClassCastException when checked.\n" + 
25087
			"		Integer value = intHolder.value;\n" + 
25088
			"		System.out.println(value);\n" + 
25089
			"	}\n" + 
25090
			"\n" + 
25091
			"	private static <T> void swapFirstTwoValues(List<ValueHolder<T>> multiList) {\n" + 
25092
			"		ValueHolder<T> intHolder = multiList.get(0);\n" + 
25093
			"		ValueHolder<T> doubleHolder = multiList.get(1);\n" + 
25094
			"\n" + 
25095
			"		intHolder.value = doubleHolder.value;\n" + 
25096
			"	}\n" + 
25097
			"}\n",
25098
		},
25099
		"----------\n" + 
25100
		"1. ERROR in X.java (at line 29)\n" + 
25101
		"	swapFirstTwoValues(multiList);\n" + 
25102
		"	^^^^^^^^^^^^^^^^^^\n" + 
25103
		"The method swapFirstTwoValues(List<X.ValueHolder<T>>) in the type X is not applicable for the arguments (List<X.ValueHolder<?>>)\n" + 
25104
		"----------\n");
25105
}
25106
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=107756
25107
public void test0807() {
25108
	this.runConformTest(
25109
		new String[] {
25110
			"X.java",
25111
			"interface Prop<BeanT> {\n" + 
25112
			"	Unmarshaller.Handler createHandler();\n" + 
25113
			"}\n" + 
25114
			"\n" + 
25115
			"abstract class Unmarshaller {\n" + 
25116
			"	public static abstract class Handler {}\n" + 
25117
			"}\n" + 
25118
			"\n" + 
25119
			"public class X {\n" + 
25120
			"	void foo(Prop p) {\n" + 
25121
			"		Unmarshaller.Handler h = p.createHandler(); \n" + 
25122
			"	}\n" + 
25123
			"}\n",
25124
		},
25125
		"");
25126
}
25127
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=107756 - variation
25128
public void test0808() {
25129
	this.runConformTest(
25130
		new String[] {
25131
			"X.java",
25132
			"public class X<T> {\n" + 
25133
			"    \n" + 
25134
			"    public static void main(String[] args) {\n" + 
25135
			"        X x = new X();\n" + 
25136
			"        x.ax = new AX<String>();\n" + 
25137
			"    }\n" + 
25138
			"    \n" + 
25139
			"    AX<T> ax;\n" + 
25140
			"}\n" + 
25141
			"\n" + 
25142
			"class AX <P> {\n" + 
25143
			"    AX<P> p;\n" + 
25144
			"}\n",
25145
		},
25146
		"");
25147
}
25148
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106946
25149
public void test0809() {
25150
	this.runNegativeTest(
25151
		new String[] {
25152
			"X.java",
25153
			"import java.util.Iterator;\n" + 
25154
			"\n" + 
25155
			"class Node {}\n" + 
25156
			"interface Set1<N extends Node> extends Iterable<N> {}\n" + 
25157
			"interface Set2 extends Iterable<Node> {}\n" + 
25158
			"\n" + 
25159
			"class SetIterator<N extends Node> implements Iterator<N> {\n" + 
25160
			"	public N next() {\n" + 
25161
			"		return null;\n" + 
25162
			"	}\n" + 
25163
			"	public boolean hasNext() {\n" + 
25164
			"		return true;\n" + 
25165
			"	}\n" + 
25166
			"	public void remove() {\n" + 
25167
			"	}\n" + 
25168
			"}\n" + 
25169
			"interface Set3<N extends Node> extends Iterable<N> {\n" + 
25170
			"	SetIterator<N> iterator();\n" + 
25171
			"}\n" + 
25172
			"public class X {\n" + 
25173
			"	void f1(Set1 s) {\n" + 
25174
			"		Node n_ = s.iterator().next();\n" + 
25175
			"		// ^Type mismatch: cannot convert from Object to Node\n" + 
25176
			"		// this was unexpected (s can only contain types derivered from Node)\n" + 
25177
			"		for (Node n : s) {\n" + 
25178
			"			// ^Type mismatch: cannot convert from Object to Node\n" + 
25179
			"			// this was unexpected\n" + 
25180
			"		}\n" + 
25181
			"	}\n" + 
25182
			"	void f2(Set2 s) {\n" + 
25183
			"		Node n_ = s.iterator().next();\n" + 
25184
			"		for (Node n : s) {\n" + 
25185
			"		}\n" + 
25186
			"	}\n" + 
25187
			"	void f3(Set3 s) {\n" + 
25188
			"		Node n_ = s.iterator().next();\n" + 
25189
			"		// (^ no error here)\n" + 
25190
			"		for (Node n : s) {\n" + 
25191
			"			// ^Type mismatch: cannot convert from Object to Node\n" + 
25192
			"			// this is even stranger as we already know that s.iterator().next()\n" + 
25193
			"            // have the right type\n" + 
25194
			"		}\n" + 
25195
			"	}\n" + 
25196
			"}\n",
25197
		},
25198
		"----------\n" + 
25199
		"1. WARNING in X.java (at line 21)\n" + 
25200
		"	void f1(Set1 s) {\n" + 
25201
		"	        ^^^^\n" + 
25202
		"Set1 is a raw type. References to generic type Set1<N> should be parameterized\n" + 
25203
		"----------\n" + 
25204
		"2. ERROR in X.java (at line 22)\n" + 
25205
		"	Node n_ = s.iterator().next();\n" + 
25206
		"	          ^^^^^^^^^^^^^^^^^^^\n" + 
25207
		"Type mismatch: cannot convert from Object to Node\n" + 
25208
		"----------\n" + 
25209
		"3. ERROR in X.java (at line 25)\n" + 
25210
		"	for (Node n : s) {\n" + 
25211
		"	              ^\n" + 
25212
		"Type mismatch: cannot convert from element type Object to Node\n" + 
25213
		"----------\n" + 
25214
		"4. WARNING in X.java (at line 35)\n" + 
25215
		"	void f3(Set3 s) {\n" + 
25216
		"	        ^^^^\n" + 
25217
		"Set3 is a raw type. References to generic type Set3<N> should be parameterized\n" + 
25218
		"----------\n" + 
25219
		"5. ERROR in X.java (at line 38)\n" + 
25220
		"	for (Node n : s) {\n" + 
25221
		"	              ^\n" + 
25222
		"Type mismatch: cannot convert from element type Object to Node\n" + 
25223
		"----------\n");
25224
}
25225
// **
25226
public void test0810() {
25227
	this.runConformTest(
25228
		new String[] {
25229
			"X.java",
25230
			"class A<T, U> {\n" +
25231
			"	public String toString() {\n" +
25232
			"		return \"SUCCESS\";\n" +
25233
			"	}\n" +
25234
			"}\n" +
25235
			"public class X {\n" +
25236
			"\n" +
25237
			"	public <K> A<K,K> foo(K type) {\n" +
25238
			"		return new A<K,K>();\n" +
25239
			"	}\n" +
25240
			"\n" +
25241
			"	public static void main(String args[]) {\n" +
25242
			"		X x = new X();\n" +
25243
			"		A<?,?> a = x.foo(null);\n" +
25244
			"		System.out.println(a);\n" +
25245
			"	}\n" +
25246
			"}",
25247
		},
25248
		"SUCCESS");
25249
}
25250
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=108372
25251
public void test0811() {
25252
	this.runConformTest(
25253
		new String[] {
25254
			"X.java",
25255
			"public class X<T> {\n" + 
25256
			"    private T t;\n" + 
25257
			"    private X.Inner inner;\n" + 
25258
			"    private X.Inner[] inners;\n" + 
25259
			"    public X(T t,  X.Inner in, X.Inner[] ins) {\n" + 
25260
			"        this.t = t;\n" + 
25261
			"        this.inner = in;\n" + 
25262
			"        this.inner = new X(null, null, null).new Inner();\n" + 
25263
			"        this.inners = ins;\n" + 
25264
			"        this.inners = new X.Inner[10];\n" + 
25265
			"        //Type mismatch: cannot convert from X.Inner[] to X<T>.Inner[]\n" + 
25266
			"    }\n" + 
25267
			"    private class Inner {\n" + 
25268
			"    }\n" + 
25269
			"}\n",
25270
		},
25271
		"");
25272
}
25273
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=108372 - variation
25274
public void test0812() {
25275
	this.runNegativeTest(
25276
		new String[] {
25277
			"X.java",
25278
			"public class X<T> {\n" + 
25279
			"    private T t;\n" + 
25280
			"    private X<?>.Inner inner;\n" + 
25281
			"    private X<?>.Inner[] inners;\n" + 
25282
			"    public X(T t) {\n" + 
25283
			"        this.t = t;\n" + 
25284
			"        this.inner = new X.Inner();\n" + 
25285
			"        this.inners = new X.Inner[10];\n" + 
25286
			"        Zork z;\n" +
25287
			"    }\n" + 
25288
			"    private class Inner {\n" + 
25289
			"    }\n" + 
25290
			"}\n",
25291
		},
25292
		"----------\n" + 
25293
		"1. WARNING in X.java (at line 2)\n" + 
25294
		"	private T t;\n" + 
25295
		"	          ^\n" + 
25296
		"The field X<T>.t is never read locally\n" + 
25297
		"----------\n" + 
25298
		"2. WARNING in X.java (at line 3)\n" + 
25299
		"	private X<?>.Inner inner;\n" + 
25300
		"	                   ^^^^^\n" + 
25301
		"The field X<T>.inner is never read locally\n" + 
25302
		"----------\n" + 
25303
		"3. WARNING in X.java (at line 4)\n" + 
25304
		"	private X<?>.Inner[] inners;\n" + 
25305
		"	                     ^^^^^^\n" + 
25306
		"The field X<T>.inners is never read locally\n" + 
25307
		"----------\n" + 
25308
		"4. WARNING in X.java (at line 7)\n" + 
25309
		"	this.inner = new X.Inner();\n" + 
25310
		"	                 ^^^^^^^\n" + 
25311
		"X.Inner is a raw type. References to generic type X<T>.Inner should be parameterized\n" + 
25312
		"----------\n" + 
25313
		"5. ERROR in X.java (at line 9)\n" + 
25314
		"	Zork z;\n" + 
25315
		"	^^^^\n" + 
25316
		"Zork cannot be resolved to a type\n" + 
25317
		"----------\n");
25318
}
25319
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=108372 - variation
25320
// **
25321
public void test0813() {
25322
	this.runConformTest(
25323
		new String[] {
25324
			"X.java",
25325
			"public class X<T> {\n" + 
25326
			"    private T t;\n" + 
25327
			"    private X<?>.Inner[] inners;\n" + 
25328
			"    public X(T t) {\n" + 
25329
			"        this.t = t;\n" + 
25330
			"        this.inners = new X<?>.Inner[10];\n" + 
25331
			"    }\n" + 
25332
			"    private class Inner {\n" + 
25333
			"    }\n" + 
25334
			"}\n",
25335
		},
25336
		"");
25337
}
25338
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695
25339
public void test0814() {
25340
	this.runNegativeTest(
25341
		new String[] {
25342
			"X.java",
25343
			"import java.util.*;\n" + 
25344
			"public class X<E> {\n" + 
25345
			"    void method(Object o) {\n" + 
25346
			"        if (o instanceof E[]) { //incorrect: cannot test non-reifiable type\n" + 
25347
			"            E[] es = (E[]) o;\n" + 
25348
			"        }\n" + 
25349
			"        if (o instanceof List<E>[]) { //incorrect too\n" + 
25350
			"            List<E>[] es = (List<E>[]) o; \n" + 
25351
			"        }\n" + 
25352
			"        if (o instanceof List<?>[]) { // unbound is ok\n" + 
25353
			"            List<?>[] es = (List<?>[]) o;\n" + 
25354
			"        }\n" + 
25355
			"    }\n" + 
25356
			"    void method(ArrayList<E>[] al) {\n" + 
25357
			"        if (al instanceof List<E>[]) { //incorrect too\n" + 
25358
			"            List<E>[] es = (List<E>[]) al; \n" + 
25359
			"        }        \n" + 
25360
			"    }\n" + 
25361
			"}\n",
25362
		},
25363
		"----------\n" + 
25364
		"1. ERROR in X.java (at line 4)\n" + 
25365
		"	if (o instanceof E[]) { //incorrect: cannot test non-reifiable type\n" + 
25366
		"	    ^^^^^^^^^^^^^^^^\n" + 
25367
		"Cannot perform instanceof check against parameterized type E[]. Use instead its raw form Object[] since generic type information will be erased at runtime\n" + 
25368
		"----------\n" + 
25369
		"2. WARNING in X.java (at line 5)\n" + 
25370
		"	E[] es = (E[]) o;\n" + 
25371
		"	         ^^^^^^^\n" + 
25372
		"Type safety: Unchecked cast from Object to E[]\n" + 
25373
		"----------\n" + 
25374
		"3. ERROR in X.java (at line 7)\n" + 
25375
		"	if (o instanceof List<E>[]) { //incorrect too\n" + 
25376
		"	    ^^^^^^^^^^^^^^^^^^^^^^\n" + 
25377
		"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" + 
25378
		"----------\n" + 
25379
		"4. WARNING in X.java (at line 8)\n" + 
25380
		"	List<E>[] es = (List<E>[]) o; \n" + 
25381
		"	               ^^^^^^^^^^^^^\n" + 
25382
		"Type safety: Unchecked cast from Object to List<E>[]\n" + 
25383
		"----------\n" + 
25384
		"5. ERROR in X.java (at line 15)\n" + 
25385
		"	if (al instanceof List<E>[]) { //incorrect too\n" + 
25386
		"	    ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25387
		"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" + 
25388
		"----------\n" + 
25389
		"6. WARNING in X.java (at line 16)\n" + 
25390
		"	List<E>[] es = (List<E>[]) al; \n" + 
25391
		"	               ^^^^^^^^^^^^^^\n" + 
25392
		"Unnecessary cast from ArrayList<E>[] to List<E>[]\n" + 
25393
		"----------\n");
25394
}
25395
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation
25396
public void test0815() {
25397
	this.runNegativeTest(
25398
		new String[] {
25399
			"X.java",
25400
			"public class X<E> {\n" + 
25401
			"	void foo(Object[][] e) {\n" + 
25402
			"		E[] o = (E[]) e;\n" + 
25403
			"		Zork z;\n" +
25404
			"	}\n" + 
25405
			"}\n",
25406
		},
25407
		"----------\n" + 
25408
		"1. WARNING in X.java (at line 3)\n" + 
25409
		"	E[] o = (E[]) e;\n" + 
25410
		"	        ^^^^^^^\n" + 
25411
		"Type safety: Unchecked cast from Object[][] to E[]\n" + 
25412
		"----------\n" + 
25413
		"2. ERROR in X.java (at line 4)\n" + 
25414
		"	Zork z;\n" + 
25415
		"	^^^^\n" + 
25416
		"Zork cannot be resolved to a type\n" + 
25417
		"----------\n");
25418
}
25419
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation
25420
public void test0816() {
25421
	this.runNegativeTest(
25422
		new String[] {
25423
			"X.java",
25424
			"import java.util.*;\n" + 
25425
			"public class X<E> {\n" + 
25426
			"    void method(Object[] o) {\n" + 
25427
			"        if (o instanceof List<E>[][]) { //incorrect too\n" + 
25428
			"            List<E>[][] es = (List<E>[][]) o; \n" + 
25429
			"        }\n" + 
25430
			"    }\n" + 
25431
			"}\n",
25432
		},
25433
		"----------\n" + 
25434
		"1. ERROR in X.java (at line 4)\n" + 
25435
		"	if (o instanceof List<E>[][]) { //incorrect too\n" + 
25436
		"	    ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25437
		"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" + 
25438
		"----------\n" + 
25439
		"2. WARNING in X.java (at line 5)\n" + 
25440
		"	List<E>[][] es = (List<E>[][]) o; \n" + 
25441
		"	                 ^^^^^^^^^^^^^^^\n" + 
25442
		"Type safety: Unchecked cast from Object[] to List<E>[][]\n" + 
25443
		"----------\n");
25444
}
25445
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=104695 - variation
25446
public void test0817() {
25447
	this.runNegativeTest(
25448
			new String[] {
25449
				"X.java",
25450
				"import java.util.List;\n" + 
25451
				"\n" + 
25452
				"public class X<T> {\n" + 
25453
				"    private T t;\n" + 
25454
				"    private X<?>.Inner inner;\n" + 
25455
				"    private X<?>.Inner[] inners;\n" + 
25456
				"    public X(T t) {\n" + 
25457
				"        this.t = t;\n" + 
25458
				"        if (this.inner instanceof X<?>.Inner) {}\n" + 
25459
				"        if (this.inners instanceof X<?>.Inner[]) {}\n" + 
25460
				"    }\n" + 
25461
				"    private class Inner {\n" + 
25462
				"    }\n" + 
25463
				"    void foo(List l) {\n" + 
25464
				"    	if (l instanceof List<?>) {}\n" + 
25465
				"    	if (l instanceof List<? extends String>) {}\n" + 
25466
				"    }\n" + 
25467
				"    void foo(List[] ls) {\n" + 
25468
				"    	if (ls instanceof List<?>[]) {}\n" + 
25469
				"    	if (ls instanceof List<? extends String>[]) {}\n" + 
25470
				"    }\n" + 
25471
				"}\n",
25472
			},
25473
			"----------\n" + 
25474
			"1. WARNING in X.java (at line 4)\n" + 
25475
			"	private T t;\n" + 
25476
			"	          ^\n" + 
25477
			"The field X<T>.t is never read locally\n" + 
25478
			"----------\n" + 
25479
			"2. WARNING in X.java (at line 9)\n" + 
25480
			"	if (this.inner instanceof X<?>.Inner) {}\n" + 
25481
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25482
			"The expression of type X<?>.Inner is already an instance of type X<?>.Inner\n" + 
25483
			"----------\n" + 
25484
			"3. WARNING in X.java (at line 10)\n" + 
25485
			"	if (this.inners instanceof X<?>.Inner[]) {}\n" + 
25486
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25487
			"The expression of type X<?>.Inner[] is already an instance of type X<?>.Inner[]\n" + 
25488
			"----------\n" + 
25489
			"4. WARNING in X.java (at line 14)\n" + 
25490
			"	void foo(List l) {\n" + 
25491
			"	         ^^^^\n" + 
25492
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
25493
			"----------\n" + 
25494
			"5. WARNING in X.java (at line 15)\n" + 
25495
			"	if (l instanceof List<?>) {}\n" + 
25496
			"	    ^^^^^^^^^^^^^^^^^\n" + 
25497
			"The expression of type List is already an instance of type List<?>\n" + 
25498
			"----------\n" + 
25499
			"6. ERROR in X.java (at line 16)\n" + 
25500
			"	if (l instanceof List<? extends String>) {}\n" + 
25501
			"	    ^^^^^^^^^^^^^^^^^\n" + 
25502
			"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" + 
25503
			"----------\n" + 
25504
			"7. WARNING in X.java (at line 18)\n" + 
25505
			"	void foo(List[] ls) {\n" + 
25506
			"	         ^^^^\n" + 
25507
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
25508
			"----------\n" + 
25509
			"8. WARNING in X.java (at line 19)\n" + 
25510
			"	if (ls instanceof List<?>[]) {}\n" + 
25511
			"	    ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25512
			"The expression of type List[] is already an instance of type List<?>\n" + 
25513
			"----------\n" + 
25514
			"9. ERROR in X.java (at line 20)\n" + 
25515
			"	if (ls instanceof List<? extends String>[]) {}\n" + 
25516
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25517
			"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" + 
25518
			"----------\n");
25519
}
25520
public void test0818() {
25521
	this.runConformTest(
25522
		new String[] {
25523
			"X.java",
25524
			"public class X<T> {\n" + 
25525
			"    boolean b = this instanceof Y;\n" + 
25526
			"    static class Y extends X<Object> {\n" + 
25527
			"    }\n" + 
25528
			"}\n",
25529
		},
25530
		"");
25531
}
25532
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101380
25533
public void test0819() {
25534
	this.runConformTest(
25535
			new String[] {
25536
				"X.java",
25537
				"public class X implements MyInterface {\n" + 
25538
				"	public void myMethod(myEnum value) {\n" + 
25539
				"		System.out.println(\"value is \"+value);\n" + 
25540
				"	}\n" + 
25541
				"	public static void main(String[] args){\n" + 
25542
				"		new X().myMethod(myEnum.one);		\n" + 
25543
				"	}\n" + 
25544
				"}\n" + 
25545
				"\n" + 
25546
				"interface MyInterface<T> {\n" + 
25547
				"	enum myEnum {one,two};\n" + 
25548
				"	public void myMethod(myEnum value); \n" + 
25549
				"}\n",
25550
			},
25551
			"value is one");
25552
}
25553
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=101380 - variation
25554
public void test0820() {
25555
	this.runConformTest(
25556
		new String[] {
25557
			"X.java",
25558
			"public class X implements I {\n" + 
25559
			"  public void x(M value) {}\n" + 
25560
			"}\n" + 
25561
			"interface I<T> {\n" + 
25562
			"  class M {}\n" + 
25563
			"  void x(M value); \n" + 
25564
			"}\n",
25565
		},
25566
		"");
25567
}
25568
public void test0821() {
25569
	this.runConformTest(
25570
		new String[] {
25571
			"X.java",
25572
			"import java.io.Serializable;\n" + 
25573
			"\n" + 
25574
			"public class X<T extends Serializable & Runnable> {\n" + 
25575
			"	T t;\n" + 
25576
			"	X(T t) {\n" + 
25577
			"		this.t = t;\n" + 
25578
			"	}\n" + 
25579
			"	void foo() {\n" + 
25580
			"		t.run();\n" + 
25581
			"	}\n" + 
25582
			"	public static void main(String[] args) {\n" + 
25583
			"		new X<A>(new A()).foo();\n" + 
25584
			"	}\n" + 
25585
			"}\n" + 
25586
			"class A implements Serializable, Runnable {\n" + 
25587
			"	public void run() {\n" + 
25588
			"		System.out.println(\"AA\");\n" + 
25589
			"	}\n" + 
25590
			"}\n",
25591
		},
25592
		"AA");
25593
	// 	ensure proper declaring class for #run() invocation
25594
	String expectedOutput =
25595
		"  // Method descriptor #15 ()V\n" + 
25596
		"  // Stack: 1, Locals: 1\n" + 
25597
		"  void foo();\n" + 
25598
		"     0  aload_0 [this]\n" + 
25599
		"     1  getfield X.t : java.io.Serializable [16]\n" + 
25600
		"     4  checkcast java.lang.Runnable [25]\n" + 
25601
		"     7  invokeinterface java.lang.Runnable.run() : void [27] [nargs: 1]\n" + 
25602
		"    12  return\n" + 
25603
		"      Line numbers:\n" + 
25604
		"        [pc: 0, line: 9]\n" + 
25605
		"        [pc: 12, line: 10]\n" + 
25606
		"      Local variable table:\n" + 
25607
		"        [pc: 0, pc: 13] local: this index: 0 type: X\n" + 
25608
		"      Local variable type table:\n" + 
25609
		"        [pc: 0, pc: 13] local: this index: 0 type: X<T>\n";
25610
	
25611
	try {
25612
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
25613
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
25614
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
25615
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
25616
		int index = result.indexOf(expectedOutput);
25617
		if (index == -1 || expectedOutput.length() == 0) {
25618
			System.out.println(Util.displayString(result, 3));
25619
		}
25620
		if (index == -1) {
25621
			assertEquals("Wrong contents", expectedOutput, result);
25622
		}
25623
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
25624
		assertTrue(false);
25625
	} catch (IOException e) {
25626
		assertTrue(false);
25627
	}		
25628
}
25629
public void test0822() {
25630
	this.runConformTest(
25631
		new String[] {
25632
			"X.java",
25633
			"import java.io.Serializable;\n" + 
25634
			"\n" + 
25635
			"public class X<T extends Serializable & Runnable> {\n" + 
25636
			"	void foo(T t) {\n" + 
25637
			"		t.run();\n" + 
25638
			"	}\n" + 
25639
			"	public static void main(String[] args) {\n" + 
25640
			"		new X<A>().foo(new A());\n" + 
25641
			"	}\n" + 
25642
			"}\n" + 
25643
			"class A implements Serializable, Runnable {\n" + 
25644
			"	public void run() {\n" + 
25645
			"		System.out.println(\"AA\");\n" + 
25646
			"	}\n" + 
25647
			"}\n",
25648
		},
25649
		"AA");
25650
	// 	ensure proper declaring class for #run() invocation
25651
	String expectedOutput =
25652
		"  // Method descriptor #17 (Ljava/io/Serializable;)V\n" + 
25653
		"  // Signature: (TT;)V\n" + 
25654
		"  // Stack: 1, Locals: 2\n" + 
25655
		"  void foo(java.io.Serializable t);\n" + 
25656
		"     0  aload_1 [t]\n" + 
25657
		"     1  checkcast java.lang.Runnable [20]\n" + 
25658
		"     4  invokeinterface java.lang.Runnable.run() : void [22] [nargs: 1]\n" + 
25659
		"     9  return\n" + 
25660
		"      Line numbers:\n" + 
25661
		"        [pc: 0, line: 5]\n" + 
25662
		"        [pc: 9, line: 6]\n" + 
25663
		"      Local variable table:\n" + 
25664
		"        [pc: 0, pc: 10] local: this index: 0 type: X\n" + 
25665
		"        [pc: 0, pc: 10] local: t index: 1 type: java.io.Serializable\n" + 
25666
		"      Local variable type table:\n" + 
25667
		"        [pc: 0, pc: 10] local: this index: 0 type: X<T>\n" + 
25668
		"        [pc: 0, pc: 10] local: t index: 1 type: T\n";
25669
	
25670
	try {
25671
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
25672
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
25673
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
25674
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
25675
		int index = result.indexOf(expectedOutput);
25676
		if (index == -1 || expectedOutput.length() == 0) {
25677
			System.out.println(Util.displayString(result, 3));
25678
		}
25679
		if (index == -1) {
25680
			assertEquals("Wrong contents", expectedOutput, result);
25681
		}
25682
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
25683
		assertTrue(false);
25684
	} catch (IOException e) {
25685
		assertTrue(false);
25686
	}		
25687
}
25688
public void test0823() {
25689
	this.runConformTest(
25690
		new String[] {
25691
			"X.java",
25692
			"import java.io.Serializable;\n" + 
25693
			"\n" + 
25694
			"public class X<T extends Serializable & Runnable, V extends T> {\n" + 
25695
			"	T t;\n" + 
25696
			"	X(T t) {\n" + 
25697
			"		this.t = t;\n" + 
25698
			"	}\n" + 
25699
			"	void foo() {\n" + 
25700
			"		(this == null ? t : t).run();\n" + 
25701
			"		((V) t).run();\n" + 
25702
			"	}\n" + 
25703
			"	public static void main(String[] args) {\n" + 
25704
			"		new X<A, A>(new A()).foo();\n" + 
25705
			"	}\n" + 
25706
			"}\n" + 
25707
			"class A implements Serializable, Runnable {\n" + 
25708
			"	public void run() {\n" + 
25709
			"		System.out.print(\"AA\");\n" + 
25710
			"	}\n" + 
25711
			"}\n",
25712
		},
25713
		"AAAA");
25714
	// 	ensure proper declaring class for #run() invocation
25715
	String expectedOutput =
25716
		"  // Method descriptor #15 ()V\n" + 
25717
		"  // Stack: 1, Locals: 1\n" + 
25718
		"  void foo();\n" + 
25719
		"     0  aload_0 [this]\n" + 
25720
		"     1  ifnonnull 11\n" + 
25721
		"     4  aload_0 [this]\n" + 
25722
		"     5  getfield X.t : java.io.Serializable [16]\n" + 
25723
		"     8  goto 15\n" + 
25724
		"    11  aload_0 [this]\n" + 
25725
		"    12  getfield X.t : java.io.Serializable [16]\n" + 
25726
		"    15  checkcast java.lang.Runnable [25]\n" + 
25727
		"    18  invokeinterface java.lang.Runnable.run() : void [27] [nargs: 1]\n" + 
25728
		"    23  aload_0 [this]\n" + 
25729
		"    24  getfield X.t : java.io.Serializable [16]\n" + 
25730
		"    27  checkcast java.lang.Runnable [25]\n" + 
25731
		"    30  invokeinterface java.lang.Runnable.run() : void [27] [nargs: 1]\n" + 
25732
		"    35  return\n" + 
25733
		"      Line numbers:\n" + 
25734
		"        [pc: 0, line: 9]\n" + 
25735
		"        [pc: 23, line: 10]\n" + 
25736
		"        [pc: 35, line: 11]\n" + 
25737
		"      Local variable table:\n" + 
25738
		"        [pc: 0, pc: 36] local: this index: 0 type: X\n" + 
25739
		"      Local variable type table:\n" + 
25740
		"        [pc: 0, pc: 36] local: this index: 0 type: X<T,V>\n";
25741
	
25742
	try {
25743
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
25744
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
25745
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
25746
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
25747
		int index = result.indexOf(expectedOutput);
25748
		if (index == -1 || expectedOutput.length() == 0) {
25749
			System.out.println(Util.displayString(result, 3));
25750
		}
25751
		if (index == -1) {
25752
			assertEquals("Wrong contents", expectedOutput, result);
25753
		}
25754
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
25755
		assertTrue(false);
25756
	} catch (IOException e) {
25757
		assertTrue(false);
25758
	}		
25759
}
25760
public void test0824() {
25761
	this.runConformTest(
25762
		new String[] {
25763
			"X.java",
25764
			"import java.io.Serializable;\n" + 
25765
			"\n" + 
25766
			"public class X<T extends Serializable & Runnable, V extends T> {\n" + 
25767
			"	void foo(T t) {\n" + 
25768
			"		(this == null ? t : t).run();\n" + 
25769
			"		((V) t).run();\n" + 
25770
			"	}\n" + 
25771
			"	public static void main(String[] args) {\n" + 
25772
			"		new X<A, A>().foo(new A());\n" + 
25773
			"	}\n" + 
25774
			"}\n" + 
25775
			"class A implements Serializable, Runnable {\n" + 
25776
			"	public void run() {\n" + 
25777
			"		System.out.print(\"AA\");\n" + 
25778
			"	}\n" + 
25779
			"}\n",
25780
		},
25781
		"AAAA");
25782
	// 	ensure proper declaring class for #run() invocation
25783
	String expectedOutput =
25784
		"  // Method descriptor #17 (Ljava/io/Serializable;)V\n" + 
25785
		"  // Signature: (TT;)V\n" + 
25786
		"  // Stack: 1, Locals: 2\n" + 
25787
		"  void foo(java.io.Serializable t);\n" + 
25788
		"     0  aload_0 [this]\n" + 
25789
		"     1  ifnonnull 8\n" + 
25790
		"     4  aload_1 [t]\n" + 
25791
		"     5  goto 9\n" + 
25792
		"     8  aload_1 [t]\n" + 
25793
		"     9  checkcast java.lang.Runnable [20]\n" + 
25794
		"    12  invokeinterface java.lang.Runnable.run() : void [22] [nargs: 1]\n" + 
25795
		"    17  aload_1 [t]\n" + 
25796
		"    18  checkcast java.lang.Runnable [20]\n" + 
25797
		"    21  invokeinterface java.lang.Runnable.run() : void [22] [nargs: 1]\n" + 
25798
		"    26  return\n" + 
25799
		"      Line numbers:\n" + 
25800
		"        [pc: 0, line: 5]\n" + 
25801
		"        [pc: 17, line: 6]\n" + 
25802
		"        [pc: 26, line: 7]\n" + 
25803
		"      Local variable table:\n" + 
25804
		"        [pc: 0, pc: 27] local: this index: 0 type: X\n" + 
25805
		"        [pc: 0, pc: 27] local: t index: 1 type: java.io.Serializable\n" + 
25806
		"      Local variable type table:\n" + 
25807
		"        [pc: 0, pc: 27] local: this index: 0 type: X<T,V>\n" + 
25808
		"        [pc: 0, pc: 27] local: t index: 1 type: T\n";
25809
	
25810
	try {
25811
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
25812
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
25813
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
25814
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
25815
		int index = result.indexOf(expectedOutput);
25816
		if (index == -1 || expectedOutput.length() == 0) {
25817
			System.out.println(Util.displayString(result, 3));
25818
		}
25819
		if (index == -1) {
25820
			assertEquals("Wrong contents", expectedOutput, result);
25821
		}
25822
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
25823
		assertTrue(false);
25824
	} catch (IOException e) {
25825
		assertTrue(false);
25826
	}		
25827
}
25828
public void test0825() {
25829
	this.runConformTest(
25830
		new String[] {
25831
			"X.java",
25832
			"import java.io.Serializable;\n" + 
25833
			"\n" + 
25834
			"public class X<T extends Serializable & Runnable, V extends T> {\n" + 
25835
			"	void foo(T t) {\n" + 
25836
			"		Runnable r1 = t;\n" + 
25837
			"		Runnable r2 = (this == null ? t : t);\n" + 
25838
			"		Runnable r3 = ((V) t);\n" + 
25839
			"		\n" + 
25840
			"		bar(t);\n" + 
25841
			"		bar(this == null ? t : t);\n" + 
25842
			"		bar((V)t);\n" + 
25843
			"	}\n" + 
25844
			"	void bar(Runnable r) {}	\n" + 
25845
			"	public static void main(String[] args) {\n" + 
25846
			"		new X<A, A>().foo(new A());\n" + 
25847
			"	}\n" + 
25848
			"}\n" + 
25849
			"class A implements Serializable, Runnable {\n" + 
25850
			"	public void run() {\n" + 
25851
			"		System.out.println(\"AA\");\n" + 
25852
			"	}\n" + 
25853
			"}\n",
25854
		},
25855
		"");
25856
	// 	ensure proper declaring class for #run() invocation
25857
	String expectedOutput =
25858
		"  // Method descriptor #17 (Ljava/io/Serializable;)V\n" + 
25859
		"  // Signature: (TT;)V\n" + 
25860
		"  // Stack: 2, Locals: 5\n" + 
25861
		"  void foo(java.io.Serializable t);\n" + 
25862
		"     0  aload_1 [t]\n" + 
25863
		"     1  astore_2 [r1]\n" + 
25864
		"     2  aload_0 [this]\n" + 
25865
		"     3  ifnonnull 10\n" + 
25866
		"     6  aload_1 [t]\n" + 
25867
		"     7  goto 11\n" + 
25868
		"    10  aload_1 [t]\n" + 
25869
		"    11  astore_3 [r2]\n" + 
25870
		"    12  aload_1 [t]\n" + 
25871
		"    13  astore 4 [r3]\n" + 
25872
		"    15  aload_0 [this]\n" + 
25873
		"    16  aload_1 [t]\n" + 
25874
		"    17  invokevirtual X.bar(java.lang.Runnable) : void [20]\n" + 
25875
		"    20  aload_0 [this]\n" + 
25876
		"    21  aload_0 [this]\n" + 
25877
		"    22  ifnonnull 29\n" + 
25878
		"    25  aload_1 [t]\n" + 
25879
		"    26  goto 30\n" + 
25880
		"    29  aload_1 [t]\n" + 
25881
		"    30  invokevirtual X.bar(java.lang.Runnable) : void [20]\n" + 
25882
		"    33  aload_0 [this]\n" + 
25883
		"    34  aload_1 [t]\n" + 
25884
		"    35  invokevirtual X.bar(java.lang.Runnable) : void [20]\n" + 
25885
		"    38  return\n" + 
25886
		"      Line numbers:\n" + 
25887
		"        [pc: 0, line: 5]\n" + 
25888
		"        [pc: 2, line: 6]\n" + 
25889
		"        [pc: 12, line: 7]\n" + 
25890
		"        [pc: 15, line: 9]\n" + 
25891
		"        [pc: 20, line: 10]\n" + 
25892
		"        [pc: 33, line: 11]\n" + 
25893
		"        [pc: 38, line: 12]\n" + 
25894
		"      Local variable table:\n" + 
25895
		"        [pc: 0, pc: 39] local: this index: 0 type: X\n" + 
25896
		"        [pc: 0, pc: 39] local: t index: 1 type: java.io.Serializable\n" + 
25897
		"        [pc: 2, pc: 39] local: r1 index: 2 type: java.lang.Runnable\n" + 
25898
		"        [pc: 12, pc: 39] local: r2 index: 3 type: java.lang.Runnable\n" + 
25899
		"        [pc: 15, pc: 39] local: r3 index: 4 type: java.lang.Runnable\n" + 
25900
		"      Local variable type table:\n" + 
25901
		"        [pc: 0, pc: 39] local: this index: 0 type: X<T,V>\n" + 
25902
		"        [pc: 0, pc: 39] local: t index: 1 type: T\n";
25903
	
25904
	try {
25905
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
25906
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
25907
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
25908
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
25909
		int index = result.indexOf(expectedOutput);
25910
		if (index == -1 || expectedOutput.length() == 0) {
25911
			System.out.println(Util.displayString(result, 3));
25912
		}
25913
		if (index == -1) {
25914
			assertEquals("Wrong contents", expectedOutput, result);
25915
		}
25916
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
25917
		assertTrue(false);
25918
	} catch (IOException e) {
25919
		assertTrue(false);
25920
	}		
25921
}
25922
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=110570
25923
public void test0826() {
25924
	this.runNegativeTest(
25925
		new String[] {
25926
			"X.java",
25927
			"public class X<T> {\n" + 
25928
			"\n" + 
25929
			"  public <V1, V2 extends V1> void test(V1 p1, V2 p2) {}\n" + 
25930
			"	\n" + 
25931
			"  public static void main(String[] args) {\n" + 
25932
			"    XA a = new XA(){};\n" + 
25933
			"    XB b = new XB(){};\n" + 
25934
			"\n" + 
25935
			"    X t1 = new X();\n" + 
25936
			"    t1.test(a, b); //this gives an error but should be OK\n" + 
25937
			"    \n" + 
25938
			"    X<Object> t2 = new X<Object>();\n" + 
25939
			"    t2.test(a, b); //this compiles OK\n" + 
25940
			"    Zork z;\n" +
25941
			"  }\n" + 
25942
			"}\n" + 
25943
			"\n" + 
25944
			"interface XA {}\n" + 
25945
			"interface XB extends XA {}\n",
25946
		},
25947
		"----------\n" + 
25948
		"1. WARNING in X.java (at line 9)\n" + 
25949
		"	X t1 = new X();\n" + 
25950
		"	^\n" + 
25951
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
25952
		"----------\n" + 
25953
		"2. WARNING in X.java (at line 9)\n" + 
25954
		"	X t1 = new X();\n" + 
25955
		"	           ^\n" + 
25956
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
25957
		"----------\n" + 
25958
		"3. WARNING in X.java (at line 10)\n" + 
25959
		"	t1.test(a, b); //this gives an error but should be OK\n" + 
25960
		"	^^^^^^^^^^^^^\n" + 
25961
		"Type safety: The method test(Object, Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
25962
		"----------\n" + 
25963
		"4. ERROR in X.java (at line 14)\n" + 
25964
		"	Zork z;\n" + 
25965
		"	^^^^\n" + 
25966
		"Zork cannot be resolved to a type\n" + 
25967
		"----------\n");
25968
}
25969
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=110570 - variation
25970
// ensure variable V2 is substituted with upper bound erasure (List) and not just upperbound List<String>
25971
// for raw generic method invocation
25972
public void test0827() {
25973
	this.runNegativeTest(
25974
		new String[] {
25975
			"X.java",
25976
			"import java.util.List;\n" + 
25977
			"public class X<T> {\n" + 
25978
			"  public <V1, V2 extends List<String>> void test(V1 p1, V2 p2) {}\n" + 
25979
			"  public static void main(String[] args) {\n" + 
25980
			"    XA a = new XA(){};\n" + 
25981
			"    List<Object> b = null;\n" + 
25982
			"    X t1 = new X();\n" + 
25983
			"    t1.test(a, b); //this gives an error but should be OK\n" + 
25984
			"    X<Object> t2 = new X<Object>();\n" + 
25985
			"    t2.test(a, b); //this compiles OK\n" + 
25986
			"  }\n" + 
25987
			"}\n" + 
25988
			"interface XA {}\n" + 
25989
			"\n",
25990
		},
25991
		"----------\n" + 
25992
		"1. WARNING in X.java (at line 7)\n" + 
25993
		"	X t1 = new X();\n" + 
25994
		"	^\n" + 
25995
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
25996
		"----------\n" + 
25997
		"2. WARNING in X.java (at line 7)\n" + 
25998
		"	X t1 = new X();\n" + 
25999
		"	           ^\n" + 
26000
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
26001
		"----------\n" + 
26002
		"3. WARNING in X.java (at line 8)\n" + 
26003
		"	t1.test(a, b); //this gives an error but should be OK\n" + 
26004
		"	^^^^^^^^^^^^^\n" + 
26005
		"Type safety: The method test(Object, List) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
26006
		"----------\n" + 
26007
		"4. ERROR in X.java (at line 10)\n" + 
26008
		"	t2.test(a, b); //this compiles OK\n" + 
26009
		"	   ^^^^\n" + 
26010
		"Bound mismatch: The generic method test(V1, V2) of type X<T> is not applicable for the arguments (XA, List<Object>). The inferred type List<Object> is not a valid substitute for the bounded parameter <V2 extends List<String>>\n" + 
26011
		"----------\n");
26012
}
26013
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=109249
26014
public void test0828() {
26015
	this.runNegativeTest(
26016
		new String[] {
26017
			"X.java",
26018
			"interface Transformable<T extends Transformable>\n" + 
26019
			"{\n" + 
26020
			"	public T transform();\n" + 
26021
			"}\n" + 
26022
			"interface Volume<V extends Volume> extends Transformable<V>\n" + 
26023
			"{\n" + 
26024
			"//	public V transform();\n" + 
26025
			"}\n" + 
26026
			"public class X {\n" + 
26027
			"	void foo(){\n" + 
26028
			"		Volume v1 = null;\n" + 
26029
			"		Volume v2 = v1.transform();\n" + 
26030
			"	}\n" + 
26031
			"	void bar(){\n" + 
26032
			"		Volume<Volume> v1 = null;\n" + 
26033
			"		Volume v2 = v1.transform();\n" + 
26034
			"	}\n" + 
26035
			"}\n",
26036
		},
26037
		"----------\n" + 
26038
		"1. WARNING in X.java (at line 1)\n" + 
26039
		"	interface Transformable<T extends Transformable>\n" + 
26040
		"	                                  ^^^^^^^^^^^^^\n" + 
26041
		"Transformable is a raw type. References to generic type Transformable<T> should be parameterized\n" + 
26042
		"----------\n" + 
26043
		"2. WARNING in X.java (at line 5)\n" + 
26044
		"	interface Volume<V extends Volume> extends Transformable<V>\n" + 
26045
		"	                           ^^^^^^\n" + 
26046
		"Volume is a raw type. References to generic type Volume<V> should be parameterized\n" + 
26047
		"----------\n" + 
26048
		"3. WARNING in X.java (at line 11)\n" + 
26049
		"	Volume v1 = null;\n" + 
26050
		"	^^^^^^\n" + 
26051
		"Volume is a raw type. References to generic type Volume<V> should be parameterized\n" + 
26052
		"----------\n" + 
26053
		"4. WARNING in X.java (at line 12)\n" + 
26054
		"	Volume v2 = v1.transform();\n" + 
26055
		"	^^^^^^\n" + 
26056
		"Volume is a raw type. References to generic type Volume<V> should be parameterized\n" + 
26057
		"----------\n" + 
26058
		"5. ERROR in X.java (at line 12)\n" + 
26059
		"	Volume v2 = v1.transform();\n" + 
26060
		"	            ^^^^^^^^^^^^^^\n" + 
26061
		"Type mismatch: cannot convert from Transformable to Volume\n" + 
26062
		"----------\n" + 
26063
		"6. WARNING in X.java (at line 15)\n" + 
26064
		"	Volume<Volume> v1 = null;\n" + 
26065
		"	       ^^^^^^\n" + 
26066
		"Volume is a raw type. References to generic type Volume<V> should be parameterized\n" + 
26067
		"----------\n" + 
26068
		"7. WARNING in X.java (at line 16)\n" + 
26069
		"	Volume v2 = v1.transform();\n" + 
26070
		"	^^^^^^\n" + 
26071
		"Volume is a raw type. References to generic type Volume<V> should be parameterized\n" + 
26072
		"----------\n");
26073
}
26074
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=109249 - variation
26075
public void test0829() {
26076
	this.runConformTest(
26077
		new String[] {
26078
			"X.java",
26079
			"interface Transformable<T extends Transformable>\n" + 
26080
			"{\n" + 
26081
			"	public T transform();\n" + 
26082
			"}\n" + 
26083
			"interface Volume<V extends Volume> extends Transformable<V>\n" + 
26084
			"{\n" + 
26085
			"	public V transform();\n" + 
26086
			"}\n" + 
26087
			"public class X {\n" + 
26088
			"	void foo(){\n" + 
26089
			"		Volume v1 = null;\n" + 
26090
			"		Volume v2 = v1.transform();\n" + 
26091
			"	}\n" + 
26092
			"	void bar(){\n" + 
26093
			"		Volume<Volume> v1 = null;\n" + 
26094
			"		Volume v2 = v1.transform();\n" + 
26095
			"	}\n" + 
26096
			"}\n",
26097
		},
26098
		"");
26099
}
26100
// ensure no raw type ref complaint inside instanceof / cast
26101
public void test0830() {
26102
	this.runNegativeTest(
26103
		new String[] {
26104
			"X.java",
26105
			"import java.util.*;\n" +
26106
			"public class X<T> {\n" + 
26107
			"	void foo(Object o) {\n" + 
26108
			"		boolean b = o instanceof X;\n" + 
26109
			"		X x = (X) o;\n" + 
26110
			"		X<String> xs = (X<String>)o;\n" + 
26111
			"		Zork z;\n" + 
26112
			"	}\n" + 
26113
			"	void bar(ArrayList<String> al) {\n" + 
26114
			"		List l = (List) al;\n" +
26115
			"	}\n" + 			
26116
			"}\n",
26117
		},
26118
		"----------\n" + 
26119
		"1. WARNING in X.java (at line 5)\n" + 
26120
		"	X x = (X) o;\n" + 
26121
		"	^\n" + 
26122
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
26123
		"----------\n" + 
26124
		"2. WARNING in X.java (at line 5)\n" + 
26125
		"	X x = (X) o;\n" + 
26126
		"	       ^\n" + 
26127
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
26128
		"----------\n" + 
26129
		"3. WARNING in X.java (at line 6)\n" + 
26130
		"	X<String> xs = (X<String>)o;\n" + 
26131
		"	               ^^^^^^^^^^^^\n" + 
26132
		"Type safety: Unchecked cast from Object to X<String>\n" + 
26133
		"----------\n" + 
26134
		"4. ERROR in X.java (at line 7)\n" + 
26135
		"	Zork z;\n" + 
26136
		"	^^^^\n" + 
26137
		"Zork cannot be resolved to a type\n" + 
26138
		"----------\n" + 
26139
		"5. WARNING in X.java (at line 10)\n" + 
26140
		"	List l = (List) al;\n" + 
26141
		"	^^^^\n" + 
26142
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
26143
		"----------\n" + 
26144
		"6. WARNING in X.java (at line 10)\n" + 
26145
		"	List l = (List) al;\n" + 
26146
		"	         ^^^^^^^^^\n" + 
26147
		"Unnecessary cast from ArrayList<String> to List\n" + 
26148
		"----------\n" + 
26149
		"7. WARNING in X.java (at line 10)\n" + 
26150
		"	List l = (List) al;\n" + 
26151
		"	          ^^^^\n" + 
26152
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
26153
		"----------\n");
26154
}
26155
//unnecessary cast may be combined with unchecked cast warning
26156
public void test0831() {
26157
	this.runNegativeTest(
26158
		new String[] {
26159
			"X.java",
26160
			"import java.util.*;\n" + 
26161
			"public class X {\n" + 
26162
			"	void foo(Object o1) {\n" + 
26163
			"		Object o2 = (List<String>) o1;\n" + 
26164
			"		\n" + 
26165
			"		foo((List<String>)o2);\n" + 
26166
			"	}\n" + 
26167
			"	Zork z;\n" +
26168
			"}\n",
26169
		},
26170
		"----------\n" + 
26171
		"1. WARNING in X.java (at line 4)\n" + 
26172
		"	Object o2 = (List<String>) o1;\n" + 
26173
		"	            ^^^^^^^^^^^^^^^^^\n" + 
26174
		"Type safety: Unchecked cast from Object to List<String>\n" + 
26175
		"----------\n" + 
26176
		"2. WARNING in X.java (at line 4)\n" + 
26177
		"	Object o2 = (List<String>) o1;\n" + 
26178
		"	            ^^^^^^^^^^^^^^^^^\n" + 
26179
		"Unnecessary cast from Object to List<String>\n" + 
26180
		"----------\n" + 
26181
		"3. WARNING in X.java (at line 6)\n" + 
26182
		"	foo((List<String>)o2);\n" + 
26183
		"	    ^^^^^^^^^^^^^^^^\n" + 
26184
		"Type safety: Unchecked cast from Object to List<String>\n" + 
26185
		"----------\n" + 
26186
		"4. WARNING in X.java (at line 6)\n" + 
26187
		"	foo((List<String>)o2);\n" + 
26188
		"	    ^^^^^^^^^^^^^^^^\n" + 
26189
		"Unnecessary cast from Object to List<String>\n" + 
26190
		"----------\n" + 
26191
		"5. ERROR in X.java (at line 8)\n" + 
26192
		"	Zork z;\n" + 
26193
		"	^^^^\n" + 
26194
		"Zork cannot be resolved to a type\n" + 
26195
		"----------\n");
26196
}
26197
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106010
26198
public void test0832() {
26199
	this.runNegativeTest(
26200
		new String[] {
26201
			"X.java",
26202
			"class C1<T> {\n" + 
26203
			"	class C11 {	}\n" + 
26204
			"	class C12 {\n" + 
26205
			"		T t;\n" + 
26206
			"		C1<T>.C11[] m() {\n" + 
26207
			"			C1<T>.C11[] ts = (C1<T>.C11[]) new C1<?>.C11[5];\n" + 
26208
			"			return ts;\n" + 
26209
			"		}\n" + 
26210
			"	}\n" + 
26211
			"	Zork z;\n" +			
26212
			"}\n",
26213
		},
26214
		"----------\n" + 
26215
		"1. ERROR in X.java (at line 10)\n" + 
26216
		"	Zork z;\n" + 
26217
		"	^^^^\n" + 
26218
		"Zork cannot be resolved to a type\n" + 
26219
		"----------\n");
26220
}
26221
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=111014
26222
public void test0833() {
26223
	this.runConformTest(
26224
		new String[] {
26225
			"A.java",
26226
			"class A<T1> {}\n",
26227
			"B.java",
26228
			"class B<T2> extends A<B<T2>.Inner> { class Inner {} }\n",
26229
			"C.java",
26230
			"class C { B<Integer> b; }\n",
26231
		},
26232
		"");
26233
	this.runConformTest(
26234
		new String[] {
26235
			"C.java",
26236
			"class C { B<Integer> b; }\n",
26237
		},
26238
		"",
26239
		null,
26240
		false,
26241
		null);
26242
}
26243
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100809
26244
public void test0834() {
26245
	this.runNegativeTest(
26246
		new String[] {
26247
			"X.java",
26248
			"import java.util.*;\n" + 
26249
			"public class X {\n" + 
26250
			"    public static void main(String[] args) {\n" + 
26251
			"        Set<Integer> set = new HashSet<Integer>();\n" + 
26252
			"        set.add(42);\n" + 
26253
			"        Collection<Number> collection;\n" + 
26254
			"        collection = (Collection) set;\n" + 
26255
			"        System.out.println(collection.iterator().next());\n" + 
26256
			"        Zork z;\n" + 
26257
			"    }\n" + 
26258
			"}\n",
26259
		},
26260
		"----------\n" + 
26261
		"1. WARNING in X.java (at line 7)\n" + 
26262
		"	collection = (Collection) set;\n" + 
26263
		"	             ^^^^^^^^^^^^^^^^\n" + 
26264
		"Type safety: The expression of type Collection needs unchecked conversion to conform to Collection<Number>\n" + 
26265
		"----------\n" + 
26266
		"2. WARNING in X.java (at line 7)\n" + 
26267
		"	collection = (Collection) set;\n" + 
26268
		"	              ^^^^^^^^^^\n" + 
26269
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
26270
		"----------\n" + 
26271
		"3. ERROR in X.java (at line 9)\n" + 
26272
		"	Zork z;\n" + 
26273
		"	^^^^\n" + 
26274
		"Zork cannot be resolved to a type\n" + 
26275
		"----------\n");
26276
}
26277
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=100809 - variation
26278
public void test0835() {
26279
	this.runNegativeTest(
26280
		new String[] {
26281
			"X.java",
26282
			"import java.util.*;\n" + 
26283
			"public class X {\n" + 
26284
			"	void foo(List<String> ls) {\n" + 
26285
			"		ArrayList<?> als = (ArrayList) ls;\n" + 
26286
			"	}\n" + 
26287
			"	Zork z;\n" +			
26288
			"}\n",
26289
		},
26290
		"----------\n" + 
26291
		"1. WARNING in X.java (at line 4)\n" + 
26292
		"	ArrayList<?> als = (ArrayList) ls;\n" + 
26293
		"	                    ^^^^^^^^^\n" + 
26294
		"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
26295
		"----------\n" + 
26296
		"2. ERROR in X.java (at line 6)\n" + 
26297
		"	Zork z;\n" + 
26298
		"	^^^^\n" + 
26299
		"Zork cannot be resolved to a type\n" + 
26300
		"----------\n");
26301
}
26302
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=111208
26303
public void test0836() {
26304
	this.runConformTest(
26305
		new String[] {
26306
			"X.java",
26307
			" import java.util.Iterator;\n" + 
26308
			" import java.util.List;\n" + 
26309
			"\n" + 
26310
			" public class X<A> {\n" + 
26311
			"\n" + 
26312
			" interface Factory<T> {\n" + 
26313
			" T invoke();\n" + 
26314
			"	}\n" + 
26315
			"\n" + 
26316
			"	public static <E> Iterator<E> iterate(Iterable<E> iterable) {\n" + 
26317
			"		return iterable.iterator();\n" + 
26318
			"	}\n" + 
26319
			"\n" + 
26320
			"	public Factory<Iterator<? extends A>> factory(final Factory<? extends List<? extends A>> factory) {\n" + 
26321
			"		return new Factory<Iterator<? extends A>>() {\n" + 
26322
			"			public Iterator<? extends A> invoke() {\n" + 
26323
			"				//String s = iterate(factory.invoke());\n" + 
26324
			"				return iterate(factory.invoke());\n" + 
26325
			"			}\n" + 
26326
			"		};\n" + 
26327
			"	}\n" + 
26328
			"}\n",
26329
		},
26330
		"");
26331
}
26332
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=111208 - variation
26333
public void test0837() {
26334
	this.runNegativeTest(
26335
		new String[] {
26336
			"X.java",
26337
			"import java.util.*;\n" + 
26338
			"\n" + 
26339
			"public class X {\n" + 
26340
			"	public void foo(List<? extends List<? extends Number>> l) {\n" + 
26341
			"		bar(l.get(0));\n" + 
26342
			"		swap(l.get(0));\n" + 
26343
			"	}\n" + 
26344
			"	void bar(String s) {}\n" + 
26345
			"	private static <T> void swap(List<T> l) {\n" + 
26346
			"	}\n" + 
26347
			"}\n",
26348
		},
26349
		"----------\n" + 
26350
		"1. ERROR in X.java (at line 5)\n" + 
26351
		"	bar(l.get(0));\n" + 
26352
		"	^^^\n" + 
26353
		"The method bar(String) in the type X is not applicable for the arguments (capture#1-of ? extends List<? extends Number>)\n" + 
26354
		"----------\n");
26355
}
26356
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=111689
26357
public void test0838() {
26358
	this.runConformTest(
26359
		new String[] {
26360
			"X.java",
26361
			"public class X {\n" + 
26362
			"	public class CClass<T extends AClass.BClass<T>> {\n" + 
26363
			"	}\n" + 
26364
			"}\n",
26365
			"AClass.java",
26366
			"public interface AClass<X extends AClass> {\n" + 
26367
			"	public interface BClass<T extends BClass> extends AClass<T> {\n" + 
26368
			"	}\n" + 
26369
			"}\n",		
26370
		},
26371
		"");
26372
}
26373
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=109118
26374
public void test0839() {
26375
	this.runConformTest(
26376
		new String[] {
26377
			"com/test/Tester.java",
26378
			"package com.test;\n" + 
26379
			"\n" + 
26380
			"import com.test.TestClass.MyException;\n" + 
26381
			"\n" + 
26382
			"public class Tester {\n" + 
26383
			"\n" + 
26384
			"	public static void main(String[] args) {\n" + 
26385
			"		try {\n" + 
26386
			"			TestClass<String> test = new TestClass<String>();\n" + 
26387
			"		} catch (MyException e) {\n" + 
26388
			"			System.out.println(\"SUCCESS\");\n" + 
26389
			"		}\n" + 
26390
			"	}\n" + 
26391
			"}",		
26392
			"com/test/TestClass.java",
26393
			"package com.test;\n" + 
26394
			"\n" + 
26395
			"public class TestClass<T> {\n" + 
26396
			"	\n" + 
26397
			"	public TestClass() throws MyException {\n" + 
26398
			"		throw new MyException();\n" + 
26399
			"	}\n" + 
26400
			"\n" + 
26401
			"	public static class MyException extends Exception {\n" + 
26402
			"		\n" + 
26403
			"		public MyException() {\n" + 
26404
			"			super();\n" + 
26405
			"		}\n" + 
26406
			"	}\n" + 
26407
			"}"			
26408
		},
26409
		"SUCCESS");
26410
}
26411
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=109118
26412
public void test0840() {
26413
	this.runNegativeTest(
26414
		new String[] {
26415
			"generics/NodeList.java",
26416
			"package generics;\n" + 
26417
			"public class NodeList<E> {\n" + 
26418
			"    public class Cursor { }\n" + 
26419
			"}",
26420
			"generics/user/User.java",
26421
			"package generics.user;\n" + 
26422
			"import generics.NodeList;\n" + 
26423
			"import generics.NodeList.Cursor;\n" + 
26424
			"public class User {\n" + 
26425
			"    Cursor raw;\n" + 
26426
			"    NodeList.Cursor rawQualified;\n" + 
26427
			"    NodeList<String>.Cursor parameterized;\n" + 
26428
			"\n" + 
26429
			"    void foo() {\n" + 
26430
			"        parameterized= rawQualified; //unchecked warning (OK)\n" + 
26431
			"        rawQualified= parameterized;\n" + 
26432
			"\n" + 
26433
			"        parameterized= raw; //should just give unchecked warning, but errors\n" + 
26434
			"        raw= parameterized; //should not error\n" + 
26435
			"\n" + 
26436
			"        raw= rawQualified; //should not error\n" + 
26437
			"        rawQualified= raw;\n" + 
26438
			"    }\n" + 
26439
			"    Zork z;\n" +
26440
			"}",
26441
		},
26442
		"----------\n" + 
26443
		"1. WARNING in generics\\user\\User.java (at line 5)\n" + 
26444
		"	Cursor raw;\n" + 
26445
		"	^^^^^^\n" + 
26446
		"NodeList.Cursor is a raw type. References to generic type NodeList<E>.Cursor should be parameterized\n" + 
26447
		"----------\n" + 
26448
		"2. WARNING in generics\\user\\User.java (at line 6)\n" + 
26449
		"	NodeList.Cursor rawQualified;\n" + 
26450
		"	^^^^^^^^^^^^^^^\n" + 
26451
		"NodeList.Cursor is a raw type. References to generic type NodeList<E>.Cursor should be parameterized\n" + 
26452
		"----------\n" + 
26453
		"3. WARNING in generics\\user\\User.java (at line 10)\n" + 
26454
		"	parameterized= rawQualified; //unchecked warning (OK)\n" + 
26455
		"	               ^^^^^^^^^^^^\n" + 
26456
		"Type safety: The expression of type NodeList.Cursor needs unchecked conversion to conform to NodeList<String>.Cursor\n" + 
26457
		"----------\n" + 
26458
		"4. WARNING in generics\\user\\User.java (at line 13)\n" + 
26459
		"	parameterized= raw; //should just give unchecked warning, but errors\n" + 
26460
		"	               ^^^\n" + 
26461
		"Type safety: The expression of type NodeList.Cursor needs unchecked conversion to conform to NodeList<String>.Cursor\n" + 
26462
		"----------\n" + 
26463
		"5. ERROR in generics\\user\\User.java (at line 19)\n" + 
26464
		"	Zork z;\n" + 
26465
		"	^^^^\n" + 
26466
		"Zork cannot be resolved to a type\n" + 
26467
		"----------\n");
26468
}
26469
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112268
26470
public void test0841() {
26471
	this.runConformTest(
26472
		new String[] {
26473
			"X.java", // =================
26474
			"import java.util.*;\n" + 
26475
			"\n" + 
26476
			"public class X {\n" + 
26477
			"  List<? extends Comparator> bar() {\n" + 
26478
			"	  List<? extends Comparator> l = foo();\n" + 
26479
			"	  return foo();\n" + 
26480
			"  }\n" + 
26481
			"  <T> List<T> foo() {\n" + 
26482
			"	  return null;\n" + 
26483
			"  }\n" + 
26484
			"}\n",
26485
		},
26486
		"");
26487
}
26488
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112500
26489
public void test0842() {
26490
	this.runNegativeTest(
26491
		new String[] {
26492
			"X.java", // =================
26493
			"import java.util.List;\n" + 
26494
			"\n" + 
26495
			"public class X {\n" + 
26496
			"	static <T> List<T> merge(List<? extends T> a, List<? extends T> b) {\n" + 
26497
			"		return null;\n" + 
26498
			"	}\n" + 
26499
			"\n" + 
26500
			"	public static void main(String[] args) {\n" + 
26501
			"		List<String> list1 = null;\n" + 
26502
			"		List<StringBuilder> list2 = null;\n" + 
26503
			"		List<? extends CharSequence> result = merge(list1, list2);\n" + 
26504
			"		List<? extends String> result2 = merge(list1, list2);\n" + 
26505
			"	}\n" + 
26506
			"}\n",
26507
		},
26508
		"----------\n" + 
26509
		"1. ERROR in X.java (at line 12)\n" + 
26510
		"	List<? extends String> result2 = merge(list1, list2);\n" + 
26511
		"	                                 ^^^^^^^^^^^^^^^^^^^\n" + 
26512
		"Type mismatch: cannot convert from List<Object&Serializable&CharSequence> to List<? extends String>\n" + 
26513
		"----------\n");
26514
}
26515
public void test0843() {
26516
	this.runNegativeTest(
26517
		new String[] {
26518
			"X.java", // =================
26519
			"import java.util.List;\n" + 
26520
			"\n" + 
26521
			"public class X {\n" + 
26522
			"	static <T> List<T> merge(List<? extends T> a, List<? extends T> b) {\n" + 
26523
			"		return null;\n" + 
26524
			"	}\n" + 
26525
			"\n" + 
26526
			"	public static void main(String[] args) {\n" + 
26527
			"		List<String> list1 = null;\n" + 
26528
			"		List<StringBuilder> list2 = null;\n" + 
26529
			"		Object result3 = (List<? extends CharSequence>)merge(list1, list2);\n" + 
26530
			"		Object result4 = (List<? extends String>)merge(list1, list2);\n" + 
26531
			"	}\n" + 
26532
			"}\n",
26533
		},
26534
		"----------\n" + 
26535
		"1. WARNING in X.java (at line 11)\n" + 
26536
		"	Object result3 = (List<? extends CharSequence>)merge(list1, list2);\n" + 
26537
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26538
		"Unnecessary cast from List<Object&Serializable&CharSequence> to List<? extends CharSequence>\n" + 
26539
		"----------\n" + 
26540
		"2. WARNING in X.java (at line 12)\n" + 
26541
		"	Object result4 = (List<? extends String>)merge(list1, list2);\n" + 
26542
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26543
		"Type safety: Unchecked cast from List<Object&Serializable&CharSequence> to List<? extends String>\n" + 
26544
		"----------\n" + 
26545
		"3. WARNING in X.java (at line 12)\n" + 
26546
		"	Object result4 = (List<? extends String>)merge(list1, list2);\n" + 
26547
		"	                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26548
		"Unnecessary cast from List<Object&Serializable&CharSequence> to List<? extends String>\n" + 
26549
		"----------\n");
26550
}
26551
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112595
26552
public void test0844() {
26553
	this.runConformTest(
26554
		new String[] {
26555
			"X.java", // =================
26556
			"import java.util.*;\n" + 
26557
			"public class X {\n" + 
26558
			"    public Set< ? extends X> getModifiers()\n" + 
26559
			"    {\n" + 
26560
			"        return Collections.emptySet();\n" + 
26561
			"    }\n" + 
26562
			"}\n",
26563
		},
26564
		"");
26565
}
26566
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112595
26567
public void test0845() {
26568
	this.runConformTest(
26569
		new String[] {
26570
			"Generic.java", // =================
26571
			"public class Generic<T> {\n" + 
26572
			"	public int size() {\n" + 
26573
			"		return 0;\n" + 
26574
			"	}\n" + 
26575
			"	public static void main(String[] args) {\n" + 
26576
			"		System.out.println(\"SUCCESS\");\n" + 
26577
			"	}\n" + 
26578
			"}", // =================
26579
		},
26580
		"SUCCESS");
26581
	this.runNegativeTest(
26582
			new String[] {
26583
				"X.java", // =================
26584
				"import java.util.ArrayList;\n" + 
26585
				"\n" + 
26586
				"public class X {\n" + 
26587
				"	public void testList(ArrayList aList) {\n" + 
26588
				"		aList.size();\n" + 
26589
				"	}\n" + 
26590
				"	public void testGeneric(Generic aGeneric) {\n" + 
26591
				"		aGeneric.size();\n" + 
26592
				"	}\n" + 
26593
				"	Zork z;\n" +
26594
				"}\n", // =================
26595
			},
26596
			"----------\n" + 
26597
			"1. WARNING in X.java (at line 4)\n" + 
26598
			"	public void testList(ArrayList aList) {\n" + 
26599
			"	                     ^^^^^^^^^\n" + 
26600
			"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + 
26601
			"----------\n" + 
26602
			"2. ERROR in X.java (at line 7)\n" + 
26603
			"	public void testGeneric(Generic aGeneric) {\n" + 
26604
			"	                        ^^^^^^^\n" + 
26605
			"Generic cannot be resolved to a type\n" + 
26606
			"----------\n" + 
26607
			"3. ERROR in X.java (at line 10)\n" + 
26608
			"	Zork z;\n" + 
26609
			"	^^^^\n" + 
26610
			"Zork cannot be resolved to a type\n" + 
26611
			"----------\n");
26612
	}
26613
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112666
26614
public void test0846() {
26615
	this.runConformTest(
26616
		new String[] {
26617
			"X.java", // =================
26618
			"import java.util.Collection;\n" + 
26619
			"public class X {\n" + 
26620
			"	void m() {\n" + 
26621
			"		Collection<? super Collection<? super Number>> col = null;\n" + 
26622
			"		java.util.List<java.lang.Number> n = null;\n" + 
26623
			"		col.add(n);\n" + 
26624
			"	}\n" + 
26625
			"}\n", // =================
26626
		},
26627
		"");
26628
}
26629
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112666
26630
public void test0847() {
26631
	this.runNegativeTest(
26632
		new String[] {
26633
			"X.java", // =================
26634
			"import java.util.Collection;\n" + 
26635
			"\n" + 
26636
			"public class X {\n" + 
26637
			"	void m() {\n" + 
26638
			"		Collection<? extends Collection<? super Number>> col = null;\n" + 
26639
			"		java.util.List<java.lang.Number> n = null;\n" + 
26640
			"		col.add(n);\n" + 
26641
			"	}\n" + 
26642
			"}\n", // =================
26643
		},
26644
		"----------\n" + 
26645
		"1. ERROR in X.java (at line 7)\n" + 
26646
		"	col.add(n);\n" + 
26647
		"	    ^^^\n" + 
26648
		"The method add(capture#1-of ? extends Collection<? super Number>) in the type Collection<capture#1-of ? extends Collection<? super Number>> is not applicable for the arguments (List<Number>)\n" + 
26649
		"----------\n");
26650
}
26651
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106451
26652
public void test0848() {
26653
	this.runNegativeTest(
26654
		new String[] {
26655
			"X.java", // =================
26656
			"import java.util.*;\n" + 
26657
			"\n" + 
26658
			"public class X<E> {\n" + 
26659
			"	Collection<? extends Number> asList= Arrays.asList(1, 2.2);\n" + 
26660
			"	List<Number> nums= (List<Number>) asList; // correct warning\n" + 
26661
			"	List<Number> numz= (LinkedList<Number>) asList; // type safety warning missing\n" + 
26662
			"	Zork z;\n" + 
26663
			"}\n", // =================
26664
		},
26665
		"----------\n" + 
26666
		"1. WARNING in X.java (at line 4)\n" + 
26667
		"	Collection<? extends Number> asList= Arrays.asList(1, 2.2);\n" + 
26668
		"	                                     ^^^^^^^^^^^^^^^^^^^^^\n" + 
26669
		"Type safety : A generic array of Number&Comparable<?> is created for a varargs parameter\n" + 
26670
		"----------\n" + 
26671
		"2. WARNING in X.java (at line 5)\n" + 
26672
		"	List<Number> nums= (List<Number>) asList; // correct warning\n" + 
26673
		"	                   ^^^^^^^^^^^^^^^^^^^^^\n" + 
26674
		"Type safety: Unchecked cast from Collection<capture#1-of ? extends Number> to List<Number>\n" + 
26675
		"----------\n" + 
26676
		"3. WARNING in X.java (at line 6)\n" + 
26677
		"	List<Number> numz= (LinkedList<Number>) asList; // type safety warning missing\n" + 
26678
		"	                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26679
		"Type safety: Unchecked cast from Collection<capture#2-of ? extends Number> to LinkedList<Number>\n" + 
26680
		"----------\n" + 
26681
		"4. ERROR in X.java (at line 7)\n" + 
26682
		"	Zork z;\n" + 
26683
		"	^^^^\n" + 
26684
		"Zork cannot be resolved to a type\n" + 
26685
		"----------\n");
26686
	
26687
	this.runConformTest(
26688
			new String[] {
26689
				"X.java", // =================
26690
				"import java.util.*;\n" + 
26691
				"\n" + 
26692
				"public class X<E> {\n" + 
26693
				"	Collection<? extends Number> asList= Arrays.asList(1, 2.2);\n" + 
26694
				"	List<Number> nums= (List<Number>) asList; // correct warning\n" + 
26695
				"	List<Number> numz= (LinkedList<Number>) asList; // type safety warning missing\n" + 
26696
				"}\n", // =================
26697
			},
26698
			"");
26699
	// 	ensure proper declaring class for #run() invocation
26700
	String expectedOutput =
26701
		"  // Method descriptor #14 ()V\n" + 
26702
		"  // Stack: 6, Locals: 1\n" + 
26703
		"  public X();\n" + 
26704
		"     0  aload_0 [this]\n" + 
26705
		"     1  invokespecial java.lang.Object() [16]\n" + 
26706
		"     4  aload_0 [this]\n" + 
26707
		"     5  iconst_2\n" + 
26708
		"     6  anewarray java.lang.Number [18]\n" + 
26709
		"     9  dup\n" + 
26710
		"    10  iconst_0\n" + 
26711
		"    11  iconst_1\n" + 
26712
		"    12  invokestatic java.lang.Integer.valueOf(int) : java.lang.Integer [20]\n" + 
26713
		"    15  aastore\n" + 
26714
		"    16  dup\n" + 
26715
		"    17  iconst_1\n" + 
26716
		"    18  ldc2_w <Double 2.2> [26]\n" + 
26717
		"    21  invokestatic java.lang.Double.valueOf(double) : java.lang.Double [28]\n" + 
26718
		"    24  aastore\n" + 
26719
		"    25  invokestatic java.util.Arrays.asList(java.lang.Object[]) : java.util.List [33]\n" + 
26720
		"    28  checkcast java.util.Collection [38]\n" + 
26721
		"    31  putfield X.asList : java.util.Collection [40]\n" + 
26722
		"    34  aload_0 [this]\n" + 
26723
		"    35  aload_0 [this]\n" + 
26724
		"    36  getfield X.asList : java.util.Collection [40]\n" + 
26725
		"    39  checkcast java.util.List [42]\n" + 
26726
		"    42  putfield X.nums : java.util.List [44]\n" + 
26727
		"    45  aload_0 [this]\n" + 
26728
		"    46  aload_0 [this]\n" + 
26729
		"    47  getfield X.asList : java.util.Collection [40]\n" + 
26730
		"    50  checkcast java.util.LinkedList [46]\n" + // <--- checkcast must appear
26731
		"    53  putfield X.numz : java.util.List [48]\n" + 
26732
		"    56  return\n";
26733
	
26734
	try {
26735
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
26736
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
26737
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
26738
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
26739
		int index = result.indexOf(expectedOutput);
26740
		if (index == -1 || expectedOutput.length() == 0) {
26741
			System.out.println(Util.displayString(result, 3));
26742
		}
26743
		if (index == -1) {
26744
			assertEquals("Wrong contents", expectedOutput, result);
26745
		}
26746
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
26747
		assertTrue(false);
26748
	} catch (IOException e) {
26749
		assertTrue(false);
26750
	}			
26751
}
26752
//ensure no unsafe cast is diagnosed
26753
public void test0849() {
26754
	this.runNegativeTest(
26755
		new String[] {
26756
			"X.java", // =================
26757
			"public class X {\n" + 
26758
			"    static <T, U extends T> T[] cast(U[] a) { return (T[]) a; }\n" + 
26759
			"    Zork z;\n" + 
26760
			"}\n", // =================
26761
		},
26762
		"----------\n" + 
26763
		"1. WARNING in X.java (at line 2)\n" + 
26764
		"	static <T, U extends T> T[] cast(U[] a) { return (T[]) a; }\n" + 
26765
		"	                                                 ^^^^^^^\n" + 
26766
		"Unnecessary cast from U[] to T[]\n" + 
26767
		"----------\n" + 
26768
		"2. ERROR in X.java (at line 3)\n" + 
26769
		"	Zork z;\n" + 
26770
		"	^^^^\n" + 
26771
		"Zork cannot be resolved to a type\n" + 
26772
		"----------\n");	
26773
}
26774
public void test0850() {
26775
	this.runNegativeTest(
26776
		new String[] {
26777
			"X.java", // =================
26778
			"public class X {\n" + 
26779
			"    <T> T f(Object o) {\n" + 
26780
			"	return (T) o; // OK\n" + 
26781
			"    }\n" + 
26782
			"\n" + 
26783
			"    <U, T extends U> T g(Object o) {\n" + 
26784
			"	return (T) o; // bug???\n" + 
26785
			"    }\n" + 
26786
			"\n" + 
26787
			"    <U, T extends U> T h(Object o) {\n" + 
26788
			"	return X.<T>castTo(o); // workaround\n" + 
26789
			"    }\n" + 
26790
			"\n" + 
26791
			"    private static <T> T castTo(Object o) {\n" + 
26792
			"	return (T) o;\n" + 
26793
			"    }\n" + 
26794
			"    Zork z;\n" + 
26795
			"}\n", // =================
26796
		},
26797
		"----------\n" + 
26798
		"1. WARNING in X.java (at line 3)\n" + 
26799
		"	return (T) o; // OK\n" + 
26800
		"	       ^^^^^\n" + 
26801
		"Type safety: Unchecked cast from Object to T\n" + 
26802
		"----------\n" + 
26803
		"2. WARNING in X.java (at line 7)\n" + 
26804
		"	return (T) o; // bug???\n" + 
26805
		"	       ^^^^^\n" + 
26806
		"Type safety: Unchecked cast from Object to T\n" + 
26807
		"----------\n" + 
26808
		"3. WARNING in X.java (at line 15)\n" + 
26809
		"	return (T) o;\n" + 
26810
		"	       ^^^^^\n" + 
26811
		"Type safety: Unchecked cast from Object to T\n" + 
26812
		"----------\n" + 
26813
		"4. ERROR in X.java (at line 17)\n" + 
26814
		"	Zork z;\n" + 
26815
		"	^^^^\n" + 
26816
		"Zork cannot be resolved to a type\n" + 
26817
		"----------\n");	
26818
}
26819
public void test0851() {
26820
	this.runNegativeTest(
26821
		new String[] {
26822
			"X.java", // =================
26823
			"interface Foo {}\n" + 
26824
			"interface Bar<T> {}\n" + 
26825
			"public class X {\n" + 
26826
			"    Object m(Foo f) {\n" + 
26827
			"        return (Bar<Object>)f;\n" + 
26828
			"    }\n" + 
26829
			"    Zork z;\n" + 
26830
			"}\n", // =================
26831
		},
26832
		"----------\n" + 
26833
		"1. WARNING in X.java (at line 5)\n" + 
26834
		"	return (Bar<Object>)f;\n" + 
26835
		"	       ^^^^^^^^^^^^^^\n" + 
26836
		"Type safety: Unchecked cast from Foo to Bar<Object>\n" + 
26837
		"----------\n" + 
26838
		"2. WARNING in X.java (at line 5)\n" + 
26839
		"	return (Bar<Object>)f;\n" + 
26840
		"	       ^^^^^^^^^^^^^^\n" + 
26841
		"Unnecessary cast from Foo to Bar<Object>\n" + 
26842
		"----------\n" + 
26843
		"3. ERROR in X.java (at line 7)\n" + 
26844
		"	Zork z;\n" + 
26845
		"	^^^^\n" + 
26846
		"Zork cannot be resolved to a type\n" + 
26847
		"----------\n");	
26848
}
26849
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106466
26850
public void test0852() {
26851
	this.runNegativeTest(
26852
		new String[] {
26853
			"X.java", // =================
26854
			"public class X {\n" + 
26855
			"	<T extends Runnable, U extends T & Runnable>  T foo() { return null; }\n" + 
26856
			"}\n", // =================
26857
		},
26858
		"----------\n" + 
26859
		"1. ERROR in X.java (at line 2)\n" + 
26860
		"	<T extends Runnable, U extends T & Runnable>  T foo() { return null; }\n" + 
26861
		"	                                   ^^^^^^^^\n" + 
26862
		"Cannot specify any additional bound Runnable when first bound is a type parameter\n" + 
26863
		"----------\n");	
26864
}
26865
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=112109
26866
public void test0853() {
26867
	this.runConformTest(
26868
		new String[] {
26869
			"X.java",
26870
			"public class X<C extends I> {\n" + 
26871
			"	void test(java.util.List<C> list) { list.get(0).notify(null); }\n" + 
26872
			"}\n" +
26873
			"interface I { Object notify(Object o); }",
26874
		},
26875
		"");	
26876
}
26877
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113236
26878
public void test0854() {
26879
	this.runConformTest(
26880
		new String[] {
26881
			"X.java",
26882
			"public class X {\n" +
26883
			"	public static void main(String[] args) {\n" +
26884
			"		Field field = new Field();\n" +
26885
			"		Form form = new Form(field);\n" +
26886
			"		String result = form.getField().toString();\n" +
26887
			"		System.out.print(result);\n" +
26888
			"	}\n" +
26889
			"}",
26890
			"Form.java",
26891
			"public class Form {\n" +
26892
			"	private final Field field;\n" +
26893
			"	public Form(Field field) {\n" +
26894
			"		this.field = field;\n" +
26895
			"	}\n" +
26896
			"	public <T extends Field> T getField() {\n" +
26897
			"		return (T) field;\n" +
26898
			"	}\n" +
26899
			"}",
26900
			"Field.java",
26901
			"public class Field {\n" +
26902
			"	@Override\n" +
26903
			"	public String toString() {\n" +
26904
			"		return \"SUCCESS\";\n" +
26905
			"	}\n" +
26906
			"}",
26907
		},
26908
		"SUCCESS");	
26909
}
26910
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113218
26911
public void test0855() {
26912
	this.runConformTest(
26913
		new String[] {
26914
			"X.java",
26915
			"public class X {\n" +
26916
			"	public static void main(String[] args) {\n" +
26917
			"		FieldManager manager = new FieldManagerImpl();\n" +
26918
			"		FieldMeta<FieldImpl> meta = new FieldMeta<FieldImpl>(manager);\n" +
26919
			"		Field<? extends Field> field = new FieldImpl(meta);\n" +
26920
			"		FieldMeta<? extends Field> meta2 = field.getFieldMeta();\n" +
26921
			"		System.out.print(meta2.getFieldManager() instanceof ExtFieldManager);\n" +
26922
			"	}\n" +
26923
			"}",
26924
			"FieldMeta.java",
26925
			"public class FieldMeta<F extends Field> {\n" +
26926
			"	private final FieldManager<F> fieldManager;\n" +
26927
			"	public FieldMeta(FieldManager<F> fieldManager) {\n" +
26928
			"		this.fieldManager = fieldManager;\n" +
26929
			"	}\n" +
26930
			"	public <FB extends FieldManager<F>> FB getFieldManager() {\n" +
26931
			"		return (FB) fieldManager;\n" +
26932
			"	}\n" +
26933
			"}",
26934
			"FieldManagerImpl.java",
26935
			"public class FieldManagerImpl extends FieldManager<FieldImpl> implements\n" +
26936
			"	ExtFieldManager<FieldImpl> {\n" +
26937
			"}",
26938
			"FieldManager.java",
26939
			"public abstract class FieldManager<F extends Field> {}",
26940
			"FieldImpl.java",
26941
			"public class FieldImpl extends Field<FieldImpl> {\n" +
26942
			"	public FieldImpl(FieldMeta<FieldImpl> fieldMeta) {\n" +
26943
			"		super(fieldMeta);\n" +
26944
			"	}\n" +
26945
			"}",
26946
			"Field.java",
26947
			"public class Field<F extends Field> {\n" +
26948
			"	private final FieldManager<F> fieldManager;\n" +
26949
			"	private final FieldMeta<F> fieldMeta;\n" +
26950
			"	public FieldMeta<F> getFieldMeta() {\n" +
26951
			"		return fieldMeta;\n" +
26952
			"	}\n" +
26953
			"	public Field(FieldMeta<F> fieldMeta) {\n" +
26954
			"		this.fieldMeta = fieldMeta;\n" +
26955
			"		this.fieldManager = fieldMeta.getFieldManager();\n" +
26956
			"	}\n" +
26957
			"	public FieldManager<F> getFieldManager() {\n" +
26958
			"		return fieldManager;\n" +
26959
			"	}\n" +
26960
			"}",
26961
			"ExtFieldManager.java",
26962
			"public interface ExtFieldManager<F extends Field> {}"
26963
		},
26964
		"true");	
26965
}
26966
public void test0856() {
26967
	this.runConformTest(
26968
		new String[] {
26969
			"X.java",
26970
			"public class X {\n" + 
26971
			"	static class MX<T> {\n" + 
26972
			"		T t = null;\n" + 
26973
			"	}\n" + 
26974
			"	static <T> T getT() {\n" + 
26975
			"		return (new MX<T>()).t;\n" + 
26976
			"	}\n" + 
26977
			"	public static void test() {\n" + 
26978
			"		getT().getClass(); // error: java.lang.Object cannot be dereferenced\n" + 
26979
			"	}\n" + 
26980
			"\n" + 
26981
			"	public static void main(String[] args) {\n" + 
26982
			"		System.out.println(\"SUCCESS\");\n" + 
26983
			"	}\n" + 
26984
			"}\n",
26985
		},
26986
		"SUCCESS");	
26987
}
26988
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113070
26989
public void test0857() {
26990
	this.runNegativeTest(
26991
		new String[] {
26992
			"X.java",
26993
			"public class X {\n" + 
26994
			"	public <U, T extends U & Cloneable & Runnable> void m(T t) {\n" + 
26995
			"	}\n" + 
26996
			"}\n",
26997
		},
26998
		"----------\n" + 
26999
		"1. ERROR in X.java (at line 2)\n" + 
27000
		"	public <U, T extends U & Cloneable & Runnable> void m(T t) {\n" + 
27001
		"	                         ^^^^^^^^^\n" + 
27002
		"Cannot specify any additional bound Cloneable when first bound is a type parameter\n" + 
27003
		"----------\n");	
27004
}
27005
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113560
27006
public void test0858() {
27007
	this.runConformTest(
27008
		new String[] {
27009
			"X.java",
27010
			"interface ExtCloneable extends Cloneable {\n" +
27011
			"	public ExtCloneable clone( String arg) throws CloneNotSupportedException;\n" +
27012
			"}\n" +
27013
			"public class X {\n" +
27014
			"	public static <V extends ExtCloneable> ExtCloneable cloneItem1( V value) throws CloneNotSupportedException {\n" +
27015
			"		return value.clone( \"\");\n" +
27016
			"	}\n" +
27017
			"	public static <V extends ExtCloneable> ExtCloneable cloneItem2( ExtCloneable value) throws CloneNotSupportedException {\n" +
27018
			"		return value.clone( \"\");\n" +
27019
			"	}\n" +
27020
			"	public static <V extends ExtCloneable> ExtCloneable cloneItem3( V value) throws CloneNotSupportedException {\n" +
27021
			"		return ((ExtCloneable)value).clone( \"\");\n" +
27022
			"	}\n" +
27023
			"}",
27024
		},
27025
		"");	
27026
}
27027
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113710
27028
public void test0859() {
27029
	this.runConformTest(
27030
		new String[] {
27031
			"X.java",
27032
			"import java.awt.Graphics2D;\n" +
27033
			"import java.awt.Shape;\n" +
27034
			"public class X<V extends DrawObject> {\n" +
27035
			"   /** Base object for wrapping */\n" +
27036
			"   protected V draw;\n" +
27037
			"   /**\n" +
27038
			"    * Draw the object with its attached text\n" +
27039
			"    * \n" +
27040
			"    * @param graphics the graphics object to draw into\n" +
27041
			"    */\n" +
27042
			"   public void draw( Graphics2D graphics ) {\n" +
27043
			"      draw.draw(graphics);\n" +
27044
			"   }\n" +
27045
			"}\n" +
27046
			"abstract class DrawObject implements Drawable {\n" +
27047
			"   protected void draw( Graphics2D graphics, Shape shape ) {\n" +
27048
			"   }\n" +
27049
			"}\n" +
27050
			"interface Drawable {\n" +
27051
			"   void draw( Graphics2D graphics );\n" +
27052
			"}",
27053
		},
27054
		"");	
27055
}
27056
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114304
27057
public void test0860() {
27058
	this.runConformTest(
27059
		new String[] {
27060
			"A.java",
27061
			"interface A {\n" + 
27062
			"    A.I foo();\n" + 
27063
			"    interface I { }\n" + 
27064
			"}\n" + 
27065
			"\n" + 
27066
			"interface B<T> extends A { }\n" + 
27067
			"\n" + 
27068
			"interface C extends B<Object> {\n" + 
27069
			"    C.J foo();\n" + 
27070
			"    interface J extends B.I { }\n" + 
27071
			"}\n",
27072
		},
27073
		"");	
27074
}
27075
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114304 - variation
27076
public void test0861() {
27077
	this.runConformTest(
27078
		new String[] {
27079
			"A.java",
27080
			"interface A {\n" + 
27081
			"    A.I foo();\n" + 
27082
			"    interface I { }\n" + 
27083
			"}\n" + 
27084
			"\n" + 
27085
			"interface B<T> extends A { }\n" + 
27086
			"\n" + 
27087
			"interface C extends B<Object> {\n" + 
27088
			"    C.J foo();\n" + 
27089
			"    interface J extends A.I { }\n" + 
27090
			"}\n",
27091
		},
27092
		"");	
27093
}
27094
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114304 - variation
27095
public void test0862() {
27096
	this.runConformTest(
27097
		new String[] {
27098
			"A.java",
27099
			"interface A {\n" + 
27100
			"    interface I { }\n" + 
27101
			"\n" + 
27102
			"    A.I foo();\n" + 
27103
			"}\n" + 
27104
			"\n" + 
27105
			"interface B<T> extends A { \n" + 
27106
			"    interface J extends B.I { }\n" + 
27107
			"}\n" + 
27108
			"\n" + 
27109
			"interface C extends B<Object> {\n" + 
27110
			"    C.J foo();\n" + 
27111
			"}\n",
27112
		},
27113
		"");	
27114
}
27115
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114304 - variation
27116
public void test0863() {
27117
	this.runConformTest(
27118
		new String[] {
27119
			"A.java",
27120
			"interface A {\n" + 
27121
			"    interface I { }\n" + 
27122
			"\n" + 
27123
			"    A.I foo();\n" + 
27124
			"}\n" + 
27125
			"\n" + 
27126
			"interface B<T> extends A { \n" + 
27127
			"    interface J extends B.I { }\n" + 
27128
			"}\n" + 
27129
			"\n" + 
27130
			"interface C extends B<Object> {\n" + 
27131
			"    B.J foo();\n" + 
27132
			"}\n",
27133
		},
27134
		"");	
27135
}
27136
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114304 - variation
27137
public void test0864() {
27138
	this.runConformTest(
27139
		new String[] {
27140
			"A.java",
27141
			"interface A {\n" + 
27142
			"    interface I<T> { }\n" + 
27143
			"\n" + 
27144
			"    A.I<Object> foo();\n" + 
27145
			"}\n" + 
27146
			"\n" + 
27147
			"interface B<T> extends A { \n" + 
27148
			"    interface J<E> extends B.I<E> { }\n" + 
27149
			"}\n" + 
27150
			"\n" + 
27151
			"interface C extends B<Object> {\n" + 
27152
			"    C.J<Object> foo();\n" + 
27153
			"}\n",
27154
		},
27155
		"");	
27156
}
27157
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114304 - variation
27158
public void test0865() {
27159
	this.runConformTest(
27160
		new String[] {
27161
			"A.java",
27162
			"class A {\n" + 
27163
			"    interface I { }\n" + 
27164
			"\n" + 
27165
			"    A.I foo() { return null; }\n" + 
27166
			"}\n" + 
27167
			"\n" + 
27168
			"class B<T> extends A { \n" + 
27169
			"    interface J extends B.I { }\n" + 
27170
			"}\n" + 
27171
			"\n" + 
27172
			"class C extends B<Object> {\n" + 
27173
			"	@Override\n" + 
27174
			"    C.J foo() { return (B.J)super.foo(); }\n" + 
27175
			"}\n",
27176
		},
27177
		"");	
27178
}
27179
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114997
27180
public void test0866() {
27181
	this.runConformTest(
27182
		new String[] {
27183
			"X.java",
27184
			"import java.util.Collections;\n" + 
27185
			"import java.util.List;\n" + 
27186
			"\n" + 
27187
			"public class X {\n" + 
27188
			"  public interface Interface {\n" + 
27189
			"	  // nothing\n" + 
27190
			"  }\n" + 
27191
			"  public List<? extends Interface> field = Collections.emptyList();\n" + 
27192
			"}\n",
27193
		},
27194
		"");	
27195
}
27196
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114087
27197
public void test0867() {
27198
	this.runNegativeTest(
27199
		new String[] {
27200
			"X.java",
27201
			"import java.util.List;\n" + 
27202
			"\n" + 
27203
			"class Foo {\n" + 
27204
			"\n" + 
27205
			"	static <T extends Runnable> List<List<T>> foo1() {\n" + 
27206
			"		return null;\n" + 
27207
			"	}\n" + 
27208
			"	static <T extends Runnable> void bar1(List<List<T>> l) {\n" + 
27209
			"	}\n" + 
27210
			"	static <T extends Runnable> List<T> foo2() {\n" + 
27211
			"		return null;\n" + 
27212
			"	}\n" + 
27213
			"	static <T extends Runnable> void bar2(List<T> l) {\n" + 
27214
			"	}\n" + 
27215
			"}\n" + 
27216
			"\n" + 
27217
			"public class X {\n" + 
27218
			"\n" + 
27219
			"	{\n" + 
27220
			"		List<List> o = Foo.foo1();\n" + 
27221
			"		Foo.bar1(o);\n" + 
27222
			"	}\n" + 
27223
			"	{\n" + 
27224
			"		List o = Foo.foo2();\n" + 
27225
			"		Foo.bar2(o);\n" + 
27226
			"	}\n" + 
27227
			"\n" + 
27228
			"}\n",
27229
		},
27230
		"----------\n" + 
27231
		"1. WARNING in X.java (at line 20)\n" + 
27232
		"	List<List> o = Foo.foo1();\n" + 
27233
		"	     ^^^^\n" + 
27234
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
27235
		"----------\n" + 
27236
		"2. ERROR in X.java (at line 20)\n" + 
27237
		"	List<List> o = Foo.foo1();\n" + 
27238
		"	                   ^^^^\n" + 
27239
		"The method foo1() in the type Foo is not applicable for the arguments ()\n" + 
27240
		"----------\n" + 
27241
		"3. ERROR in X.java (at line 21)\n" + 
27242
		"	Foo.bar1(o);\n" + 
27243
		"	    ^^^^\n" + 
27244
		"The method bar1(List<List<T>>) in the type Foo is not applicable for the arguments (List<List>)\n" + 
27245
		"----------\n" + 
27246
		"4. WARNING in X.java (at line 24)\n" + 
27247
		"	List o = Foo.foo2();\n" + 
27248
		"	^^^^\n" + 
27249
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
27250
		"----------\n" + 
27251
		"5. WARNING in X.java (at line 25)\n" + 
27252
		"	Foo.bar2(o);\n" + 
27253
		"	^^^^^^^^^^^\n" + 
27254
		"Type safety: Unchecked invocation bar2(List) of the generic method bar2(List<T>) of type Foo\n" + 
27255
		"----------\n" + 
27256
		"6. WARNING in X.java (at line 25)\n" + 
27257
		"	Foo.bar2(o);\n" + 
27258
		"	         ^\n" + 
27259
		"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + 
27260
		"----------\n");	
27261
}
27262
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114365
27263
public void test0868() {
27264
	Map options = getCompilerOptions();
27265
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
27266
	this.runConformTest(
27267
		new String[] {
27268
			"X.java",
27269
			"import java.util.Collection;\n" +
27270
			"import java.util.Iterator;\n" +
27271
			"import java.io.Serializable;\n" +
27272
			"import java.lang.Cloneable;\n" +
27273
			"public class X<A extends Collection & Serializable > implements Collection {\n" +
27274
			"	public int size() {\n" +
27275
			"		// TODO Auto-generated method stub\n" +
27276
			"		return 0;\n" +
27277
			"	}\n" +
27278
			"	public boolean isEmpty() {\n" +
27279
			"		// TODO Auto-generated method stub\n" +
27280
			"		return false;\n" +
27281
			"	}\n" +
27282
			"	public boolean contains(Object arg0) {\n" +
27283
			"		// TODO Auto-generated method stub\n" +
27284
			"		return false;\n" +
27285
			"	}\n" +
27286
			"	public Iterator iterator() {\n" +
27287
			"		// TODO Auto-generated method stub\n" +
27288
			"		return null;\n" +
27289
			"	}\n" +
27290
			"	public Object[] toArray() {\n" +
27291
			"		// TODO Auto-generated method stub\n" +
27292
			"		return null;\n" +
27293
			"	}\n" +
27294
			"	public Object[] toArray(Object[] arg0) {\n" +
27295
			"		// TODO Auto-generated method stub\n" +
27296
			"		return null;\n" +
27297
			"	}\n" +
27298
			"	public boolean add(Object arg0) {\n" +
27299
			"		// TODO Auto-generated method stub\n" +
27300
			"		return false;\n" +
27301
			"	}\n" +
27302
			"	public boolean remove(Object arg0) {\n" +
27303
			"		// TODO Auto-generated method stub\n" +
27304
			"		return false;\n" +
27305
			"	}\n" +
27306
			"	public boolean containsAll(Collection arg0) {\n" +
27307
			"		// TODO Auto-generated method stub\n" +
27308
			"		return false;\n" +
27309
			"	}\n" +
27310
			"	public boolean addAll(Collection arg0) {\n" +
27311
			"		// TODO Auto-generated method stub\n" +
27312
			"		return false;\n" +
27313
			"	}\n" +
27314
			"	public boolean removeAll(Collection arg0) {\n" +
27315
			"		// TODO Auto-generated method stub\n" +
27316
			"		return false;\n" +
27317
			"	}\n" +
27318
			"	public boolean retainAll(Collection arg0) {\n" +
27319
			"		// TODO Auto-generated method stub\n" +
27320
			"		return false;\n" +
27321
			"	}\n" +
27322
			"	public void clear() {\n" +
27323
			"		// TODO Auto-generated method stub\n" +
27324
			"		\n" +
27325
			"	}" +
27326
			"}",
27327
		},
27328
		"",
27329
		null,
27330
		true,
27331
		null,
27332
		options,
27333
		null);	
27334
}
27335
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115181
27336
public void test0869() {
27337
	this.runNegativeTest(
27338
		new String[] {
27339
			"X.java",
27340
			"import java.util.Comparator;\n" + 
27341
			"\n" + 
27342
			"public class X {\n" + 
27343
			"	public static void main(String[] args) {\n" + 
27344
			"		Class<?> c = Comparator.class;\n" + 
27345
			"		Zork z;\n" +
27346
			"	}\n" + 
27347
			"}\n",
27348
		},
27349
		"----------\n" + 
27350
		"1. ERROR in X.java (at line 6)\n" + 
27351
		"	Zork z;\n" + 
27352
		"	^^^^\n" + 
27353
		"Zork cannot be resolved to a type\n" + 
27354
		"----------\n");
27355
}
27356
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=113950
27357
public void test0870() {
27358
	this.runConformTest(
27359
		new String[] {
27360
			"X.java",
27361
			"import java.util.List;\n" + 
27362
			"\n" + 
27363
			"public class X {\n" + 
27364
			"	public interface I<T> {\n" + 
27365
			"	        public <S extends T> void foo(List<S> ls);\n" + 
27366
			"	}\n" + 
27367
			"\n" + 
27368
			"	public abstract class A<T> implements I<T> {\n" + 
27369
			"	        public <S extends T> void foo(List<S> ls) { }\n" + 
27370
			"	}\n" + 
27371
			"\n" + 
27372
			"	public class C<T> extends A<List<T>> { }\n" + 
27373
			"}\n",
27374
		},
27375
		"");
27376
}
27377
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=107788
27378
public void test0871() {
27379
	this.runConformTest(
27380
		new String[] {
27381
			"Lister.java",
27382
			"interface Lister<BeanT, PropT, PackT> {\n" + 
27383
			"	void endPacking(PackT p, BeanT b, Accessor<BeanT, PropT> acc);\n" + 
27384
			"\n" + 
27385
			"	static class IDRefs<BeanT, PropT> implements\n" + 
27386
			"			Lister<BeanT, PropT, IDRefs<BeanT, PropT>.Pack> {\n" + 
27387
			"		public void endPacking(Pack p, BeanT b, Accessor<BeanT, PropT> acc) {\n" + 
27388
			"		}\n" + 
27389
			"\n" + 
27390
			"		private class Pack {\n" + 
27391
			"		}\n" + 
27392
			"	}\n" + 
27393
			"}\n" + 
27394
			"\n" + 
27395
			"class Accessor<BeanT, PropT> {\n" + 
27396
			"}\n",
27397
		},
27398
		"");
27399
}
27400
public void test0872() {
27401
	this.runNegativeTest(
27402
		new String[] {
27403
			"X.java", // =================
27404
			"import java.io.PrintStream;\n" + 
27405
			"\n" + 
27406
			"public class X {\n" + 
27407
			"	public void foo1(){\n" + 
27408
			"		M1<X> m = new M1<X>();\n" + 
27409
			"		M1<X>.N1<X> n = m.new N1<X>();\n" + 
27410
			"	}\n" + 
27411
			"	static class M1<T> {\n" + 
27412
			"		class N1<U> {\n" + 
27413
			"		}\n" + 
27414
			"	}\n" + 
27415
			"	public void foo2(){\n" + 
27416
			"		M2<X> m = new M2<X>();\n" + 
27417
			"		M2<X>.N2<X> n = m.new N2<X>();\n" + 
27418
			"	}\n" + 
27419
			"	class M2<T> {\n" + 
27420
			"		class N2<U> {\n" + 
27421
			"		}\n" + 
27422
			"	}\n" + 
27423
			"	public void foo3(){\n" + 
27424
			"		M3<X> m = new M3<X>();\n" + 
27425
			"		M3<X>.N3<X> n = m.new N3<X>();\n" + 
27426
			"	}\n" + 
27427
			"	class M3<T> {\n" + 
27428
			"		static class N3<U> {\n" + 
27429
			"		}\n" + 
27430
			"	}\n" + 
27431
			"	public void foo4(){\n" + 
27432
			"		M4<X> m = new M4<X>();\n" + 
27433
			"		M4<X>.N4<X> n = m.new N4<X>();\n" + 
27434
			"	}\n" + 
27435
			"	static class M4<T> {\n" + 
27436
			"		static class N4<U> {\n" + 
27437
			"		}\n" + 
27438
			"	}\n" + 
27439
			"}\n",
27440
		},
27441
		"----------\n" + 
27442
		"1. ERROR in X.java (at line 22)\n" + 
27443
		"	M3<X>.N3<X> n = m.new N3<X>();\n" + 
27444
		"	^^^^^^^^\n" + 
27445
		"The member type X.M3<X>.N3 cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X.M3<X>\n" + 
27446
		"----------\n" + 
27447
		"2. ERROR in X.java (at line 25)\n" + 
27448
		"	static class N3<U> {\n" + 
27449
		"	             ^^\n" + 
27450
		"The member type N3 cannot be declared static; static types can only be declared in static or top level types\n" + 
27451
		"----------\n" + 
27452
		"3. ERROR in X.java (at line 30)\n" + 
27453
		"	M4<X>.N4<X> n = m.new N4<X>();\n" + 
27454
		"	^^^^^^^^\n" + 
27455
		"The member type X.M4<X>.N4 cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X.M4<X>\n" + 
27456
		"----------\n");
27457
}
27458
public void test0873() {
27459
	this.runConformTest(
27460
		new String[] {
27461
			"X.java", // =================
27462
			"public class X<T> {\n" + 
27463
			"    static class XMap {\n" + 
27464
			"        XEntry[] table;\n" + 
27465
			"        static class XEntry {}    \n" + 
27466
			"        void foo() {\n" + 
27467
			"            XEntry e = table[0];\n" + 
27468
			"        }	\n" + 
27469
			"    }        \n" + 
27470
			"}\n",
27471
		},
27472
		"");
27473
}
27474
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115693
27475
public void test0874() {
27476
	this.runConformTest(
27477
		new String[] {
27478
			"X.java", // =================
27479
			"class A {}\n" + 
27480
			"abstract class B<T> {\n" + 
27481
			"    public B<T> label(String s) { return this; }\n" + 
27482
			"}\n" + 
27483
			"final class C extends B<A> {\n" + 
27484
			"    public static C instance(String s) { return new C(); }\n" + 
27485
			"    @Override public String toString() {\n" + 
27486
			"    	return \"SUCCESS\";\n" + 
27487
			"    }\n" + 
27488
			"}\n" + 
27489
			"public class X {\n" + 
27490
			"    public static void main(String[] args) {\n" + 
27491
			"        C c = (C)C.instance(\"X\").label(\"Y\");\n" + 
27492
			"        System.out.println(c.toString());\n" + 
27493
			"    }\n" + 
27494
			"}\n",
27495
		},
27496
		"SUCCESS");
27497
	// 	ensure only one checkcast C
27498
	String expectedOutput =
27499
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
27500
		"  // Stack: 2, Locals: 2\n" + 
27501
		"  public static void main(java.lang.String[] args);\n" + 
27502
		"     0  ldc <String \"X\"> [16]\n" + 
27503
		"     2  invokestatic C.instance(java.lang.String) : C [17]\n" + 
27504
		"     5  ldc <String \"Y\"> [23]\n" + 
27505
		"     7  invokevirtual C.label(java.lang.String) : B [25]\n" + 
27506
		"    10  checkcast C [18]\n" + 
27507
		"    13  astore_1 [c]\n" + 
27508
		"    14  getstatic java.lang.System.out : java.io.PrintStream [29]\n" + 
27509
		"    17  aload_1 [c]\n" + 
27510
		"    18  invokevirtual C.toString() : java.lang.String [35]\n" + 
27511
		"    21  invokevirtual java.io.PrintStream.println(java.lang.String) : void [39]\n" + 
27512
		"    24  return\n" + 
27513
		"      Line numbers:\n" + 
27514
		"        [pc: 0, line: 13]\n" + 
27515
		"        [pc: 14, line: 14]\n" + 
27516
		"        [pc: 24, line: 15]\n" + 
27517
		"      Local variable table:\n" + 
27518
		"        [pc: 0, pc: 25] local: args index: 0 type: java.lang.String[]\n" + 
27519
		"        [pc: 14, pc: 25] local: c index: 1 type: C\n";
27520
	
27521
	try {
27522
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
27523
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
27524
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
27525
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
27526
		int index = result.indexOf(expectedOutput);
27527
		if (index == -1 || expectedOutput.length() == 0) {
27528
			System.out.println(Util.displayString(result, 3));
27529
		}
27530
		if (index == -1) {
27531
			assertEquals("Wrong contents", expectedOutput, result);
27532
		}
27533
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
27534
		assertTrue(false);
27535
	} catch (IOException e) {
27536
		assertTrue(false);
27537
	}		
27538
}
27539
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119395
27540
public void test0875() {
27541
	this.runNegativeTest(
27542
		new String[] {
27543
			"X.java", // =================
27544
			"import java.util.*;\n" + 
27545
			"public class X {\n" + 
27546
			"\n" + 
27547
			"	public static class DatabaseObject {}\n" + 
27548
			"	public static class ObjectFormUI<T extends DatabaseObject> {}\n" + 
27549
			"	private static final Map<Class<? extends DatabaseObject>, Class<? extends ObjectFormUI>> uiMap = new HashMap<Class<? extends DatabaseObject>, Class<? extends ObjectFormUI>>();\n" + 
27550
			"\n" + 
27551
			"	public static <T extends DatabaseObject> Class<? extends ObjectFormUI<T>> getUI(\n" + 
27552
			"			Class<T> persistentClass) {\n" + 
27553
			"		return null != null \n" + 
27554
			"			? uiMap.get(persistentClass)\n" + 
27555
			"			: (Class<? extends ObjectFormUI<T>>) uiMap.get(persistentClass);\n" + 
27556
			"	}\n" + 
27557
			"}\n",
27558
		},
27559
		"----------\n" + 
27560
		"1. WARNING in X.java (at line 6)\n" + 
27561
		"	private static final Map<Class<? extends DatabaseObject>, Class<? extends ObjectFormUI>> uiMap = new HashMap<Class<? extends DatabaseObject>, Class<? extends ObjectFormUI>>();\n" + 
27562
		"	                                                                          ^^^^^^^^^^^^\n" + 
27563
		"X.ObjectFormUI is a raw type. References to generic type X.ObjectFormUI<T> should be parameterized\n" + 
27564
		"----------\n" + 
27565
		"2. WARNING in X.java (at line 6)\n" + 
27566
		"	private static final Map<Class<? extends DatabaseObject>, Class<? extends ObjectFormUI>> uiMap = new HashMap<Class<? extends DatabaseObject>, Class<? extends ObjectFormUI>>();\n" + 
27567
		"	                                                                                                                                                              ^^^^^^^^^^^^\n" + 
27568
		"X.ObjectFormUI is a raw type. References to generic type X.ObjectFormUI<T> should be parameterized\n" + 
27569
		"----------\n" + 
27570
		"3. ERROR in X.java (at line 10)\n" + 
27571
		"	return null != null \n" + 
27572
		"			? uiMap.get(persistentClass)\n" + 
27573
		"			: (Class<? extends ObjectFormUI<T>>) uiMap.get(persistentClass);\n" + 
27574
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
27575
		"Type mismatch: cannot convert from Class<capture#4-of ? extends X.ObjectFormUI> to Class<? extends X.ObjectFormUI<T>>\n" + 
27576
		"----------\n" + 
27577
		"4. WARNING in X.java (at line 12)\n" + 
27578
		"	: (Class<? extends ObjectFormUI<T>>) uiMap.get(persistentClass);\n" + 
27579
		"	  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
27580
		"Type safety: Unchecked cast from Class<capture#2-of ? extends X.ObjectFormUI> to Class<? extends X.ObjectFormUI<T>>\n" + 
27581
		"----------\n");
27582
}
27583
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119395 - variation
27584
public void test0876() {
27585
	this.runNegativeTest(
27586
		new String[] {
27587
			"X.java", // =================
27588
			"import java.util.*;\n" + 
27589
			"public class X {\n" + 
27590
			"	void foo(){\n" + 
27591
			"		Class<Class<Object>> cco = null;\n" + 
27592
			"		Class<Class> cc = cco; // ko\n" + 
27593
			"		Class<Class<Object>> cco2 = cc; // ko\n" + 
27594
			"		\n" + 
27595
			"		Class<? extends Class<Object>> ceco = null;\n" + 
27596
			"		Class<? extends Class> cec = ceco; // ok\n" + 
27597
			"		Class<? extends Class<Object>> ceco2 = cec; // ko\n" + 
27598
			"	}\n" + 
27599
			"}\n",
27600
		},
27601
		"----------\n" + 
27602
		"1. WARNING in X.java (at line 5)\n" + 
27603
		"	Class<Class> cc = cco; // ko\n" + 
27604
		"	      ^^^^^\n" + 
27605
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
27606
		"----------\n" + 
27607
		"2. ERROR in X.java (at line 5)\n" + 
27608
		"	Class<Class> cc = cco; // ko\n" + 
27609
		"	                  ^^^\n" + 
27610
		"Type mismatch: cannot convert from Class<Class<Object>> to Class<Class>\n" + 
27611
		"----------\n" + 
27612
		"3. ERROR in X.java (at line 6)\n" + 
27613
		"	Class<Class<Object>> cco2 = cc; // ko\n" + 
27614
		"	                            ^^\n" + 
27615
		"Type mismatch: cannot convert from Class<Class> to Class<Class<Object>>\n" + 
27616
		"----------\n" + 
27617
		"4. WARNING in X.java (at line 9)\n" + 
27618
		"	Class<? extends Class> cec = ceco; // ok\n" + 
27619
		"	                ^^^^^\n" + 
27620
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
27621
		"----------\n" + 
27622
		"5. ERROR in X.java (at line 10)\n" + 
27623
		"	Class<? extends Class<Object>> ceco2 = cec; // ko\n" + 
27624
		"	                                       ^^^\n" + 
27625
		"Type mismatch: cannot convert from Class<capture#2-of ? extends Class> to Class<? extends Class<Object>>\n" + 
27626
		"----------\n");
27627
}
27628
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119395 - variation
27629
public void test0877() {
27630
	this.runNegativeTest(
27631
		new String[] {
27632
			"X.java", // =================
27633
			"import java.util.*;\n" + 
27634
			"public class X {\n" + 
27635
			"	<T extends Class> void bar(T t) {\n" + 
27636
			"		Class<Object> c = t; // ok - unchecked\n" + 
27637
			"	}\n" + 
27638
			"	<T extends Class> void bar2(List<? extends T> let) {\n" + 
27639
			"		Class<Object> c = let.get(0); // ok - unchecked\n" + 
27640
			"	}\n" + 
27641
			"	void bar3(List<? extends Class> lec) {\n" + 
27642
			"		Class<Object> c = lec.get(0); // ok - unchecked\n" + 
27643
			"	}\n" + 
27644
			"	Zork z;\n" + 
27645
			"}\n",
27646
		},
27647
		"----------\n" + 
27648
		"1. WARNING in X.java (at line 3)\n" + 
27649
		"	<T extends Class> void bar(T t) {\n" + 
27650
		"	           ^^^^^\n" + 
27651
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
27652
		"----------\n" + 
27653
		"2. WARNING in X.java (at line 3)\n" + 
27654
		"	<T extends Class> void bar(T t) {\n" + 
27655
		"	           ^^^^^\n" + 
27656
		"The type parameter T should not be bounded by the final type Class. Final types cannot be further extended\n" + 
27657
		"----------\n" + 
27658
		"3. WARNING in X.java (at line 4)\n" + 
27659
		"	Class<Object> c = t; // ok - unchecked\n" + 
27660
		"	                  ^\n" + 
27661
		"Type safety: The expression of type T needs unchecked conversion to conform to Class<Object>\n" + 
27662
		"----------\n" + 
27663
		"4. WARNING in X.java (at line 6)\n" + 
27664
		"	<T extends Class> void bar2(List<? extends T> let) {\n" + 
27665
		"	           ^^^^^\n" + 
27666
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
27667
		"----------\n" + 
27668
		"5. WARNING in X.java (at line 6)\n" + 
27669
		"	<T extends Class> void bar2(List<? extends T> let) {\n" + 
27670
		"	           ^^^^^\n" + 
27671
		"The type parameter T should not be bounded by the final type Class. Final types cannot be further extended\n" + 
27672
		"----------\n" + 
27673
		"6. WARNING in X.java (at line 7)\n" + 
27674
		"	Class<Object> c = let.get(0); // ok - unchecked\n" + 
27675
		"	                  ^^^^^^^^^^\n" + 
27676
		"Type safety: The expression of type capture#1-of ? extends T needs unchecked conversion to conform to Class<Object>\n" + 
27677
		"----------\n" + 
27678
		"7. WARNING in X.java (at line 9)\n" + 
27679
		"	void bar3(List<? extends Class> lec) {\n" + 
27680
		"	                         ^^^^^\n" + 
27681
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
27682
		"----------\n" + 
27683
		"8. WARNING in X.java (at line 10)\n" + 
27684
		"	Class<Object> c = lec.get(0); // ok - unchecked\n" + 
27685
		"	                  ^^^^^^^^^^\n" + 
27686
		"Type safety: The expression of type capture#2-of ? extends Class needs unchecked conversion to conform to Class<Object>\n" + 
27687
		"----------\n" + 
27688
		"9. ERROR in X.java (at line 12)\n" + 
27689
		"	Zork z;\n" + 
27690
		"	^^^^\n" + 
27691
		"Zork cannot be resolved to a type\n" + 
27692
		"----------\n");
27693
}
27694
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115693 - variation
27695
public void test0878() {
27696
	this.runConformTest(
27697
		new String[] {
27698
			"X.java", // =================
27699
			"class A {}\n" + 
27700
			"class D extends A {}\n" + 
27701
			"abstract class B<T> {\n" + 
27702
			"    public T label(String s) { return null; }\n" + 
27703
			"}\n" + 
27704
			"final class C extends B<A> {\n" + 
27705
			"    public static C instance(String s) { return new C(); }\n" + 
27706
			"    @Override public String toString() {\n" + 
27707
			"    	return \"SUCCESS\"; \n" + 
27708
			"    }\n" + 
27709
			"}\n" + 
27710
			"public class X {\n" + 
27711
			"    public static void main(String[] args) {\n" + 
27712
			"        D d = (D)C.instance(\"X\").label(\"Y\");\n" + 
27713
			"        System.out.println(d);\n" + 
27714
			"    }\n" + 
27715
			"}\n",
27716
		},
27717
		"null");
27718
	// 	ensure only one checkcast D
27719
	String expectedOutput =
27720
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
27721
		"  // Stack: 2, Locals: 2\n" + 
27722
		"  public static void main(java.lang.String[] args);\n" + 
27723
		"     0  ldc <String \"X\"> [16]\n" + 
27724
		"     2  invokestatic C.instance(java.lang.String) : C [17]\n" + 
27725
		"     5  ldc <String \"Y\"> [23]\n" + 
27726
		"     7  invokevirtual C.label(java.lang.String) : java.lang.Object [25]\n" + 
27727
		"    10  checkcast D [29]\n" + 
27728
		"    13  astore_1 [d]\n" + 
27729
		"    14  getstatic java.lang.System.out : java.io.PrintStream [31]\n" + 
27730
		"    17  aload_1 [d]\n" + 
27731
		"    18  invokevirtual java.io.PrintStream.println(java.lang.Object) : void [37]\n" + 
27732
		"    21  return\n" + 
27733
		"      Line numbers:\n" + 
27734
		"        [pc: 0, line: 14]\n" + 
27735
		"        [pc: 14, line: 15]\n" + 
27736
		"        [pc: 21, line: 16]\n" + 
27737
		"      Local variable table:\n" + 
27738
		"        [pc: 0, pc: 22] local: args index: 0 type: java.lang.String[]\n" + 
27739
		"        [pc: 14, pc: 22] local: d index: 1 type: D\n";
27740
	
27741
	try {
27742
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
27743
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
27744
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
27745
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
27746
		int index = result.indexOf(expectedOutput);
27747
		if (index == -1 || expectedOutput.length() == 0) {
27748
			System.out.println(Util.displayString(result, 3));
27749
		}
27750
		if (index == -1) {
27751
			assertEquals("Wrong contents", expectedOutput, result);
27752
		}
27753
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
27754
		assertTrue(false);
27755
	} catch (IOException e) {
27756
		assertTrue(false);
27757
	}		
27758
}
27759
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122610
27760
public void test0879() {
27761
	this.runConformTest(
27762
		new String[] {
27763
			"X.java", // =================
27764
			"public class X<V, R> {\n" + 
27765
			"\n" + 
27766
			"    private class InnerClass1 {\n" + 
27767
			"            void foo() {\n" + 
27768
			"                    X<V, R> c = X.this;\n" + 
27769
			"            }\n" + 
27770
			"    }\n" + 
27771
			"}\n",
27772
		},
27773
		"");
27774
}
27775
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369
27776
public void test0880() {
27777
	this.runNegativeTest(
27778
		new String[] {
27779
			"X.java", // =================
27780
			"class Foo {\n" + 
27781
			"	static <T, U extends java.util.List<T>> U foo() {\n" + 
27782
			"		return null;\n" + 
27783
			"	}\n" + 
27784
			"}\n" + 
27785
			"\n" + 
27786
			"public class X {\n" + 
27787
			"	{\n" + 
27788
			"		String s = (String) Foo.foo();\n" + 
27789
			"	}\n" + 
27790
			"}\n",
27791
		},
27792
		"----------\n" + 
27793
		"1. ERROR in X.java (at line 9)\n" + 
27794
		"	String s = (String) Foo.foo();\n" + 
27795
		"	           ^^^^^^^^^^^^^^^^^^\n" + 
27796
		"Cannot cast from List<Object> to String\n" + 
27797
		"----------\n");
27798
}
27799
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369 - variation
27800
public void _test0881() {
27801
	this.runNegativeTest(
27802
		new String[] {
27803
			"X.java", // =================
27804
			"class Foo {\n" + 
27805
			"	static <T, U extends java.util.List<U>> U foo() {\n" + 
27806
			"		return null;\n" + 
27807
			"	}\n" + 
27808
			"}\n" + 
27809
			"\n" + 
27810
			"public class X {\n" + 
27811
			"	{\n" + 
27812
			"		String s = (String) Foo.foo();\n" + 
27813
			"	}\n" + 
27814
			"}\n",
27815
		},
27816
		"----------\n" + 
27817
		"1. ERROR in X.java (at line 9)\n" + 
27818
		"	String s = (String) Foo.foo();\n" + 
27819
		"	           ^^^^^^^^^^^^^^^^^^\n" + 
27820
		"Cannot cast from List<Object> to String\n" + 
27821
		"----------\n");
27822
}
27823
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369 - variation
27824
public void test0882() {
27825
	this.runNegativeTest(
27826
		new String[] {
27827
			"X.java", // =================
27828
			"import java.util.List;\n" + 
27829
			"\n" + 
27830
			"public class X {\n" + 
27831
			"	static <U extends List<U>> U foo(U u) {\n" + 
27832
			"		String s = (String) foo(u);\n" + 
27833
			"		return u;\n" + 
27834
			"	}\n" + 
27835
			"}\n",
27836
		},
27837
		"----------\n" + 
27838
		"1. ERROR in X.java (at line 5)\n" + 
27839
		"	String s = (String) foo(u);\n" + 
27840
		"	           ^^^^^^^^^^^^^^^\n" + 
27841
		"Cannot cast from U to String\n" + 
27842
		"----------\n");
27843
}
27844
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=121369 - variation
27845
public void test0883() {
27846
	this.runNegativeTest(
27847
		new String[] {
27848
			"X.java", // =================
27849
			"import java.util.List;\n" + 
27850
			"\n" + 
27851
			"public class X {\n" + 
27852
			"	static <U extends List<U>> U foo(U u) {\n" + 
27853
			"		List<U> v = null;\n" + 
27854
			"		String s = (String) foo(v);\n" + 
27855
			"		return u;\n" + 
27856
			"	}\n" + 
27857
			"}\n",
27858
		},
27859
		"----------\n" + 
27860
		"1. ERROR in X.java (at line 6)\n" + 
27861
		"	String s = (String) foo(v);\n" + 
27862
		"	           ^^^^^^^^^^^^^^^\n" + 
27863
		"Cannot cast from List<U> to String\n" + // shouldn't it infer: List<List<U>> ?
27864
		"----------\n");
27865
}
27866
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123078
27867
public void test0884() {
27868
	this.runNegativeTest(
27869
		new String[] {
27870
			"X.java", // =================
27871
			"public abstract class X<C extends X<C>> {\n" + 
27872
			"	public static <T extends X<T>> T getDefault(Class<T> clz) {\n" + 
27873
			"		return null;\n" + 
27874
			"	}\n" + 
27875
			"\n" + 
27876
			"	public Object getDefault() {\n" + 
27877
			"		String s = getClass();\n" + 
27878
			"		return (String) getDefault(getClass());\n" + 
27879
			"	}\n" + 
27880
			"}\n" ,
27881
		},
27882
		"----------\n" + 
27883
		"1. ERROR in X.java (at line 7)\n" + 
27884
		"	String s = getClass();\n" + 
27885
		"	           ^^^^^^^^^^\n" + 
27886
		"Type mismatch: cannot convert from Class<capture#1-of ? extends X> to String\n" + 
27887
		"----------\n" + 
27888
		"2. ERROR in X.java (at line 8)\n" + 
27889
		"	return (String) getDefault(getClass());\n" + 
27890
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
27891
		"Cannot cast from capture#2-of ? extends X to String\n" + 
27892
		"----------\n" + 
27893
		"3. WARNING in X.java (at line 8)\n" + 
27894
		"	return (String) getDefault(getClass());\n" + 
27895
		"	                ^^^^^^^^^^^^^^^^^^^^^^\n" + 
27896
		"Type safety: Unchecked invocation getDefault(Class<capture#2-of ? extends X>) of the generic method getDefault(Class<T>) of type X<C>\n" + 
27897
		"----------\n");
27898
}
27899
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=125445 
27900
public void test0885() {
27901
	this.runNegativeTest(
27902
		new String[] {
27903
			"X.java", // =================
27904
			"public class X {\n" + 
27905
			"	public static <C extends Number, A extends C & Comparable<C>> int m(\n" + 
27906
			"			A comparableNumberObj) {\n" + 
27907
			"		return comparableNumberObj.compareTo(comparableNumberObj);\n" + 
27908
			"	}\n" + 
27909
			"}\n" ,
27910
		},
27911
		"----------\n" + 
27912
		"1. ERROR in X.java (at line 2)\n" + 
27913
		"	public static <C extends Number, A extends C & Comparable<C>> int m(\n" + 
27914
		"	                                               ^^^^^^^^^^\n" + 
27915
		"Cannot specify any additional bound Comparable<C> when first bound is a type parameter\n" + 
27916
		"----------\n");
27917
}
27918
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=124943
27919
public void test0886() {
27920
	Map customOptions= getCompilerOptions();
27921
	customOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
27922
	this.runConformTest(
27923
		new String[] {
27924
			"X.java", // =================
27925
			"public class X {\n" + 
27926
			"	void test() {\n" + 
27927
			"		\"Hello\".compareTo((Object) \"Hello\");\n" + 
27928
			"	}\n" + 
27929
			"}\n" ,
27930
		},
27931
		"",
27932
		null,
27933
		true,
27934
		null,
27935
		customOptions,
27936
		null/*no custom requestor*/);
27937
}
27938
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122775
27939
public void test0887() {
27940
	this.runNegativeTest(
27941
		new String[] {
27942
			"Bar.java", // =================
27943
			"class Foo<T> {}\n" + 
27944
			"public class Bar<X extends Foo<Foo<? super X>>>{\n" + 
27945
			"    Bar(X x){\n" + 
27946
			"        Foo<? super X> f = x;\n" + 
27947
			"    }\n" + 
27948
			"}\n",
27949
		},
27950
		"----------\n" + 
27951
		"1. ERROR in Bar.java (at line 4)\n" + 
27952
		"	Foo<? super X> f = x;\n" + 
27953
		"	                   ^\n" + 
27954
		"Type mismatch: cannot convert from X to Foo<? super X>\n" + 
27955
		"----------\n");
27956
}
27957
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122775 - variation
27958
public void test0888() {
27959
	this.runNegativeTest(
27960
		new String[] {
27961
			"Bar.java", // =================
27962
			"class Foo<T> {}\n" + 
27963
			"public class Bar<X extends Foo<Foo<? super X>>>{\n" + 
27964
			"    Bar(X x){\n" + 
27965
			"        Foo<? extends X> f = x;\n" + 
27966
			"    }\n" + 
27967
			"}\n",
27968
		},
27969
		"----------\n" + 
27970
		"1. ERROR in Bar.java (at line 4)\n" + 
27971
		"	Foo<? extends X> f = x;\n" + 
27972
		"	                     ^\n" + 
27973
		"Type mismatch: cannot convert from X to Foo<? extends X>\n" + 
27974
		"----------\n");
27975
}
27976
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122775 - variation
27977
public void test0889() {
27978
	this.runConformTest(
27979
		new String[] {
27980
			"Test.java", // =================
27981
			"import java.util.*;\n" + 
27982
			"\n" + 
27983
			"class Group<E extends Comparable<? super E>> extends ArrayList<E> implements\n" + 
27984
			"		Comparable<Group<? extends E>> {\n" + 
27985
			"	public int compareTo(Group<? extends E> o) {\n" + 
27986
			"		return 0;\n" + 
27987
			"	}\n" + 
27988
			"}\n" + 
27989
			"\n" + 
27990
			"class Sequence<E extends Comparable<? super E>> extends TreeSet<E> implements\n" + 
27991
			"		Comparable<Sequence<? extends E>> {\n" + 
27992
			"	public int compareTo(Sequence<? extends E> o) {\n" + 
27993
			"		return 0;\n" + 
27994
			"	}\n" + 
27995
			"}\n" + 
27996
			"\n" + 
27997
			"class Test<T extends Comparable<? super T>> {\n" + 
27998
			"	<C extends Collection<T>> void foo(SortedSet<? extends C> setToCheck,\n" + 
27999
			"			SortedSet<? extends C> validSet) {\n" + 
28000
			"	}\n" + 
28001
			"\n" + 
28002
			"	public void containsCombination(SortedSet<Group<T>> groups,\n" + 
28003
			"			SortedSet<Sequence<T>> sequences) {\n" + 
28004
			"		foo(groups, sequences);\n" + 
28005
			"	}\n" + 
28006
			"}\n",
28007
		},
28008
		"");
28009
}
28010
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122775 - variation
28011
public void test0890() {
28012
	this.runConformTest(
28013
		new String[] {
28014
			"Simple.java", // =================
28015
			"class A<T extends A<T>> {}\n" + 
28016
			"class B extends A<B> {}\n" + 
28017
			"class C extends B {}\n" + 
28018
			"class D<T> {}\n" + 
28019
			"\n" + 
28020
			"public class Simple {\n" + 
28021
			"	<T extends A<T>, S extends T> D<T> m(S s) {\n" + 
28022
			"		C c = null;\n" + 
28023
			"		D<B> d = m(c);\n" + 
28024
			"		return null;\n" + 
28025
			"	}\n" + 
28026
			"}\n",
28027
		},
28028
		"");
28029
}
28030
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122775 - variation
28031
public void test0891() {
28032
	this.runNegativeTest(
28033
		new String[] {
28034
			"Test.java", // =================
28035
			"interface Function<A, B> {\n" + 
28036
			"	B apply(A x);\n" + 
28037
			"}\n" + 
28038
			"class Id<A> implements Function<A, A> {\n" + 
28039
			"	public A apply(A x) {\n" + 
28040
			"		return x;\n" + 
28041
			"	}\n" + 
28042
			"}\n" + 
28043
			"class Test {\n" + 
28044
			"	<A> Id<A> identity() {\n" + 
28045
			"		return new Id<A>();\n" + 
28046
			"	}\n" + 
28047
			"\n" + 
28048
			"	<B> B applyToString(Function<String, B> f) {\n" + 
28049
			"		return f.apply(\"abc\");\n" + 
28050
			"	}\n" + 
28051
			"	void test() {\n" + 
28052
			"		String s = applyToString(identity());\n" + 
28053
			"	}\n" + 
28054
			"}\n",
28055
		},
28056
		"----------\n" + 
28057
		"1. ERROR in Test.java (at line 18)\n" + 
28058
		"	String s = applyToString(identity());\n" + 
28059
		"	           ^^^^^^^^^^^^^\n" + 
28060
		"The method applyToString(Function<String,B>) in the type Test is not applicable for the arguments (Id<Object>)\n" + 
28061
		"----------\n");
28062
}
28063
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126180
28064
public void test0892() {
28065
	this.runNegativeTest(
28066
		new String[] {
28067
			"X.java", // =================
28068
			"public class X {\n" + 
28069
			"	public static void main(String[] args) {\n" + 
28070
			"		C2 c2 = null;\n" + 
28071
			"		C3 c3 = null;\n" + 
28072
			"		Object oc1 = m1(c2, c3).new C1Member();\n" + 
28073
			"	}\n" + 
28074
			"\n" + 
28075
			"	public static <T> T m1(T t1, T t2) {\n" + 
28076
			"		return null;\n" + 
28077
			"	}\n" + 
28078
			"\n" + 
28079
			"	class C1 {}\n" + 
28080
			"	interface I1 {}\n" + 
28081
			"	class C2 extends C1 implements I1 {}\n" + 
28082
			"	class C3 extends C1 implements I1 {\n" + 
28083
			"	}\n" + 
28084
			"}\n",
28085
		},
28086
		"----------\n" + 
28087
		"1. ERROR in X.java (at line 5)\n" + 
28088
		"	Object oc1 = m1(c2, c3).new C1Member();\n" + 
28089
		"	                            ^^^^^^^^\n" + 
28090
		"X.C1&X.I1.C1Member cannot be resolved to a type\n" + 
28091
		"----------\n");
28092
}
28093
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126177
28094
public void test0893() {
28095
	this.runNegativeTest(
28096
		new String[] {
28097
			"X.java", // =================
28098
			"public class X {\n" + 
28099
			"	static String foo;\n" + 
28100
			"\n" + 
28101
			"	public static void main(String[] args) {\n" + 
28102
			"		C2 c2 = null;\n" + 
28103
			"		C3 c3 = null;\n" + 
28104
			"		// method access\n" + 
28105
			"		m1(c2, c3).c1m1();\n" + 
28106
			"		m1(c2, c3).i1m1();\n" + 
28107
			"		m1(c2, c3).i2m1();\n" + 
28108
			"\n" + 
28109
			"		// field access\n" + 
28110
			"		int ic1 = m1(c2, c3).c1f1;\n" + 
28111
			"		int ii1 = m1(c2, c3).i1f1;\n" + 
28112
			"		int ii2 = m1(c2, c3).i2f1;\n" + 
28113
			"	\n" + 
28114
			"		// member type access\n" + 
28115
			"		Object oc1 = m1(c2, c3).new C1Member();\n" + 
28116
			"		Object oi1 = m1(c2, c3).new I1Member(); \n" + 
28117
			"		Object oi2 = m1(c2, c3).new I2Member();\n" + 
28118
			"	}\n" + 
28119
			"\n" + 
28120
			"	public static <T> T m1(T t1, T t2) {\n" + 
28121
			"		return null;\n" + 
28122
			"	}\n" + 
28123
			"\n" + 
28124
			"	class C1 {\n" + 
28125
			"		void c1m1() {}\n" + 
28126
			"		int c1f1 = 0;\n" + 
28127
			"		class C1Member {}\n" + 
28128
			"	}\n" + 
28129
			"\n" + 
28130
			"	interface I1 {\n" + 
28131
			"		void i1m1();\n" + 
28132
			"		int i1f1 = 1;\n" + 
28133
			"		class I1Member {}\n" + 
28134
			"	}\n" + 
28135
			"\n" + 
28136
			"	interface I2 {\n" + 
28137
			"		void i2m1();\n" + 
28138
			"		int i2f1 = 2;\n" + 
28139
			"		class I2Member {}\n" + 
28140
			"	}\n" + 
28141
			"\n" + 
28142
			"	class C2 extends C1 implements I1, I2 {\n" + 
28143
			"		public void i1m1() {\n" + 
28144
			"		}\n" + 
28145
			"		public void i2m1() {\n" + 
28146
			"		}\n" + 
28147
			"	}\n" + 
28148
			"\n" + 
28149
			"	class C3 extends C1 implements I1, I2 {\n" + 
28150
			"		public void i1m1() {\n" + 
28151
			"		}\n" + 
28152
			"		public void i2m1() {\n" + 
28153
			"		}\n" + 
28154
			"	}\n" + 
28155
			"}\n",
28156
		},
28157
		"----------\n" + 
28158
		"1. WARNING in X.java (at line 14)\n" + 
28159
		"	int ii1 = m1(c2, c3).i1f1;\n" + 
28160
		"	                     ^^^^\n" + 
28161
		"The static field X.I1.i1f1 should be accessed in a static way\n" + 
28162
		"----------\n" + 
28163
		"2. WARNING in X.java (at line 15)\n" + 
28164
		"	int ii2 = m1(c2, c3).i2f1;\n" + 
28165
		"	                     ^^^^\n" + 
28166
		"The static field X.I2.i2f1 should be accessed in a static way\n" + 
28167
		"----------\n" + 
28168
		"3. ERROR in X.java (at line 19)\n" + 
28169
		"	Object oi1 = m1(c2, c3).new I1Member(); \n" + 
28170
		"	             ^^^^^^^^^^\n" + 
28171
		"Illegal enclosing instance specification for type X.I1.I1Member\n" + 
28172
		"----------\n" + 
28173
		"4. ERROR in X.java (at line 20)\n" + 
28174
		"	Object oi2 = m1(c2, c3).new I2Member();\n" + 
28175
		"	             ^^^^^^^^^^\n" + 
28176
		"Illegal enclosing instance specification for type X.I2.I2Member\n" + 
28177
		"----------\n");
28178
}
28179
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126177 - variation
28180
public void test0894() {
28181
	this.runConformTest(
28182
		new String[] {
28183
			"X.java", // =================
28184
			"public class X {\n" + 
28185
			"        static class C1 {\n" + 
28186
			"                void c1m1() {\n" + 
28187
			"                        System.out.print(\"[c1m1]\");\n" + 
28188
			"                }\n" + 
28189
			"        }\n" + 
28190
			"        static interface I {}\n" + 
28191
			"        static class C2 extends C1 implements I {}\n" + 
28192
			"        static class C3 extends C1 implements I {}\n" + 
28193
			"\n" + 
28194
			"        public <T> T m1(T t1, T t2) {\n" + 
28195
			"                return t1;\n" + 
28196
			"        }\n" + 
28197
			"\n" + 
28198
			"        public <T extends C1 & I> void test(C2 c2, C3 c3, T t) {\n" + 
28199
			"                m1(c2, c3).c1m1(); // 1\n" + 
28200
			"                t.c1m1(); // 2\n" + 
28201
			"                (t != null ? c2 : c3).c1m1(); // 3\n" + 
28202
			"        }\n" + 
28203
			"\n" + 
28204
			"        public static void main(String... args) {\n" + 
28205
			"                X x = new X();\n" + 
28206
			"                x.test(new C2(), new C3(), new C2()); // 4\n" + 
28207
			"                System.out.println();\n" + 
28208
			"        }\n" + 
28209
			"}\n",
28210
		},
28211
		"[c1m1][c1m1][c1m1]");
28212
}
28213
public void test0895() {
28214
	this.runNegativeTest(
28215
		new String[] {
28216
			"X.java", // =================
28217
			"interface I {}\n" + 
28218
			"public class X {\n" + 
28219
			"    Object o = new <Object> I() {};\n" + 
28220
			"}\n" ,
28221
		},
28222
		"----------\n" + 
28223
		"1. ERROR in X.java (at line 3)\n" + 
28224
		"	Object o = new <Object> I() {};\n" + 
28225
		"	           ^^^^^^^^^^^^^^^^^^^\n" + 
28226
		"The constructor Object() of type Object is not generic; it cannot be parameterized with arguments <Object>\n" + 
28227
		"----------\n");
28228
}
28229
public void test0896() {
28230
	this.runConformTest(
28231
		new String[] {
28232
			"X.java", // =================
28233
			"public class X {\n" + 
28234
			"	interface I {		void f(); 	}\n" + 
28235
			"	interface J {		void g(); }\n" + 
28236
			"\n" + 
28237
			"	static class A implements I, J {\n" + 
28238
			"		public void f() {	System.out.print(\"[A#f()]\");}\n" + 
28239
			"		public void g() {	System.out.print(\"[A#g()]\");}\n" + 
28240
			"	}\n" + 
28241
			"\n" + 
28242
			"	static class B implements J, I {\n" + 
28243
			"		public void f() {	System.out.print(\"[B#f()]\");}\n" + 
28244
			"		public void g() {	System.out.print(\"[B#g()]\");}\n" + 
28245
			"	}\n" + 
28246
			"\n" + 
28247
			"	public static void main(String[] args) {\n" + 
28248
			"		f(true, new A(), new B());\n" + 
28249
			"		f(false, new A(), new B());\n" + 
28250
			"		System.out.println();\n" + 
28251
			"	}\n" + 
28252
			"\n" + 
28253
			"	static void f(boolean cond, A a, B b) {\n" + 
28254
			"		(cond ? a : b).f();\n" + 
28255
			"		(cond ? a : b).g();\n" + 
28256
			"	}\n" + 
28257
			"}\n",
28258
		},
28259
		"[A#f()][A#g()][B#f()][B#g()]");
28260
}
28261
public void test0897() {
28262
	this.runConformTest(
28263
		new String[] {
28264
			"Test.java", // =================
28265
			"interface I { }\n" + 
28266
			"class X { }\n" + 
28267
			"class A extends X implements I { }\n" + 
28268
			"class B extends X implements I { }\n" + 
28269
			"public class Test {\n" + 
28270
			"    void test(A a, B b) {\n" + 
28271
			"	X x = (a.hashCode() == b.hashCode()) ? a : b;\n" + 
28272
			"    }\n" + 
28273
			"}\n" + 
28274
			"\n",
28275
		},
28276
		"");
28277
}
28278
public void test0898() {
28279
	this.runConformTest(
28280
		new String[] {
28281
			"X.java", // =================
28282
			"interface I1 {\n" + 
28283
			"	void i1();\n" + 
28284
			"}\n" + 
28285
			"class G1<T extends I1> {\n" + 
28286
			"	T get() {\n" + 
28287
			"		return null;\n" + 
28288
			"	}\n" + 
28289
			"}\n" + 
28290
			"interface I2 {\n" + 
28291
			"	void i2();\n" + 
28292
			"}\n" + 
28293
			"public class X {\n" + 
28294
			"	void f1(G1<?> g1) {\n" + 
28295
			"		g1.get().i1();\n" + 
28296
			"	}\n" + 
28297
			"	void f2(G1<? extends I2> g1) {\n" + 
28298
			"		g1.get().i1();\n" + 
28299
			"		g1.get().i2();\n" + 
28300
			"	}\n" + 
28301
			"}\n",
28302
		},
28303
		"");
28304
}
28305
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122331
28306
public void test0899() {
28307
	this.runConformTest(
28308
		new String[] {
28309
			"A.java", // =================
28310
			"public class A<T extends A<T>> extends SomeArbitraryClass<T> {\n" + 
28311
			"  public static class B {\n" + 
28312
			"    private C c;\n" + 
28313
			"    protected void set(C val) {\n" + 
28314
			"      c = val;\n" + 
28315
			"    }\n" + 
28316
			"    protected class C {\n" + 
28317
			"    }\n" + 
28318
			"  }\n" + 
28319
			"}",
28320
			"C.java",
28321
			"public class C {\n" + 
28322
			"  \n" + 
28323
			"  public C() {\n" + 
28324
			"    //do nothing\n" + 
28325
			"  }\n" + 
28326
			"  \n" + 
28327
			"}",
28328
			"ObjThatExtendsB.java",
28329
			"public class ObjThatExtendsB extends A.B {\n" + 
28330
			"  protected void doSomeSetting() {\n" + 
28331
			"    super.set(new ObjThatExtendsC());\n" +
28332
			"  }\n" + 
28333
			"  protected class ObjThatExtendsC extends C {\n" + 
28334
			"  }\n" + 
28335
			"}",
28336
			"ObjThatExtendsC.java",
28337
			"public class ObjThatExtendsC extends C {\n" + 
28338
			"  public ObjThatExtendsC() {\n" + 
28339
			"    //do nothing\n" + 
28340
			"  }\n" + 
28341
			"}",
28342
			"SomeArbitraryClass.java",
28343
			"public class SomeArbitraryClass<T extends SomeArbitraryClass<T>> {\n" + 
28344
			"  public SomeArbitraryClass() {\n" + 
28345
			"    //do nothing\n" + 
28346
			"  }\n" + 
28347
			"}"
28348
		},
28349
		"");
28350
}
28351
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97693
28352
public void test0900() {
28353
	this.runNegativeTest(
28354
		new String[] {
28355
			"X.java", // =================
28356
			"public class X<R> {\n" + 
28357
			"	static interface Interface extends Comparable<String> {}\n" + 
28358
			"\n" + 
28359
			"	static final class Implements implements Interface {\n" + 
28360
			"		public int compareTo(String o) {\n" + 
28361
			"			return 0;\n" + 
28362
			"		}\n" + 
28363
			"	}\n" + 
28364
			"\n" + 
28365
			"	void method() {\n" + 
28366
			"		((Comparable<R>) new Implements()).toString();\n" + 
28367
			"		((Comparable) new Implements()).toString();\n" + 
28368
			"		((Comparable<?>) new Implements()).toString();\n" + 
28369
			"		((Comparable<? extends String>) new Implements()).toString();\n" + 
28370
			"		((Comparable<? super String>) new Implements()).toString();\n" + 
28371
			"		Zork z;\n" +
28372
			"	}\n" + 
28373
			"}\n",
28374
		},
28375
		"----------\n" + 
28376
		"1. WARNING in X.java (at line 11)\n" + 
28377
		"	((Comparable<R>) new Implements()).toString();\n" + 
28378
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
28379
		"Type safety: Unchecked cast from X.Implements to Comparable<R>\n" + 
28380
		"----------\n" + 
28381
		"2. WARNING in X.java (at line 12)\n" + 
28382
		"	((Comparable) new Implements()).toString();\n" + 
28383
		"	  ^^^^^^^^^^\n" + 
28384
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
28385
		"----------\n" + 
28386
		"3. ERROR in X.java (at line 16)\n" + 
28387
		"	Zork z;\n" + 
28388
		"	^^^^\n" + 
28389
		"Zork cannot be resolved to a type\n" + 
28390
		"----------\n");
28391
}
28392
// Object array vs Object into generic method
28393
public void test0901() {
28394
	this.runNegativeTest(
28395
		new String[] {
28396
			"X.java",
28397
			"public class X {\n" + 
28398
			"    static <T> T foo(T p1, T p2) {\n" + 
28399
			"        return p1;\n" + 
28400
			"    }\n" + 
28401
			"    static Object[] bar(int[] i, float[] f) {\n" + 
28402
			"        return foo(i, f);\n" + 
28403
			"    }\n" + 
28404
			"}"},
28405
		"----------\n" + 
28406
		"1. ERROR in X.java (at line 6)\n" + 
28407
		"	return foo(i, f);\n" + 
28408
		"	       ^^^^^^^^^\n" + 
28409
		"Type mismatch: cannot convert from Object&Serializable&Cloneable to Object[]\n" + 
28410
		"----------\n");
28411
}
28412
28413
// circular references amongst generic interfaces with co-implementing classes
28414
public void test0902() {
28415
	this.runConformTest(
28416
		new String[] {
28417
			"I.java",
28418
			"public interface I<U extends J<? extends I<U>>> {\n" + 
28419
			"}",
28420
			"J.java",
28421
			"public interface J<T extends I<? extends J<T>>> {\n" + 
28422
			"}",
28423
			"CI.java",
28424
			"class CI<U extends CJ<T, U> & J<T>,\n" + 
28425
			"			T extends CI<U, T> & I<U>>\n" + 
28426
			"	implements I<U> {\n" +
28427
			"}",
28428
			"CJ.java",
28429
			"class CJ<T extends CI<U, T> & I<U>,\n" +
28430
			"			U extends CJ<T, U> & J<T>>\n" +
28431
			"	implements J<T> {\n" +
28432
			"}"},
28433
		"");
28434
}
28435
28436
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=126914
28437
public void test0903() {
28438
	this.runConformTest(
28439
		new String[] {
28440
			"X.java",
28441
			"interface I<T extends J<T,U>, U extends I<T,U>> {\n" + 
28442
			"    // empty\n" + 
28443
			"}\n" + 
28444
			"interface J<T extends J<T,U>, U extends I<T,U>> {\n" + 
28445
			"    // empty\n" + 
28446
			"}\n" + 
28447
			"final class Y<T, U> extends X<T, U> implements I<X<T, U>, Y<T, U>> {\n" + 
28448
			"    // empty\n" + 
28449
			"}\n" + 
28450
			"abstract class X<T, U> implements J<X<T, U>, Y<T, U>> {\n" + 
28451
			"    // empty\n" + 
28452
			"}\n"
28453
			},
28454
		"");
28455
}
28456
28457
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=126914
28458
public void test0904() {
28459
	this.runConformTest(
28460
		new String[] {
28461
			"X.java",
28462
			"interface I<T extends J<T,U>, U extends I<T,U>> {\n" + 
28463
			"    // empty\n" + 
28464
			"}\n" + 
28465
			"interface J<T extends J<T,U>, U extends I<T,U>> {\n" + 
28466
			"    // empty\n" + 
28467
			"}\n" + 
28468
			"abstract class X<T, U> implements J<X<T, U>, Y<T, U>> {\n" + 
28469
			"    // empty\n" + 
28470
			"}\n" + 
28471
			"final class Y<T, U> extends X<T, U> implements I<X<T, U>, Y<T, U>> {\n" + 
28472
			"    // empty\n" + 
28473
			"}\n"
28474
			},
28475
		"");
28476
}
28477
28478
// array in super bound
28479
public void test0905() {
28480
	this.runConformTest(
28481
		new String[] {
28482
			"X.java",
28483
			"import java.util.List;\n" + 
28484
			" \n" + 
28485
			"class X {\n" + 
28486
			"    void foo(List<? super Object[]> p) {\n" + 
28487
			"        p.add(new Object[0]);\n" + 
28488
			"    }\n" + 
28489
			"}"},
28490
		"");
28491
}
28492
28493
// raw types in casts
28494
public void test0906() {
28495
	this.runNegativeTest(
28496
		new String[] {
28497
			"X.java",
28498
			"interface I<V> {\n" + 
28499
			"    // empty\n" + 
28500
			"}         \n" + 
28501
			"public class X implements I {\n" + 
28502
			"    I<Integer> x1 = (I<Integer>) (X) null;\n" + 
28503
			"    I<Integer> x2 = (I<Integer>) new X();\n" + 
28504
			"    I<Integer> x3 = (I<Integer>) null;\n" + 
28505
			"    X x4 = (X) (I<Integer>) null;\n" + 
28506
			"}"},
28507
			"----------\n" + 
28508
			"1. WARNING in X.java (at line 4)\n" + 
28509
			"	public class X implements I {\n" + 
28510
			"	                          ^\n" + 
28511
			"I is a raw type. References to generic type I<V> should be parameterized\n" + 
28512
			"----------\n" + 
28513
			"2. WARNING in X.java (at line 5)\n" + 
28514
			"	I<Integer> x1 = (I<Integer>) (X) null;\n" + 
28515
			"	                ^^^^^^^^^^^^^^^^^^^^^\n" + 
28516
			"Type safety: Unchecked cast from X to I<Integer>\n" + 
28517
			"----------\n" + 
28518
			"3. WARNING in X.java (at line 5)\n" + 
28519
			"	I<Integer> x1 = (I<Integer>) (X) null;\n" + 
28520
			"	                ^^^^^^^^^^^^^^^^^^^^^\n" + 
28521
			"Unnecessary cast from X to I<Integer>\n" + 
28522
			"----------\n" + 
28523
			"4. WARNING in X.java (at line 5)\n" + 
28524
			"	I<Integer> x1 = (I<Integer>) (X) null;\n" + 
28525
			"	                             ^^^^^^^^\n" + 
28526
			"Unnecessary cast from null to X\n" + 
28527
			"----------\n" + 
28528
			"5. WARNING in X.java (at line 6)\n" + 
28529
			"	I<Integer> x2 = (I<Integer>) new X();\n" + 
28530
			"	                ^^^^^^^^^^^^^^^^^^^^\n" + 
28531
			"Type safety: Unchecked cast from X to I<Integer>\n" + 
28532
			"----------\n" + 
28533
			"6. WARNING in X.java (at line 6)\n" + 
28534
			"	I<Integer> x2 = (I<Integer>) new X();\n" + 
28535
			"	                ^^^^^^^^^^^^^^^^^^^^\n" + 
28536
			"Unnecessary cast from X to I<Integer>\n" + 
28537
			"----------\n" + 
28538
			"7. WARNING in X.java (at line 7)\n" + 
28539
			"	I<Integer> x3 = (I<Integer>) null;\n" + 
28540
			"	                ^^^^^^^^^^^^^^^^^\n" + 
28541
			"Unnecessary cast from null to I<Integer>\n" + 
28542
			"----------\n" + 
28543
			"8. WARNING in X.java (at line 8)\n" + 
28544
			"	X x4 = (X) (I<Integer>) null;\n" + 
28545
			"	           ^^^^^^^^^^^^^^^^^\n" + 
28546
			"Unnecessary cast from null to I<Integer>\n" + 
28547
			"----------\n");
28548
}
28549
28550
// parametrized method with array extends Object upper bound verification
28551
public void test0907() {
28552
	this.runConformTest(
28553
		new String[] {
28554
			"X.java",
28555
			"import java.util.Collection;\n" + 
28556
			"import java.util.Collections;\n" + 
28557
			"public class X<T extends X<T, V>, V> {\n" + 
28558
			"    public void foo() {\n" + 
28559
			"        Y o = (new Z<Object>()).<Y, double[]> bar(Collections\n" + 
28560
			"                .singleton(new Y()));\n" + 
28561
			"        o.toString();\n" + 
28562
			"    }\n" + 
28563
			"}\n" + 
28564
			"class Y extends X<Y, double[]> {\n" + 
28565
			"    // empty\n" + 
28566
			"}\n" + 
28567
			"class Z<V> {\n" + 
28568
			"    public <U extends X<U, W>, W extends V> U bar(Collection<U> c) {\n" + 
28569
			"        return null;\n" + 
28570
			"    }\n" + 
28571
			"}\n"},
28572
		"");
28573
}
28574
28575
// check capture for conditional operator - variant
28576
public void test0908() {
28577
	this.runConformTest(
28578
		new String[] {
28579
			"X.java",
28580
			"public abstract class X {\n" + 
28581
			"    protected <T> void foo(Class<? extends T> clazz) {\n" + 
28582
			"        Class<? extends T> l = clazz.isInterface() ? bar(clazz) : clazz;\n" + 
28583
			"    }\n" + 
28584
			"    abstract public <T> Class<? extends T> bar(Class<T> p);\n" + 
28585
			"}"},
28586
		"");
28587
}
28588
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=126105
28589
public void test0909() {
28590
	this.runNegativeTest(
28591
		new String[] {
28592
			"X.java",
28593
			"public class X {\n" + 
28594
			"	private static class B<T> {\n" + 
28595
			"		private Object x;\n" + 
28596
			"\n" + 
28597
			"		public B(T x) {\n" + 
28598
			"			this.x = x;\n" + 
28599
			"		}\n" + 
28600
			"	}\n" + 
28601
			"\n" + 
28602
			"	private static class C {\n" + 
28603
			"		private Object x;\n" + 
28604
			"\n" + 
28605
			"		public C(Object x) {\n" + 
28606
			"			this.x = x;\n" + 
28607
			"		}\n" + 
28608
			"	}\n" + 
28609
			"\n" + 
28610
			"	public static void main(String[] args) throws Throwable {\n" + 
28611
			"		B<String> b = new B<String>(\"foo\");\n" + 
28612
			"		System.out.println(b.x);\n" + 
28613
			"\n" + 
28614
			"		C c = new C(\"foo\");\n" + 
28615
			"		System.out.println(c.x);\n" + 
28616
			"		Zork z;\n" +
28617
			"	}\n" + 
28618
			"}\n",
28619
		},
28620
		"----------\n" + 
28621
		"1. ERROR in X.java (at line 24)\n" + 
28622
		"	Zork z;\n" + 
28623
		"	^^^^\n" + 
28624
		"Zork cannot be resolved to a type\n" + 
28625
		"----------\n");
28626
}
28627
28628
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=127583
28629
public void test0910() {
28630
	this.runNegativeTest(
28631
		new String[] {
28632
			"X.java",
28633
			"import java.util.ArrayList;\n" + 
28634
			"import java.util.Collection;\n" + 
28635
			"import java.util.List;\n" + 
28636
			"\n" + 
28637
			"public class X {\n" + 
28638
			"\n" + 
28639
			"	void bar() {\n" + 
28640
			"		List<Collection> lc1 = null;\n" + 
28641
			"		List<Collection<?>> lc2 = null;\n" + 
28642
			"		List<? extends Collection<?>> lc3 = null;\n" + 
28643
			"		List<? extends Collection> lc4 = null;\n" + 
28644
			"		lc1 = lc2; //1 ko\n" + 
28645
			"		lc1 = lc3; //2 ko\n" + 
28646
			"		lc1 = lc4; //3 ko\n" + 
28647
			"		lc2 = lc1; //4 ko\n" + 
28648
			"		lc2 = lc3; //5 ko\n" + 
28649
			"		lc2 = lc4; //6 ko\n" + 
28650
			"		lc3 = lc1; //7 ko\n" + 
28651
			"		lc3 = lc2; //8 ok\n" + 
28652
			"		lc3 = lc4; //9 ko\n" + 
28653
			"		lc4 = lc1; //10 ok\n" + 
28654
			"		lc4 = lc2; //11 ok\n" + 
28655
			"		lc4 = lc3; //12 ok\n" + 
28656
			"	}\n" + 
28657
			"	private final List<Collection> aList = new ArrayList<Collection>();\n" + 
28658
			"	public void foo() {\n" + 
28659
			"		final List<Collection<?>> listCopy = new ArrayList<Collection<?>>(this.aList); // ko\n" + 
28660
			"	}\n" + 
28661
			"}\n",
28662
		},
28663
		"----------\n" + 
28664
		"1. WARNING in X.java (at line 8)\n" + 
28665
		"	List<Collection> lc1 = null;\n" + 
28666
		"	     ^^^^^^^^^^\n" + 
28667
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28668
		"----------\n" + 
28669
		"2. WARNING in X.java (at line 11)\n" + 
28670
		"	List<? extends Collection> lc4 = null;\n" + 
28671
		"	               ^^^^^^^^^^\n" + 
28672
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28673
		"----------\n" + 
28674
		"3. ERROR in X.java (at line 12)\n" + 
28675
		"	lc1 = lc2; //1 ko\n" + 
28676
		"	      ^^^\n" + 
28677
		"Type mismatch: cannot convert from List<Collection<?>> to List<Collection>\n" + 
28678
		"----------\n" + 
28679
		"4. ERROR in X.java (at line 13)\n" + 
28680
		"	lc1 = lc3; //2 ko\n" + 
28681
		"	      ^^^\n" + 
28682
		"Type mismatch: cannot convert from List<capture#1-of ? extends Collection<?>> to List<Collection>\n" + 
28683
		"----------\n" + 
28684
		"5. ERROR in X.java (at line 14)\n" + 
28685
		"	lc1 = lc4; //3 ko\n" + 
28686
		"	      ^^^\n" + 
28687
		"Type mismatch: cannot convert from List<capture#3-of ? extends Collection> to List<Collection>\n" + 
28688
		"----------\n" + 
28689
		"6. ERROR in X.java (at line 15)\n" + 
28690
		"	lc2 = lc1; //4 ko\n" + 
28691
		"	      ^^^\n" + 
28692
		"Type mismatch: cannot convert from List<Collection> to List<Collection<?>>\n" + 
28693
		"----------\n" + 
28694
		"7. ERROR in X.java (at line 16)\n" + 
28695
		"	lc2 = lc3; //5 ko\n" + 
28696
		"	      ^^^\n" + 
28697
		"Type mismatch: cannot convert from List<capture#4-of ? extends Collection<?>> to List<Collection<?>>\n" + 
28698
		"----------\n" + 
28699
		"8. ERROR in X.java (at line 17)\n" + 
28700
		"	lc2 = lc4; //6 ko\n" + 
28701
		"	      ^^^\n" + 
28702
		"Type mismatch: cannot convert from List<capture#6-of ? extends Collection> to List<Collection<?>>\n" + 
28703
		"----------\n" + 
28704
		"9. ERROR in X.java (at line 18)\n" + 
28705
		"	lc3 = lc1; //7 ko\n" + 
28706
		"	      ^^^\n" + 
28707
		"Type mismatch: cannot convert from List<Collection> to List<? extends Collection<?>>\n" + 
28708
		"----------\n" + 
28709
		"10. ERROR in X.java (at line 20)\n" + 
28710
		"	lc3 = lc4; //9 ko\n" + 
28711
		"	      ^^^\n" + 
28712
		"Type mismatch: cannot convert from List<capture#13-of ? extends Collection> to List<? extends Collection<?>>\n" + 
28713
		"----------\n" + 
28714
		"11. WARNING in X.java (at line 25)\n" + 
28715
		"	private final List<Collection> aList = new ArrayList<Collection>();\n" + 
28716
		"	                   ^^^^^^^^^^\n" + 
28717
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28718
		"----------\n" + 
28719
		"12. WARNING in X.java (at line 25)\n" + 
28720
		"	private final List<Collection> aList = new ArrayList<Collection>();\n" + 
28721
		"	                                                     ^^^^^^^^^^\n" + 
28722
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28723
		"----------\n" + 
28724
		"13. ERROR in X.java (at line 27)\n" + 
28725
		"	final List<Collection<?>> listCopy = new ArrayList<Collection<?>>(this.aList); // ko\n" + 
28726
		"	                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
28727
		"The constructor ArrayList<Collection<?>>(List<Collection>) is undefined\n" + 
28728
		"----------\n");
28729
}
28730
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=127583 - variation
28731
public void test0911() {
28732
	this.runNegativeTest(
28733
		new String[] {
28734
			"X.java",
28735
			"import java.util.ArrayList;\n" + 
28736
			"import java.util.Collection;\n" + 
28737
			"import java.util.List;\n" + 
28738
			"\n" + 
28739
			"public class X {\n" + 
28740
			"	void bar() {\n" + 
28741
			"		List<Collection> lc1 = null;\n" + 
28742
			"		List<Collection<?>> lc2 = null;\n" + 
28743
			"		List<? super Collection<?>> lc3 = null;\n" + 
28744
			"		List<? super Collection> lc4 = null;\n" + 
28745
			"		lc1 = lc2; //1 ko\n" + 
28746
			"		lc1 = lc3; //2 ko\n" + 
28747
			"		lc1 = lc4; //3 ko\n" + 
28748
			"		lc2 = lc1; //4 ko\n" + 
28749
			"		lc2 = lc3; //5 ko\n" + 
28750
			"		lc2 = lc4; //6 ko\n" + 
28751
			"		lc3 = lc1; //7 ok\n" + 
28752
			"		lc3 = lc2; //8 ok\n" + 
28753
			"		lc3 = lc4; //9 ok\n" + 
28754
			"		lc4 = lc1; //10 ok\n" + 
28755
			"		lc4 = lc2; //11 ko\n" + 
28756
			"		lc4 = lc3; //12 ko\n" + 
28757
			"	}\n" + 
28758
			"}\n",
28759
		},
28760
		"----------\n" + 
28761
		"1. WARNING in X.java (at line 7)\n" + 
28762
		"	List<Collection> lc1 = null;\n" + 
28763
		"	     ^^^^^^^^^^\n" + 
28764
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28765
		"----------\n" + 
28766
		"2. WARNING in X.java (at line 10)\n" + 
28767
		"	List<? super Collection> lc4 = null;\n" + 
28768
		"	             ^^^^^^^^^^\n" + 
28769
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28770
		"----------\n" + 
28771
		"3. ERROR in X.java (at line 11)\n" + 
28772
		"	lc1 = lc2; //1 ko\n" + 
28773
		"	      ^^^\n" + 
28774
		"Type mismatch: cannot convert from List<Collection<?>> to List<Collection>\n" + 
28775
		"----------\n" + 
28776
		"4. ERROR in X.java (at line 12)\n" + 
28777
		"	lc1 = lc3; //2 ko\n" + 
28778
		"	      ^^^\n" + 
28779
		"Type mismatch: cannot convert from List<capture#1-of ? super Collection<?>> to List<Collection>\n" + 
28780
		"----------\n" + 
28781
		"5. ERROR in X.java (at line 13)\n" + 
28782
		"	lc1 = lc4; //3 ko\n" + 
28783
		"	      ^^^\n" + 
28784
		"Type mismatch: cannot convert from List<capture#2-of ? super Collection> to List<Collection>\n" + 
28785
		"----------\n" + 
28786
		"6. ERROR in X.java (at line 14)\n" + 
28787
		"	lc2 = lc1; //4 ko\n" + 
28788
		"	      ^^^\n" + 
28789
		"Type mismatch: cannot convert from List<Collection> to List<Collection<?>>\n" + 
28790
		"----------\n" + 
28791
		"7. ERROR in X.java (at line 15)\n" + 
28792
		"	lc2 = lc3; //5 ko\n" + 
28793
		"	      ^^^\n" + 
28794
		"Type mismatch: cannot convert from List<capture#3-of ? super Collection<?>> to List<Collection<?>>\n" + 
28795
		"----------\n" + 
28796
		"8. ERROR in X.java (at line 16)\n" + 
28797
		"	lc2 = lc4; //6 ko\n" + 
28798
		"	      ^^^\n" + 
28799
		"Type mismatch: cannot convert from List<capture#4-of ? super Collection> to List<Collection<?>>\n" + 
28800
		"----------\n" + 
28801
		"9. ERROR in X.java (at line 21)\n" + 
28802
		"	lc4 = lc2; //11 ko\n" + 
28803
		"	      ^^^\n" + 
28804
		"Type mismatch: cannot convert from List<Collection<?>> to List<? super Collection>\n" + 
28805
		"----------\n" + 
28806
		"10. ERROR in X.java (at line 22)\n" + 
28807
		"	lc4 = lc3; //12 ko\n" + 
28808
		"	      ^^^\n" + 
28809
		"Type mismatch: cannot convert from List<capture#12-of ? super Collection<?>> to List<? super Collection>\n" + 
28810
		"----------\n");
28811
}
28812
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=127583 - variation
28813
public void test0912() {
28814
	this.runNegativeTest(
28815
		new String[] {
28816
			"X.java",
28817
			"import java.util.*;\n" + 
28818
			"\n" + 
28819
			"public class X {\n" + 
28820
			"	void foo(List<? extends Collection<String>[]> l1, List<Collection[]> l2) {\n" + 
28821
			"		l1 = l2;\n" + 
28822
			"		l2 = l1;\n" + 
28823
			"	}\n" + 
28824
			"}\n",
28825
		},
28826
		"----------\n" + 
28827
		"1. WARNING in X.java (at line 4)\n" + 
28828
		"	void foo(List<? extends Collection<String>[]> l1, List<Collection[]> l2) {\n" + 
28829
		"	                                                       ^^^^^^^^^^\n" + 
28830
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28831
		"----------\n" + 
28832
		"2. ERROR in X.java (at line 5)\n" + 
28833
		"	l1 = l2;\n" + 
28834
		"	     ^^\n" + 
28835
		"Type mismatch: cannot convert from List<Collection[]> to List<? extends Collection<String>[]>\n" + 
28836
		"----------\n" + 
28837
		"3. ERROR in X.java (at line 6)\n" + 
28838
		"	l2 = l1;\n" + 
28839
		"	     ^^\n" + 
28840
		"Type mismatch: cannot convert from List<capture#2-of ? extends Collection<String>[]> to List<Collection[]>\n" + 
28841
		"----------\n");
28842
}
28843
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=127583 - variation
28844
public void test0913() {
28845
	this.runNegativeTest(
28846
		new String[] {
28847
			"X.java",
28848
			"import java.util.*;\n" + 
28849
			"public class X {\n" + 
28850
			"	void bar() {\n" + 
28851
			"		List<Collection[]> lc1 = null;\n" + 
28852
			"		List<Collection<?>[]> lc2 = null;\n" + 
28853
			"		List<? extends Collection<?>[]> lc3 = null;\n" + 
28854
			"		List<? extends Collection[]> lc4 = null;\n" + 
28855
			"		lc1 = lc2; //1 ko\n" + 
28856
			"		lc1 = lc3; //2 ko\n" + 
28857
			"		lc1 = lc4; //3 ko\n" + 
28858
			"		lc2 = lc1; //4 ko\n" + 
28859
			"		lc2 = lc3; //5 ko\n" + 
28860
			"		lc2 = lc4; //6 ko\n" + 
28861
			"		lc3 = lc1; //7 ko\n" + 
28862
			"		lc3 = lc2; //8 ok\n" + 
28863
			"		lc3 = lc4; //9 ko\n" + 
28864
			"		lc4 = lc1; //10 ok\n" + 
28865
			"		lc4 = lc2; //11 ok\n" + 
28866
			"		lc4 = lc3; //12 ok		\n" + 
28867
			"	}\n" + 
28868
			"}\n",
28869
		},
28870
		"----------\n" + 
28871
		"1. WARNING in X.java (at line 4)\n" + 
28872
		"	List<Collection[]> lc1 = null;\n" + 
28873
		"	     ^^^^^^^^^^\n" + 
28874
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28875
		"----------\n" + 
28876
		"2. WARNING in X.java (at line 7)\n" + 
28877
		"	List<? extends Collection[]> lc4 = null;\n" + 
28878
		"	               ^^^^^^^^^^\n" + 
28879
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28880
		"----------\n" + 
28881
		"3. ERROR in X.java (at line 8)\n" + 
28882
		"	lc1 = lc2; //1 ko\n" + 
28883
		"	      ^^^\n" + 
28884
		"Type mismatch: cannot convert from List<Collection<?>[]> to List<Collection[]>\n" + 
28885
		"----------\n" + 
28886
		"4. ERROR in X.java (at line 9)\n" + 
28887
		"	lc1 = lc3; //2 ko\n" + 
28888
		"	      ^^^\n" + 
28889
		"Type mismatch: cannot convert from List<capture#1-of ? extends Collection<?>[]> to List<Collection[]>\n" + 
28890
		"----------\n" + 
28891
		"5. ERROR in X.java (at line 10)\n" + 
28892
		"	lc1 = lc4; //3 ko\n" + 
28893
		"	      ^^^\n" + 
28894
		"Type mismatch: cannot convert from List<capture#2-of ? extends Collection[]> to List<Collection[]>\n" + 
28895
		"----------\n" + 
28896
		"6. ERROR in X.java (at line 11)\n" + 
28897
		"	lc2 = lc1; //4 ko\n" + 
28898
		"	      ^^^\n" + 
28899
		"Type mismatch: cannot convert from List<Collection[]> to List<Collection<?>[]>\n" + 
28900
		"----------\n" + 
28901
		"7. ERROR in X.java (at line 12)\n" + 
28902
		"	lc2 = lc3; //5 ko\n" + 
28903
		"	      ^^^\n" + 
28904
		"Type mismatch: cannot convert from List<capture#3-of ? extends Collection<?>[]> to List<Collection<?>[]>\n" + 
28905
		"----------\n" + 
28906
		"8. ERROR in X.java (at line 13)\n" + 
28907
		"	lc2 = lc4; //6 ko\n" + 
28908
		"	      ^^^\n" + 
28909
		"Type mismatch: cannot convert from List<capture#4-of ? extends Collection[]> to List<Collection<?>[]>\n" + 
28910
		"----------\n" + 
28911
		"9. ERROR in X.java (at line 14)\n" + 
28912
		"	lc3 = lc1; //7 ko\n" + 
28913
		"	      ^^^\n" + 
28914
		"Type mismatch: cannot convert from List<Collection[]> to List<? extends Collection<?>[]>\n" + 
28915
		"----------\n" + 
28916
		"10. ERROR in X.java (at line 16)\n" + 
28917
		"	lc3 = lc4; //9 ko\n" + 
28918
		"	      ^^^\n" + 
28919
		"Type mismatch: cannot convert from List<capture#8-of ? extends Collection[]> to List<? extends Collection<?>[]>\n" + 
28920
		"----------\n");
28921
}
28922
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=127583 - variation
28923
public void test0914() {
28924
	this.runNegativeTest(
28925
		new String[] {
28926
			"X.java",
28927
			"import java.util.*;\n" + 
28928
			"public class X {\n" + 
28929
			"	void bar() {\n" + 
28930
			"		List<Collection[]> lc1 = null;\n" + 
28931
			"		List<Collection<?>[]> lc2 = null;\n" + 
28932
			"		List<? super Collection<?>[]> lc3 = null;\n" + 
28933
			"		List<? super Collection[]> lc4 = null;\n" + 
28934
			"		lc1 = lc2; //1 ko\n" + 
28935
			"		lc1 = lc3; //2 ko\n" + 
28936
			"		lc1 = lc4; //3 ko\n" + 
28937
			"		lc2 = lc1; //4 ko\n" + 
28938
			"		lc2 = lc3; //5 ko\n" + 
28939
			"		lc2 = lc4; //6 ko\n" + 
28940
			"		lc3 = lc1; //7 ok\n" + 
28941
			"		lc3 = lc2; //8 ok\n" + 
28942
			"		lc3 = lc4; //9 ok\n" + 
28943
			"		lc4 = lc1; //10 ok\n" + 
28944
			"		lc4 = lc2; //11 ko\n" + 
28945
			"		lc4 = lc3; //12 ko		\n" + 
28946
			"	}\n" + 
28947
			"}\n",
28948
		},
28949
		"----------\n" + 
28950
		"1. WARNING in X.java (at line 4)\n" + 
28951
		"	List<Collection[]> lc1 = null;\n" + 
28952
		"	     ^^^^^^^^^^\n" + 
28953
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28954
		"----------\n" + 
28955
		"2. WARNING in X.java (at line 7)\n" + 
28956
		"	List<? super Collection[]> lc4 = null;\n" + 
28957
		"	             ^^^^^^^^^^\n" + 
28958
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
28959
		"----------\n" + 
28960
		"3. ERROR in X.java (at line 8)\n" + 
28961
		"	lc1 = lc2; //1 ko\n" + 
28962
		"	      ^^^\n" + 
28963
		"Type mismatch: cannot convert from List<Collection<?>[]> to List<Collection[]>\n" + 
28964
		"----------\n" + 
28965
		"4. ERROR in X.java (at line 9)\n" + 
28966
		"	lc1 = lc3; //2 ko\n" + 
28967
		"	      ^^^\n" + 
28968
		"Type mismatch: cannot convert from List<capture#1-of ? super Collection<?>[]> to List<Collection[]>\n" + 
28969
		"----------\n" + 
28970
		"5. ERROR in X.java (at line 10)\n" + 
28971
		"	lc1 = lc4; //3 ko\n" + 
28972
		"	      ^^^\n" + 
28973
		"Type mismatch: cannot convert from List<capture#2-of ? super Collection[]> to List<Collection[]>\n" + 
28974
		"----------\n" + 
28975
		"6. ERROR in X.java (at line 11)\n" + 
28976
		"	lc2 = lc1; //4 ko\n" + 
28977
		"	      ^^^\n" + 
28978
		"Type mismatch: cannot convert from List<Collection[]> to List<Collection<?>[]>\n" + 
28979
		"----------\n" + 
28980
		"7. ERROR in X.java (at line 12)\n" + 
28981
		"	lc2 = lc3; //5 ko\n" + 
28982
		"	      ^^^\n" + 
28983
		"Type mismatch: cannot convert from List<capture#3-of ? super Collection<?>[]> to List<Collection<?>[]>\n" + 
28984
		"----------\n" + 
28985
		"8. ERROR in X.java (at line 13)\n" + 
28986
		"	lc2 = lc4; //6 ko\n" + 
28987
		"	      ^^^\n" + 
28988
		"Type mismatch: cannot convert from List<capture#4-of ? super Collection[]> to List<Collection<?>[]>\n" + 
28989
		"----------\n" + 
28990
		"9. ERROR in X.java (at line 18)\n" + 
28991
		"	lc4 = lc2; //11 ko\n" + 
28992
		"	      ^^^\n" + 
28993
		"Type mismatch: cannot convert from List<Collection<?>[]> to List<? super Collection[]>\n" + 
28994
		"----------\n" + 
28995
		"10. ERROR in X.java (at line 19)\n" + 
28996
		"	lc4 = lc3; //12 ko		\n" + 
28997
		"	      ^^^\n" + 
28998
		"Type mismatch: cannot convert from List<capture#12-of ? super Collection<?>[]> to List<? super Collection[]>\n" + 
28999
		"----------\n");
29000
}
29001
29002
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128389
29003
public void test0915() {
29004
	this.runNegativeTest(
29005
		new String[] {
29006
			"X.java",
29007
			"public class X<T> {\n" + 
29008
			"	class Y1 extends Throwable {\n" + 
29009
			"		private static final long serialVersionUID = 1L;\n" + 
29010
			"		T t;\n" + 
29011
			"	}\n" + 
29012
			"	static class Y2 extends Throwable {\n" + 
29013
			"		private static final long serialVersionUID = 1L;\n" + 
29014
			"	}\n" + 
29015
			"	class Y3<U> extends Throwable {\n" + 
29016
			"		private static final long serialVersionUID = 1L;\n" + 
29017
			"\n" + 
29018
			"		T t;\n" + 
29019
			"	}\n" + 
29020
			"}\n" + 
29021
			"class Y4<E> extends Throwable {}\n" + 
29022
			"\n",
29023
		},
29024
		"----------\n" + 
29025
		"1. ERROR in X.java (at line 2)\n" + 
29026
		"	class Y1 extends Throwable {\n" + 
29027
		"	                 ^^^^^^^^^\n" + 
29028
		"The generic class X<T>.Y1 may not subclass java.lang.Throwable\n" + 
29029
		"----------\n" + 
29030
		"2. ERROR in X.java (at line 9)\n" + 
29031
		"	class Y3<U> extends Throwable {\n" + 
29032
		"	                    ^^^^^^^^^\n" + 
29033
		"The generic class X<T>.Y3<U> may not subclass java.lang.Throwable\n" + 
29034
		"----------\n" + 
29035
		"3. WARNING in X.java (at line 15)\n" + 
29036
		"	class Y4<E> extends Throwable {}\n" + 
29037
		"	      ^^\n" + 
29038
		"The serializable class Y4 does not declare a static final serialVersionUID field of type long\n" + 
29039
		"----------\n" + 
29040
		"4. ERROR in X.java (at line 15)\n" + 
29041
		"	class Y4<E> extends Throwable {}\n" + 
29042
		"	                    ^^^^^^^^^\n" + 
29043
		"The generic class Y4<E> may not subclass java.lang.Throwable\n" + 
29044
		"----------\n");
29045
}
29046
29047
// synchronized inheritance for multiple generic types
29048
public void test0916() {
29049
	this.runConformTest(
29050
		new String[] {
29051
			"X.java",
29052
			"public class X<T extends X2<?>> {\n" + 
29053
			"    T m2;\n" + 
29054
			"    T getX2() {\n" + 
29055
			"        return this.m2;\n" + 
29056
			"    }\n" + 
29057
			"}\n" + 
29058
			"class X2<T extends X3> {\n" + 
29059
			"    T m3;\n" + 
29060
			"    T getX3() {\n" + 
29061
			"        return this.m3;\n" + 
29062
			"    }\n" + 
29063
			"}\n" + 
29064
			"class X3 {\n" + 
29065
			"}\n" + 
29066
			"class Y1<T extends Y2<?>> extends X<T> {\n" + 
29067
			"    public void foo() {\n" + 
29068
			"        getX2().getX3().bar(); // getX3 appropriately returns an Y3\n" + 
29069
			"    }\n" + 
29070
			"}\n" + 
29071
			"class Y2<T extends Y3> extends X2<T> {\n" + 
29072
			"}\n" + 
29073
			"class Y3 extends X3 {\n" + 
29074
			"    public void bar() {\n" + 
29075
			"    }\n" + 
29076
			"}\n"},
29077
		"");
29078
}
29079
29080
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=128423
29081
// [1.5][compiler] ClassCastException on illegal code fragment
29082
public void test0917() {
29083
	this.runNegativeTest(
29084
		new String[] {
29085
			"X.java",
29086
			"public class X<T extends A> extends X2<T.M> { }\n" +
29087
			"class X2<T> { }\n" +
29088
			"class A { static class M {} }"
29089
		},
29090
		"----------\n" + 
29091
		"1. ERROR in X.java (at line 1)\n" + 
29092
		"	public class X<T extends A> extends X2<T.M> { }\n" + 
29093
		"	                                       ^^^\n" + 
29094
		"Illegal qualified access from the type parameter T\n" + 
29095
		"----------\n"
29096
		// cannot select from a type variable
29097
	);
29098
}
29099
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128423 - variation
29100
public void test0917a() {
29101
	this.runNegativeTest(
29102
		new String[] {
29103
			"X.java",
29104
			"public class X<T> extends X2<T.clazz> { }\n" +
29105
			"class X2<T> { }\n"
29106
		},
29107
		"----------\n" + 
29108
		"1. ERROR in X.java (at line 1)\n" + 
29109
		"	public class X<T> extends X2<T.clazz> { }\n" + 
29110
		"	                             ^^^^^^^\n" + 
29111
		"Illegal qualified access from the type parameter T\n" + 
29112
		"----------\n"
29113
		// cannot select from a type variable
29114
	);
29115
}
29116
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128423 - variation
29117
public void test0917b() {
29118
	this.runNegativeTest(
29119
		new String[] {
29120
			"X.java",
29121
			"public class X<T> { Class<T> c = T.class; }"
29122
		},
29123
		"----------\n" + 
29124
		"1. ERROR in X.java (at line 1)\n" + 
29125
		"	public class X<T> { Class<T> c = T.class; }\n" + 
29126
		"	                                 ^^^^^^^\n" + 
29127
		"Illegal class literal for the type parameter T\n" + 
29128
		"----------\n");
29129
}
29130
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128423 - variation
29131
public void test0917c() {
29132
	this.runNegativeTest(
29133
		new String[] {
29134
			"X.java",
29135
			"public class X<T> extends X2<T.class> { }\n" +
29136
			"class X2<T> { }\n"
29137
		},
29138
		"----------\n" + 
29139
		"1. ERROR in X.java (at line 1)\n" + 
29140
		"	public class X<T> extends X2<T.class> { }\n" + 
29141
		"	                               ^^^^^\n" + 
29142
		"Syntax error on token \"class\", Identifier expected\n" + 
29143
		"----------\n");
29144
}
29145
29146
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128560
29147
public void test0918() {
29148
	this.runConformTest(
29149
		new String[] {
29150
			"BasicNode.java",
29151
			"class BasicEdge<N extends BasicNode<E, N> & Node<E>, E extends BasicEdge<N, E> & Edge<N>>\n" + 
29152
			"		implements Edge<N> {\n" + 
29153
			"}\n" + 
29154
			"\n" + 
29155
			"public class BasicNode<E extends BasicEdge<N, E> & Edge<N>, N extends BasicNode<E, N> & Node<E>>\n" + 
29156
			"		implements Node<E> {\n" + 
29157
			"}\n" + 
29158
			"\n" + 
29159
			"interface Edge<N extends Node<? extends Edge<N>>> {\n" + 
29160
			"}\n" + 
29161
			"\n" + 
29162
			"interface Node<E extends Edge<? extends Node<E>>> {\n" + 
29163
			"}\n",
29164
		},
29165
		"");
29166
}
29167
29168
public void test0919() {
29169
	this.runConformTest(
29170
		new String[] {
29171
			"X.java",
29172
			"class Box<E> {\n" + 
29173
			"	private E element;\n" + 
29174
			"	void put(E elem) {\n" + 
29175
			"		this.element = elem;\n" + 
29176
			"	}\n" + 
29177
			"	E get() {\n" + 
29178
			"		return this.element;\n" + 
29179
			"	}\n" + 
29180
			"	Pair<E, E> asPair() {\n" + 
29181
			"		return new Pair<E, E>(this.element, this.element);\n" + 
29182
			"	}\n" + 
29183
			"	Box<Box<E>> nest() {\n" + 
29184
			"		Box<Box<E>> wrapper = new Box<Box<E>>();\n" + 
29185
			"		wrapper.put(this);\n" + 
29186
			"		return wrapper;\n" + 
29187
			"	}\n" + 
29188
			"}\n" + 
29189
			"\n" + 
29190
			"class Pair<U, V> {\n" + 
29191
			"	Pair(U u, V v) {\n" + 
29192
			"	}\n" + 
29193
			"}\n" + 
29194
			"\n" + 
29195
			"class PandoraBox<T extends Box<T>> extends Box<T> {\n" + 
29196
			"}\n" + 
29197
			"\n" + 
29198
			"public class X {\n" + 
29199
			"	void test(PandoraBox<?> pbox) {\n" + 
29200
			"		Box<?> box = pbox.get();\n" + 
29201
			"		Pair<?,?> pair = pbox.asPair();\n" + 
29202
			"		Box<?> nbox = pbox.nest();\n" + 
29203
			"	}\n" + 
29204
			"}\n",
29205
		},
29206
		"");
29207
}
29208
public void test0920() {
29209
	this.runConformTest(
29210
		new String[] {
29211
			"X.java",
29212
			"import java.util.*;\n" + 
29213
			"class Stack<E> {\n" + 
29214
			"	private List<E> contents = new ArrayList<E>();\n" + 
29215
			"	void push(E e) {\n" + 
29216
			"		this.contents.add(e);\n" + 
29217
			"	}\n" + 
29218
			"	E pop() {\n" + 
29219
			"		int last = this.contents.size() - 1;\n" + 
29220
			"		if (last < 0) throw new EmptyStackException();\n" + 
29221
			"		return this.contents.remove(last);\n" + 
29222
			"	}\n" + 
29223
			"	private static <T> void doSwap(Stack<T> s) {\n" + 
29224
			"		T t1 = s.pop();\n" + 
29225
			"		T t2 = s.pop();\n" + 
29226
			"		s.push(t1);\n" + 
29227
			"		s.push(t2);\n" + 
29228
			"	}\n" + 
29229
			"	static void swap(Stack<?> s) { doSwap(s); }\n" + 
29230
			"}\n" + 
29231
			"public class X {\n" + 
29232
			"	public static void main(String[] args) {\n" + 
29233
			"		Stack<Integer> si = new Stack<Integer>();\n" + 
29234
			"		Integer[] ints = { 12, 13, 14, 15, };\n" + 
29235
			"		for (Integer i : ints) si.push(i);\n" + 
29236
			"		try {\n" + 
29237
			"			while(true) {\n" + 
29238
			"				System.out.print(\"[\"+si.pop()+\"]\");\n" + 
29239
			"			}\n" + 
29240
			"		} catch(EmptyStackException e) {\n" + 
29241
			"			System.out.println(\"[done]\");\n" + 
29242
			"		}\n" + 
29243
			"	}\n" + 
29244
			"}\n",
29245
		},
29246
		"[15][14][13][12][done]");
29247
}
29248
public void test0921() {
29249
	this.runConformTest(
29250
		new String[] {
29251
			"Graph.java",
29252
			"class Node<N extends Node<N,E>, E extends Edge<N,E>> {\n" + 
29253
			"}\n" + 
29254
			"class Edge<N extends Node<N,E>, E extends Edge<N,E>> {\n" + 
29255
			"}\n" + 
29256
			"class Graph<N extends Node<N,E>, E extends Edge<N,E>>{\n" + 
29257
			"	N n;\n" + 
29258
			"	E e;\n" + 
29259
			"	private Graph(N n, E e) {\n" + 
29260
			"		this.n = n;\n" + 
29261
			"		this.e = e;\n" + 
29262
			"	}\n" + 
29263
			"	static <N extends Node<N,E>, E extends Edge<N,E>>\n" + 
29264
			"	Graph<N,E> copy(Graph<N,E> g) {\n" + 
29265
			"		return create(g.n,g.e);\n" + 
29266
			"	}\n" + 
29267
			"	static <N extends Node<N,E>, E extends Edge<N,E>>\n" + 
29268
			"	Graph<N,E> create(N n, E e) {\n" + 
29269
			"		return new Graph<N,E>(n,e);\n" + 
29270
			"	}\n" + 
29271
			"	Graph<?,?> builder() {\n" + 
29272
			"		Graph<?,?> g = null;\n" + 
29273
			"		return copy(g);\n" + 
29274
			"	}\n" + 
29275
			"}\n",
29276
		},
29277
		"");
29278
}
29279
// Test case which comes from JDT/UI tests TypeEnvironmentTest.testWildcardAssignements
29280
public void test0922() {
29281
	this.runNegativeTest(
29282
		new String[] {
29283
		"Test.java",
29284
		"import java.util.*;\n" + 
29285
		"public class Test {\n" + 
29286
		"	List<List> list_raw_list;\n" + 
29287
		"	{\n" + 
29288
		"		Collection<? extends Collection<? extends Number>> col = list_raw_list;\n" + 
29289
		"	}\n" + 
29290
		"}\n"				
29291
		},
29292
		"----------\n" + 
29293
		"1. WARNING in Test.java (at line 3)\n" + 
29294
		"	List<List> list_raw_list;\n" + 
29295
		"	     ^^^^\n" + 
29296
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
29297
		"----------\n" + 
29298
		"2. ERROR in Test.java (at line 5)\n" + 
29299
		"	Collection<? extends Collection<? extends Number>> col = list_raw_list;\n" + 
29300
		"	                                                         ^^^^^^^^^^^^^\n" + 
29301
		"Type mismatch: cannot convert from List<List> to Collection<? extends Collection<? extends Number>>\n" + 
29302
		"----------\n"
29303
	);
29304
}
29305
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129129 
29306
public void test0923() {
29307
	this.runNegativeTest(
29308
		new String[] {
29309
		"X.java",
29310
		"public class X<T> {\n" + 
29311
		"\n" + 
29312
		"  static void a(Class<? extends X<?>> c) {}\n" + 
29313
		"\n" + 
29314
		"  static void b(X<?> t) {\n" + 
29315
		"    X.a(t.getClass());\n" + 
29316
		"  }\n" + 
29317
		"}\n"			
29318
		},
29319
		"----------\n" + 
29320
		"1. ERROR in X.java (at line 6)\n" + 
29321
		"	X.a(t.getClass());\n" + 
29322
		"	  ^\n" + 
29323
		"The method a(Class<? extends X<?>>) in the type X is not applicable for the arguments (Class<capture#2-of ? extends X>)\n" + 
29324
		"----------\n");
29325
}
29326
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129190 
29327
public void test0924() {
29328
	this.runConformTest(
29329
		new String[] {
29330
		"ExtendedOuter.java",
29331
		"class Outer<O> {\n" + 
29332
		"	class Inner {\n" + 
29333
		"	}\n" + 
29334
		"\n" + 
29335
		"	static void method(Outer<?>.Inner x) {\n" + 
29336
		"		System.out.println(\"SUCCESS\");\n" +
29337
		"	}\n" + 
29338
		"}\n" + 
29339
		"\n" + 
29340
		"public class ExtendedOuter<E> extends Outer<E> {\n" + 
29341
		"	class ExtendedInner extends Inner {\n" + 
29342
		"		{\n" + 
29343
		"			Outer.method(this);\n" + 
29344
		"		}\n" + 
29345
		"	}\n" + 
29346
		"	public static void main(String[] args) {\n" +
29347
		"		new ExtendedOuter<String>().new ExtendedInner();\n" +
29348
		"	}\n" +
29349
		"}\n"		
29350
		},
29351
		"SUCCESS");
29352
}
29353
// **
29354
public void test0925() {
29355
	this.runConformTest(
29356
		new String[] {
29357
		"X.java",
29358
		"import java.util.*;\n" + 
29359
		"\n" + 
29360
		"public class X<A, B> {\n" + 
29361
		"	private List<A> toAdd;\n" + 
29362
		"\n" + 
29363
		"	public X(List<A> toAdd) {\n" + 
29364
		"		this.toAdd = toAdd;\n" + 
29365
		"	}\n" + 
29366
		"\n" + 
29367
		"	private List<A> getRelated(B b) {\n" + 
29368
		"		// some application logic\n" + 
29369
		"		// for demo\n" + 
29370
		"		return toAdd;\n" + 
29371
		"	}\n" + 
29372
		"\n" + 
29373
		"	@SuppressWarnings(\"unchecked\")\n" + 
29374
		"	public <L extends List<? super A>, LF extends Factory<L>> L addOrCreate4(\n" + 
29375
		"			B b, L l, LF lf) {\n" + 
29376
		"		if (l == null) {\n" + 
29377
		"			l = lf.create();\n" + 
29378
		"		}\n" + 
29379
		"		((List<? super A>) l).addAll(getRelated(b)); \n" + 
29380
		"		l.addAll(getRelated(b));\n" + 
29381
		"		return l;\n" + 
29382
		"	}\n" + 
29383
		"\n" + 
29384
		"	public static class ListFactory<T> implements Factory<List<T>> {\n" + 
29385
		"		public List<T> create() {\n" + 
29386
		"			return new ArrayList<T>();\n" + 
29387
		"		}\n" + 
29388
		"	}\n" + 
29389
		"\n" + 
29390
		"	public static interface Factory<T> {\n" + 
29391
		"		public T create();\n" + 
29392
		"	}\n" + 
29393
		"\n" + 
29394
		"	public static void main(String... args) {\n" + 
29395
		"		ListFactory<Number> lf = new ListFactory<Number>();\n" + 
29396
		"		List<Long> longs = new ArrayList<Long>();\n" + 
29397
		"		longs.add(new Long(1));\n" + 
29398
		"		X<Long, Number> test = new X<Long, Number>(longs);\n" + 
29399
		"		List<Number> ret4 = null;\n" + 
29400
		"		ret4 = test.addOrCreate4(1, ret4, lf);\n" + 
29401
		"		System.out.println(\"SUCCESS\");\n" +
29402
		"	}\n" + 
29403
		"}\n"
29404
		},
29405
		"SUCCESS");
29406
}
29407
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261
29408
public void test0926() {
29409
	this.runNegativeTest(
29410
		new String[] {
29411
		"X.java",
29412
		"public class X {\n" + 
29413
		"\n" + 
29414
		"	public void foo() {\n" + 
29415
		"		NonTerminalSourcePart<? extends Tuple<Boolean, Term>> RESULT = null;\n" + 
29416
		"		NonTerminalSourcePart<? extends Tuple<? extends Term, ? extends Formula>> t = null;\n" + 
29417
		"		RESULT = NonTerminalSourcePart.create(Tuple.create(true, t.value().fst()));\n" + 
29418
		"	}\n" + 
29419
		"}\n" + 
29420
		"\n" + 
29421
		"class Term {\n" + 
29422
		"}\n" + 
29423
		"\n" + 
29424
		"class Formula {\n" + 
29425
		"}\n" + 
29426
		"\n" + 
29427
		"final class NonTerminalSourcePart<V> {\n" + 
29428
		"	static <V> NonTerminalSourcePart<V> create(final V _value) {\n" + 
29429
		"		return null;\n" + 
29430
		"	}\n" + 
29431
		"	final V value() {\n" + 
29432
		"		return null;\n" + 
29433
		"	}\n" + 
29434
		"}\n" + 
29435
		"\n" + 
29436
		"class Tuple<A, B> {\n" + 
29437
		"	public static <A, B> Tuple<A, B> create(final A a, final B b) {\n" + 
29438
		"		return null;\n" + 
29439
		"	}\n" + 
29440
		"	public A fst() {\n" + 
29441
		"		return null;\n" + 
29442
		"	}\n" + 
29443
		"}\n"
29444
		},
29445
		"----------\n" + 
29446
		"1. ERROR in X.java (at line 6)\n" + 
29447
		"	RESULT = NonTerminalSourcePart.create(Tuple.create(true, t.value().fst()));\n" + 
29448
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
29449
		"Type mismatch: cannot convert from NonTerminalSourcePart<Tuple<Boolean,capture#3-of ? extends Term>> to NonTerminalSourcePart<? extends Tuple<Boolean,Term>>\n" + 
29450
		"----------\n");
29451
}
29452
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
29453
public void test0927() {
29454
	this.runNegativeTest(
29455
		new String[] {
29456
		"X.java",
29457
		"import java.util.*;\n" + 
29458
		"public class X {\n" + 
29459
		"	public void foo() {\n" + 
29460
		"		List<? extends List<Object>> RESULT = null;\n" + 
29461
		"		List<? extends Object> lst = null;\n" + 
29462
		"		RESULT = Collections.singletonList(Collections.singletonList(lst.get(0)));\n" + 
29463
		"	}\n" + 
29464
		"	public void bar() {\n" + 
29465
		"		List<List<Object>> RESULT = null;\n" + 
29466
		"		List<? extends Object> lst = null;\n" + 
29467
		"		RESULT = Collections.singletonList(Collections.singletonList(lst.get(0)));\n" + 
29468
		"	}\n" + 
29469
		"	public void baz() {\n" + 
29470
		"		List<List<Object>> RESULT = null;\n" + 
29471
		"		List<?> lst = null;\n" + 
29472
		"		RESULT = Collections.singletonList(Collections.singletonList(lst.get(0)));\n" + 
29473
		"	}\n" + 
29474
		"	public void bar2(List<? extends Object> lst) {\n" + 
29475
		"		List<Object> RESULT = null;\n" + 
29476
		"		RESULT = lst;\n" + 
29477
		"		RESULT = Collections.singletonList(lst.get(0));\n" + 
29478
		"	}	\n" + 
29479
		"	public static void main(String[] args) {\n" + 
29480
		"		List<String> ls = new ArrayList<String>();\n" + 
29481
		"		ls.add(\"str\");\n" + 
29482
		"		new X().bar2(ls);\n" + 
29483
		"	}\n" + 
29484
		"}\n",
29485
		},
29486
		"----------\n" + 
29487
		"1. ERROR in X.java (at line 6)\n" + 
29488
		"	RESULT = Collections.singletonList(Collections.singletonList(lst.get(0)));\n" + 
29489
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
29490
		"Type mismatch: cannot convert from List<List<capture#2-of ? extends Object>> to List<? extends List<Object>>\n" + 
29491
		"----------\n" + 
29492
		"2. ERROR in X.java (at line 11)\n" + 
29493
		"	RESULT = Collections.singletonList(Collections.singletonList(lst.get(0)));\n" + 
29494
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
29495
		"Type mismatch: cannot convert from List<List<capture#3-of ? extends Object>> to List<List<Object>>\n" + 
29496
		"----------\n" + 
29497
		"3. ERROR in X.java (at line 16)\n" + 
29498
		"	RESULT = Collections.singletonList(Collections.singletonList(lst.get(0)));\n" + 
29499
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
29500
		"Type mismatch: cannot convert from List<List<capture#4-of ?>> to List<List<Object>>\n" + 
29501
		"----------\n" + 
29502
		"4. ERROR in X.java (at line 20)\n" + 
29503
		"	RESULT = lst;\n" + 
29504
		"	         ^^^\n" + 
29505
		"Type mismatch: cannot convert from List<capture#5-of ? extends Object> to List<Object>\n" + 
29506
		"----------\n" + 
29507
		"5. ERROR in X.java (at line 21)\n" + 
29508
		"	RESULT = Collections.singletonList(lst.get(0));\n" + 
29509
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
29510
		"Type mismatch: cannot convert from List<capture#6-of ? extends Object> to List<Object>\n" + 
29511
		"----------\n");
29512
}
29513
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
29514
public void test0928() {
29515
	this.runNegativeTest(
29516
		new String[] {
29517
		"X.java",
29518
		"import java.util.*;\n" + 
29519
		"public class X {\n" + 
29520
		"    public static void main(String[] args) throws Throwable {\n" + 
29521
		"	List<?> x1 = new ArrayList<Integer>();\n" + 
29522
		"	List<?> x2 = new ArrayList<Integer>();\n" + 
29523
		"	x1.addAll(x2);\n" + 
29524
		"    }\n" + 
29525
		"}\n",
29526
		},
29527
		"----------\n" + 
29528
		"1. ERROR in X.java (at line 6)\n" + 
29529
		"	x1.addAll(x2);\n" + 
29530
		"	   ^^^^^^\n" + 
29531
		"The method addAll(Collection<? extends capture#1-of ?>) in the type List<capture#1-of ?> is not applicable for the arguments (List<capture#2-of ?>)\n" + 
29532
		"----------\n");
29533
}
29534
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=117119
29535
public void test0929() {
29536
	this.runNegativeTest(
29537
		new String[] {
29538
		"X.java",
29539
		"import java.util.Collection;\n" + 
29540
		"\n" + 
29541
		"public class X {\n" + 
29542
		"  \n" + 
29543
		"  public static <E extends Enum<E>> void fails () {\n" + 
29544
		"    Class<? extends Enum> enumType = null;\n" + 
29545
		"    final Collection<E> test = allOf(enumType);\n" + 
29546
		"\n" + 
29547
		"    Collection<? extends Enum> colType = null;\n" + 
29548
		"    final Collection<E> test2 = colType;\n" + 
29549
		"  }\n" + 
29550
		"  \n" + 
29551
		"  public static <E extends Enum<E>> Collection<E> allOf(final Class<E> enumType) {\n" + 
29552
		"    return null;\n" + 
29553
		"  }\n" + 
29554
		"}\n",
29555
		},
29556
		"----------\n" + 
29557
		"1. WARNING in X.java (at line 6)\n" + 
29558
		"	Class<? extends Enum> enumType = null;\n" + 
29559
		"	                ^^^^\n" + 
29560
		"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
29561
		"----------\n" + 
29562
		"2. WARNING in X.java (at line 7)\n" + 
29563
		"	final Collection<E> test = allOf(enumType);\n" + 
29564
		"	                           ^^^^^^^^^^^^^^^\n" + 
29565
		"Type safety: Unchecked invocation allOf(Class<capture#1-of ? extends Enum>) of the generic method allOf(Class<E>) of type X\n" + 
29566
		"----------\n" + 
29567
		"3. ERROR in X.java (at line 7)\n" + 
29568
		"	final Collection<E> test = allOf(enumType);\n" + 
29569
		"	                           ^^^^^^^^^^^^^^^\n" + 
29570
		"Type mismatch: cannot convert from Collection<capture#1-of ? extends Enum> to Collection<E>\n" + 
29571
		"----------\n" + 
29572
		"4. WARNING in X.java (at line 9)\n" + 
29573
		"	Collection<? extends Enum> colType = null;\n" + 
29574
		"	                     ^^^^\n" + 
29575
		"Enum is a raw type. References to generic type Enum<E> should be parameterized\n" + 
29576
		"----------\n" + 
29577
		"5. ERROR in X.java (at line 10)\n" + 
29578
		"	final Collection<E> test2 = colType;\n" + 
29579
		"	                            ^^^^^^^\n" + 
29580
		"Type mismatch: cannot convert from Collection<capture#2-of ? extends Enum> to Collection<E>\n" + 
29581
		"----------\n");
29582
}
29583
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119238
29584
public void test0930() {
29585
	this.runNegativeTest(
29586
		new String[] {
29587
		"X.java",
29588
		"public class X<T> {\n" + 
29589
		"        public static int I;\n" + 
29590
		"        public void foo() {\n" + 
29591
		"                X.I= 10;\n" + 
29592
		"        }\n" + 
29593
		"		 {  Zork z; }\n" +
29594
		"}\n",
29595
		},
29596
		"----------\n" + 
29597
		"1. ERROR in X.java (at line 6)\n" + 
29598
		"	{  Zork z; }\n" + 
29599
		"	   ^^^^\n" + 
29600
		"Zork cannot be resolved to a type\n" + 
29601
		"----------\n");
29602
}
29603
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119238 - variation
29604
public void test0931() {
29605
	this.runNegativeTest(
29606
		new String[] {
29607
		"X.java",
29608
		"public class X<T> {\n" + 
29609
		"        public static int I;\n" + 
29610
		"        public void foo() {\n" + 
29611
		"                X<T>.I= 10;\n" + 
29612
		"        }\n" + 
29613
		"}\n",
29614
		},
29615
		"----------\n" + 
29616
		"1. ERROR in X.java (at line 4)\n" + 
29617
		"	X<T>.I= 10;\n" + 
29618
		"	     ^\n" + 
29619
		"Syntax error on token \"I\", VariableDeclaratorId expected after this token\n" + 
29620
		"----------\n");
29621
}
29622
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119238 - variation
29623
public void test0932() {
29624
	this.runNegativeTest(
29625
		new String[] {
29626
		"X.java",
29627
		"public class X<T> {\n" + 
29628
		"        public static int Method() { return 0; }\n" + 
29629
		"        public void foo() {\n" + 
29630
		"                X.Method();\n" + 
29631
		"        }\n" + 
29632
		"        public void bar() {\n" + 
29633
		"                X<String>.Method();\n" + 
29634
		"        }\n" + 
29635
		"}\n",
29636
		},
29637
		"----------\n" + 
29638
		"1. ERROR in X.java (at line 7)\n" + 
29639
		"	X<String>.Method();\n" + 
29640
		"	^^^^^^^^^^\n" + 
29641
		"Syntax error on token(s), misplaced construct(s)\n" + 
29642
		"----------\n");
29643
}
29644
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128063
29645
public void test0933() {
29646
	this.runNegativeTest(
29647
		new String[] {
29648
		"a/AbstractFoo.java", //================================
29649
		"package a;\n" + 
29650
		"public abstract class AbstractFoo<T extends AbstractFoo<T>> {\n" + 
29651
		"	protected static class Inner<T extends AbstractFoo<T>> {\n" + 
29652
		"		public Inner() {\n" + 
29653
		"		}\n" + 
29654
		"\n" + 
29655
		"		public final void doSmth() {\n" + 
29656
		"		}\n" + 
29657
		"	}\n" + 
29658
		"}\n",
29659
		"b/CustomFoo.java", //================================
29660
		"package b;\n" + 
29661
		"import a.AbstractFoo;\n" + 
29662
		"public final class CustomFoo extends AbstractFoo<CustomFoo> {\n" + 
29663
		"	private Inner<DefaultFoo> defaultInner;\n" + 
29664
		"\n" + 
29665
		"	Inner<DefaultFoo> getDefaultInner() {\n" + 
29666
		"		return (this.defaultInner == null)\n" + 
29667
		"				? this.defaultInner = new Inner<DefaultFoo>()\n" + 
29668
		"				: this.defaultInner;\n" + 
29669
		"	}	\n" + 
29670
		"\n" + 
29671
		"	private Inner<CustomFoo> customInner;\n" + 
29672
		"\n" + 
29673
		"	Inner<CustomFoo> getCustomInner() {\n" + 
29674
		"		return (this.customInner == null)\n" + 
29675
		"				? this.customInner = new Inner<CustomFoo>()\n" + 
29676
		"				: this.customInner;\n" + 
29677
		"	}	\n" + 
29678
		"}\n",
29679
		"b/DefaultFoo.java", //================================
29680
		"package b;\n" + 
29681
		"import a.AbstractFoo;\n" + 
29682
		"public final class DefaultFoo extends AbstractFoo<DefaultFoo> {\n" + 
29683
		"	private Inner<DefaultFoo> defaultInner;\n" + 
29684
		"\n" + 
29685
		"	Inner<DefaultFoo> getDefaultInner() {\n" + 
29686
		"		return (this.defaultInner == null)\n" + 
29687
		"				? this.defaultInner = new Inner<DefaultFoo>()\n" + 
29688
		"				: this.defaultInner;\n" + 
29689
		"	}	\n" + 
29690
		"\n" + 
29691
		"	private Inner<CustomFoo> customInner;\n" + 
29692
		"\n" + 
29693
		"	Inner<CustomFoo> getCustomInner() {\n" + 
29694
		"		return (this.customInner == null)\n" + 
29695
		"				? this.customInner = new Inner<CustomFoo>()\n" + 
29696
		"				: this.customInner;\n" + 
29697
		"	}\n" + 
29698
		"\n" + 
29699
		"	///////////////////////////////////////////////////////////////////////\n" + 
29700
		"	public void testCompilationFailure(final CustomFoo foo) {\n" + 
29701
		"		final DefaultFoo foo1 = this;\n" + 
29702
		"		final CustomFoo foo2 = foo;\n" + 
29703
		"\n" + 
29704
		"		// These get compiled w/o error:\n" + 
29705
		"		foo1.getCustomInner().doSmth();\n" + 
29706
		"		foo1.getDefaultInner().doSmth();\n" + 
29707
		"\n" + 
29708
		"		// These do not (Eclipse 3.2.0 M4):\n" + 
29709
		"		foo2.getCustomInner().doSmth();\n" + 
29710
		"		foo2.getDefaultInner().doSmth();\n" + 
29711
		"\n" + 
29712
		"		// Expect error\n" + 
29713
		"		String s11 = foo1.getCustomInner();\n" + 
29714
		"		String s12 = foo2.getDefaultInner();\n" + 
29715
		"		String s21 = foo2.getCustomInner();\n" + 
29716
		"		String s22 = foo2.getDefaultInner();\n" + 		
29717
		"\n" + 
29718
		"		// However, if we split statements, everything\'s ok: \n" + 
29719
		"		final Inner<CustomFoo> customInner2 = foo2.getCustomInner();\n" + 
29720
		"		customInner2.doSmth();\n" + 
29721
		"\n" + 
29722
		"		final Inner<DefaultFoo> defaultInner2 = foo2.getDefaultInner();\n" + 
29723
		"		defaultInner2.doSmth();\n" + 
29724
		"	}\n" + 
29725
		"}\n",
29726
		},
29727
		"----------\n" + 
29728
		"1. ERROR in b\\DefaultFoo.java (at line 34)\n" + 
29729
		"	String s11 = foo1.getCustomInner();\n" + 
29730
		"	             ^^^^^^^^^^^^^^^^^^^^^\n" + 
29731
		"Type mismatch: cannot convert from AbstractFoo.Inner<CustomFoo> to String\n" + 
29732
		"----------\n" + 
29733
		"2. ERROR in b\\DefaultFoo.java (at line 35)\n" + 
29734
		"	String s12 = foo2.getDefaultInner();\n" + 
29735
		"	             ^^^^^^^^^^^^^^^^^^^^^^\n" + 
29736
		"Type mismatch: cannot convert from AbstractFoo.Inner<DefaultFoo> to String\n" + 
29737
		"----------\n" + 
29738
		"3. ERROR in b\\DefaultFoo.java (at line 36)\n" + 
29739
		"	String s21 = foo2.getCustomInner();\n" + 
29740
		"	             ^^^^^^^^^^^^^^^^^^^^^\n" + 
29741
		"Type mismatch: cannot convert from AbstractFoo.Inner<CustomFoo> to String\n" + 
29742
		"----------\n" + 
29743
		"4. ERROR in b\\DefaultFoo.java (at line 37)\n" + 
29744
		"	String s22 = foo2.getDefaultInner();\n" + 
29745
		"	             ^^^^^^^^^^^^^^^^^^^^^^\n" + 
29746
		"Type mismatch: cannot convert from AbstractFoo.Inner<DefaultFoo> to String\n" + 
29747
		"----------\n");
29748
}
29749
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128063 - variation
29750
public void test0934() {
29751
	this.runNegativeTest(
29752
		new String[] {
29753
		"X.java", //================================
29754
		"public class X<T> {\n" + 
29755
		"	static class Inner<U> {\n" + 
29756
		"		static class InInner <V> {\n" + 
29757
		"		}\n" + 
29758
		"	}\n" + 
29759
		"}\n" + 
29760
		"class Y<W> extends X<W> {\n" + 
29761
		"	void foo() {\n" + 
29762
		"		Inner<W> inner = null;\n" + 
29763
		"		String s = inner;\n" + 
29764
		"	}\n" + 
29765
		"}\n",
29766
		},
29767
		"----------\n" + 
29768
		"1. ERROR in X.java (at line 10)\n" + 
29769
		"	String s = inner;\n" + 
29770
		"	           ^^^^^\n" + 
29771
		"Type mismatch: cannot convert from X.Inner<W> to String\n" + 
29772
		"----------\n");
29773
}
29774
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128063 - variation
29775
public void test0935() {
29776
	this.runNegativeTest(
29777
		new String[] {
29778
		"X.java", //================================
29779
		"public class X<T> {\n" + 
29780
		"	static class Inner<U> {\n" + 
29781
		"		class InInner <V> {\n" + 
29782
		"		}\n" + 
29783
		"	}\n" + 
29784
		"}\n" + 
29785
		"class Y<W> extends X<W> {\n" + 
29786
		"	void foo() {\n" + 
29787
		"		Inner<W>.InInner<W> inner = null;\n" + 
29788
		"		String s = inner;\n" + 
29789
		"	}\n" + 
29790
		"}\n",
29791
		},
29792
		"----------\n" + 
29793
		"1. ERROR in X.java (at line 10)\n" + 
29794
		"	String s = inner;\n" + 
29795
		"	           ^^^^^\n" + 
29796
		"Type mismatch: cannot convert from X.Inner<W>.InInner<W> to String\n" + 
29797
		"----------\n");
29798
}
29799
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128063 - variation
29800
public void test0936() {
29801
	this.runNegativeTest(
29802
		new String[] {
29803
		"X.java", //================================
29804
		"public class X<T> {\n" + 
29805
		"	class Inner<U> {\n" + 
29806
		"		class InInner <V> {\n" + 
29807
		"		}\n" + 
29808
		"	}\n" + 
29809
		"}\n" + 
29810
		"class Y<W> extends X<W> {\n" + 
29811
		"	void foo() {\n" + 
29812
		"		Inner<W> inner = null;\n" + 
29813
		"		String s = inner;\n" + 
29814
		"		\n" + 
29815
		"		Inner<W>.InInner<W> inner2 = null;\n" + 
29816
		"		s = inner2;\n" + 
29817
		"\n" + 
29818
		"	}\n" + 
29819
		"}\n",
29820
		},
29821
		"----------\n" + 
29822
		"1. ERROR in X.java (at line 10)\n" + 
29823
		"	String s = inner;\n" + 
29824
		"	           ^^^^^\n" + 
29825
		"Type mismatch: cannot convert from X<W>.Inner<W> to String\n" + 
29826
		"----------\n" + 
29827
		"2. ERROR in X.java (at line 13)\n" + 
29828
		"	s = inner2;\n" + 
29829
		"	    ^^^^^^\n" + 
29830
		"Type mismatch: cannot convert from X<W>.Inner<W>.InInner<W> to String\n" + 
29831
		"----------\n");
29832
}
29833
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129190 - variation
29834
public void test0937() {
29835
	this.runNegativeTest(
29836
		new String[] {
29837
		"ExtendedOuter.java", //================================
29838
		"class Outer<O> {\n" + 
29839
		"  class Inner {}\n" + 
29840
		"\n" + 
29841
		"  static void method(Outer.Inner x) {}\n" + 
29842
		"}\n" + 
29843
		"\n" + 
29844
		"public class ExtendedOuter<E> extends Outer<E> {\n" + 
29845
		"  class ExtendedInner extends Inner {\n" + 
29846
		"    {\n" + 
29847
		"      Outer.method(this);\n" + 
29848
		"    }\n" + 
29849
		"  }\n" + 
29850
		"  void foo() {\n" +
29851
		"    Zork zk;\n" + 
29852
		"  }\n" + 
29853
		"}\n",
29854
		},
29855
		"----------\n" + 
29856
		"1. WARNING in ExtendedOuter.java (at line 4)\n" + 
29857
		"	static void method(Outer.Inner x) {}\n" + 
29858
		"	                   ^^^^^^^^^^^\n" + 
29859
		"Outer.Inner is a raw type. References to generic type Outer<O>.Inner should be parameterized\n" + 
29860
		"----------\n" + 
29861
		"2. ERROR in ExtendedOuter.java (at line 14)\n" + 
29862
		"	Zork zk;\n" + 
29863
		"	^^^^\n" + 
29864
		"Zork cannot be resolved to a type\n" + 
29865
		"----------\n");
29866
}
29867
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129190 - variation
29868
public void test0938() {
29869
	this.runNegativeTest(
29870
		new String[] {
29871
		"ExtendedOuter.java", //================================
29872
		"class Outer<O> {\n" + 
29873
		"  class Inner {}\n" + 
29874
		"\n" + 
29875
		"  static void method(Outer<?>.Inner x) {}\n" + 
29876
		"}\n" + 
29877
		"\n" + 
29878
		"public class ExtendedOuter<E> extends Outer<E> {\n" + 
29879
		"  class ExtendedInner extends Inner {\n" + 
29880
		"    {\n" + 
29881
		"      Outer.method(this);\n" + 
29882
		"    }\n" + 
29883
		"  }\n" +
29884
		"  void foo() {\n" +
29885
		"    Zork zk;\n" + 
29886
		"  }\n" + 
29887
		"}\n",
29888
		},
29889
		"----------\n" + 
29890
		"1. ERROR in ExtendedOuter.java (at line 14)\n" + 
29891
		"	Zork zk;\n" + 
29892
		"	^^^^\n" + 
29893
		"Zork cannot be resolved to a type\n" + 
29894
		"----------\n");
29895
}
29896
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129190 - variation
29897
public void test0939() {
29898
	this.runNegativeTest(
29899
		new String[] {
29900
		"ExtendedOuter.java", //================================
29901
		"class Outer<O> {\n" + 
29902
		"  class Inner {}\n" + 
29903
		"\n" + 
29904
		"  static <I> void method(Outer<I>.Inner x) {}\n" + 
29905
		"}\n" + 
29906
		"\n" + 
29907
		"public class ExtendedOuter<E> extends Outer<E> {\n" + 
29908
		"  class ExtendedInner extends Inner {\n" + 
29909
		"    {\n" + 
29910
		"      Outer.method(this);\n" + 
29911
		"    }\n" + 
29912
		"  }\n" + 
29913
		"  void foo() {\n" +
29914
		"    Zork zk;\n" + 
29915
		"  }\n" + 
29916
		"}\n",
29917
		},
29918
		"----------\n" + 
29919
		"1. ERROR in ExtendedOuter.java (at line 14)\n" + 
29920
		"	Zork zk;\n" + 
29921
		"	^^^^\n" + 
29922
		"Zork cannot be resolved to a type\n" + 
29923
		"----------\n");
29924
}
29925
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
29926
public void test0940() {
29927
	this.runNegativeTest(
29928
		new String[] {
29929
		"X.java", //================================
29930
		"import java.util.*;\n" + 
29931
		"public class X {\n" + 
29932
		"        <U extends Object> void bar3(List<U> lst) {\n" + 
29933
		"            List<Object> RESULT = null;\n" + 
29934
		"            RESULT = lst; // 1\n" + 
29935
		"            RESULT = Collections.singletonList(lst.get(0)); // 2\n" + 
29936
		"    }              \n" + 
29937
		"}\n",
29938
		},
29939
		"----------\n" + 
29940
		"1. ERROR in X.java (at line 5)\n" + 
29941
		"	RESULT = lst; // 1\n" + 
29942
		"	         ^^^\n" + 
29943
		"Type mismatch: cannot convert from List<U> to List<Object>\n" + 
29944
		"----------\n" + 
29945
		"2. ERROR in X.java (at line 6)\n" + 
29946
		"	RESULT = Collections.singletonList(lst.get(0)); // 2\n" + 
29947
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
29948
		"Type mismatch: cannot convert from List<U> to List<Object>\n" + 
29949
		"----------\n");
29950
}
29951
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
29952
public void test0941() {
29953
	this.runNegativeTest(
29954
		new String[] {
29955
		"X.java", //================================
29956
		"import java.util.*;\n" + 
29957
		"\n" + 
29958
		"public class X {\n" + 
29959
		"	<T> Map<T,T> foo(T t1, T t2) {\n" + 
29960
		"		return null;\n" + 
29961
		"	}\n" + 
29962
		"	<U extends Object, V extends U> void bar(U u, V v) {\n" + 
29963
		"		Map<Object,Object> map1 = foo(u, v);\n" + 
29964
		"		Map<U,U> map2 = foo(u, v);\n" + 
29965
		"	}	\n" + 
29966
		"}\n",
29967
		},
29968
		"----------\n" + 
29969
		"1. ERROR in X.java (at line 8)\n" + 
29970
		"	Map<Object,Object> map1 = foo(u, v);\n" + 
29971
		"	                          ^^^^^^^^^\n" + 
29972
		"Type mismatch: cannot convert from Map<U,U> to Map<Object,Object>\n" + 
29973
		"----------\n");
29974
}
29975
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
29976
public void test0942() {
29977
	this.runNegativeTest(
29978
		new String[] {
29979
		"X.java", //================================
29980
		"import java.util.*;\n" + 
29981
		"\n" + 
29982
		"public class X {\n" + 
29983
		"	<T> Map<T,T> foo(T t1, T t2, T t3) {\n" + 
29984
		"		return null;\n" + 
29985
		"	}\n" + 
29986
		"	<U extends Object, V extends U> void bar(U u, V v) {\n" + 
29987
		"		Map<Object,Object> map1 = foo(u, v, null);\n" + 
29988
		"		Map<U,U> map2 = foo(u, v, null);\n" + 
29989
		"	}	\n" + 
29990
		"}\n",
29991
		},
29992
		"----------\n" + 
29993
		"1. ERROR in X.java (at line 8)\n" + 
29994
		"	Map<Object,Object> map1 = foo(u, v, null);\n" + 
29995
		"	                          ^^^^^^^^^^^^^^^\n" + 
29996
		"Type mismatch: cannot convert from Map<U,U> to Map<Object,Object>\n" + 
29997
		"----------\n");
29998
}
29999
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
30000
public void test0943() {
30001
	this.runNegativeTest(
30002
		new String[] {
30003
		"X.java", //================================
30004
		"import java.util.*;\n" + 
30005
		"\n" + 
30006
		"public class X {\n" + 
30007
		"	<T> Map<T,T> foo(T t1, T t2, T t3) {\n" + 
30008
		"		return null;\n" + 
30009
		"	}\n" + 
30010
		"	<U extends Object, V extends U> void bar(U u, V v, List<? extends V> lv) {\n" + 
30011
		"		Map<Object,Object> map1 = foo(u, v, lv.get(0));\n" + 
30012
		"		Map<U,U> map2 = foo(u, v, lv.get(0));\n" + 
30013
		"	}\n" + 
30014
		"}\n",
30015
		},
30016
		"----------\n" + 
30017
		"1. ERROR in X.java (at line 8)\n" + 
30018
		"	Map<Object,Object> map1 = foo(u, v, lv.get(0));\n" + 
30019
		"	                          ^^^^^^^^^^^^^^^^^^^^\n" + 
30020
		"Type mismatch: cannot convert from Map<U,U> to Map<Object,Object>\n" + 
30021
		"----------\n");
30022
}
30023
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129996
30024
public void test0944() {
30025
	this.runNegativeTest(
30026
		new String[] {
30027
		"X.java", //================================
30028
		"import java.util.*;\n" + 
30029
		"public class X {\n" + 
30030
		"	public static <A> Set<A> method(List<? super A> list) {\n" + 
30031
		"		return new HashSet<A>();\n" + 
30032
		"	}\n" + 
30033
		"	public static void main(String[] args) {\n" + 
30034
		"		ArrayList<Number> l = new ArrayList<Number>();\n" + 
30035
		"		Set<Integer> s1 = method(l);\n" + 
30036
		"		Set<Integer> s2 = (Set<Integer>) method(l);\n" + 
30037
		"	}\n" + 
30038
		"}\n",
30039
		},
30040
		"----------\n" + 
30041
		"1. ERROR in X.java (at line 9)\n" + 
30042
		"	Set<Integer> s2 = (Set<Integer>) method(l);\n" + 
30043
		"	                  ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
30044
		"Cannot cast from Set<Number> to Set<Integer>\n" + 
30045
		"----------\n");
30046
}
30047
public void test0945() {
30048
	this.runNegativeTest(
30049
		new String[] {
30050
		"X.java", //================================
30051
		"import java.util.*;\n" + 
30052
		"\n" + 
30053
		"public class X {\n" + 
30054
		"    public static void main(String[] args){\n" + 
30055
		"        Object[] objArray = {new Object()};\n" + 
30056
		"        ArrayList<String> strList = new ArrayList<String>();\n" + 
30057
		"        transferBug(objArray, strList);\n" + 
30058
		"        String str = strList.get(0);\n" + 
30059
		"}\n" + 
30060
		"public static <Var> void  transferBug(Var[] src, Collection<Var> dest){\n" + 
30061
		"    dest.add(src[0]);\n" + 
30062
		"}\n" + 
30063
		"}\n",
30064
		},
30065
		"----------\n" + 
30066
		"1. ERROR in X.java (at line 7)\n" + 
30067
		"	transferBug(objArray, strList);\n" + 
30068
		"	^^^^^^^^^^^\n" + 
30069
		"The method transferBug(Var[], Collection<Var>) in the type X is not applicable for the arguments (Object[], ArrayList<String>)\n" + 
30070
		"----------\n");
30071
}
30072
public void test0946() {
30073
	this.runConformTest(
30074
		new String[] {
30075
		"X.java", //================================
30076
		"public class X {\n" + 
30077
		"	public static void main(String[] args) {\n" + 
30078
		"		operate(Operations.create());\n" + 
30079
		"	}\n" + 
30080
		"	static <O extends Num<O>> void operate(Operators<O> operators) {\n" + 
30081
		"		System.out.println(operators.spawn());\n" + 
30082
		"	}\n" + 
30083
		"}\n" + 
30084
		"class Operations {\n" + 
30085
		"	static Operators<?> create() {\n" + 
30086
		"		return new IntOperators();\n" + 
30087
		"	}\n" + 
30088
		"}\n" + 
30089
		"interface Num<O> {\n" + 
30090
		"	public O spawn();\n" + 
30091
		"}\n" + 
30092
		"class Int implements Num<Int> {\n" + 
30093
		"	public Int spawn() {\n" + 
30094
		"		return new Int();\n" + 
30095
		"	}\n" + 
30096
		"  public String toString() {\n" +
30097
		"    return \"Int\";\n" +
30098
		"  }\n" +
30099
		"}\n" + 
30100
		"interface Operators<O extends Num<O>> {\n" + 
30101
		"	O spawn();\n" + 
30102
		"}\n" + 
30103
		"class IntOperators implements Operators<Int> {\n" + 
30104
		"	public Int spawn() {\n" + 
30105
		"		return new Int();\n" + 
30106
		"	}\n" + 
30107
		"}\n",
30108
		},
30109
		"Int");
30110
}
30111
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
30112
public void test0947() {
30113
	this.runNegativeTest(
30114
		new String[] {
30115
		"X.java", //================================
30116
		"import java.util.*;\n" + 
30117
		"public class X {\n" + 
30118
		"        public void bar2(Box<?> b) {\n" + 
30119
		"        	Box<Runnable> bx = box(b.element);\n" + 
30120
		"        	box(b.element).element.run();\n" + 
30121
		"        }\n" + 
30122
		"        static <U extends Runnable> Box<U> box(U u) {\n" + 
30123
		"        	return new Box<U>(u);\n" + 
30124
		"        }\n" + 
30125
		"}\n" + 
30126
		"class Box<E extends Runnable> {\n" + 
30127
		"	E element;\n" + 
30128
		"	Box(E element) {\n" + 
30129
		"		this.element = element;\n" + 
30130
		"	}\n" + 
30131
		"}\n",
30132
		},
30133
		"----------\n" + 
30134
		"1. ERROR in X.java (at line 4)\n" + 
30135
		"	Box<Runnable> bx = box(b.element);\n" + 
30136
		"	                   ^^^^^^^^^^^^^^\n" + 
30137
		"Type mismatch: cannot convert from Box<capture#1-of ?> to Box<Runnable>\n" + 
30138
		"----------\n");
30139
}
30140
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=129261 - variation
30141
public void test0948() {
30142
	this.runConformTest(
30143
		new String[] {
30144
		"X.java", //================================
30145
		"import java.util.*;\n" + 
30146
		"public class X {\n" + 
30147
		"        public void bar2(Box<?> b1, Box<Runnable> b2) {\n" + 
30148
		"        	Pair<Runnable,Runnable> blist = pair(b1.element, b2.element);\n" + 
30149
		"        }\n" + 
30150
		"        static <U> Pair<U,U> pair(U u1, U u2) {\n" + 
30151
		"        	return new Pair<U,U>(u1,u2);\n" + 
30152
		"        }\n" + 
30153
		"}\n" + 
30154
		"class Pair<E,F> {\n" + 
30155
		"	Pair(E e, F f){}\n" + 
30156
		"}\n" + 
30157
		"class Box<E extends Runnable> {\n" + 
30158
		"	E element;\n" + 
30159
		"	Box(E element) {\n" + 
30160
		"		this.element = element;\n" + 
30161
		"	}\n" + 
30162
		"}\n",
30163
		},
30164
		"");
30165
}
30166
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128418
30167
public void test0949() {
30168
	this.runNegativeTest(
30169
		new String[] {
30170
		"X.java", //================================
30171
		"import java.util.Arrays;\n" + 
30172
		"\n" + 
30173
		"public class X {\n" + 
30174
		"	public <T> Iterable<T> m(T... ts) {\n" + 
30175
		"		return Arrays.asList(ts);\n" + 
30176
		"	}\n" + 
30177
		"	public <T> void m3(Iterable<T>... ts) {\n" + 
30178
		"	}\n" + 
30179
		"	public void m2() {\n" + 
30180
		"		m3(m(3, 3, 3));\n" + 
30181
		"		m3(m());\n" + 
30182
		"		m3(m(new Object[]{}));\n" + 
30183
		"		Zork z;\n" +
30184
		"	}\n" + 
30185
		"}\n",
30186
		},
30187
		"----------\n" + 
30188
		"1. WARNING in X.java (at line 10)\n" + 
30189
		"	m3(m(3, 3, 3));\n" + 
30190
		"	^^^^^^^^^^^^^^\n" + 
30191
		"Type safety : A generic array of Iterable<Integer> is created for a varargs parameter\n" + 
30192
		"----------\n" + 
30193
		"2. WARNING in X.java (at line 11)\n" + 
30194
		"	m3(m());\n" + 
30195
		"	^^^^^^^\n" + 
30196
		"Type safety : A generic array of Iterable<Object> is created for a varargs parameter\n" + 
30197
		"----------\n" + 
30198
		"3. WARNING in X.java (at line 12)\n" + 
30199
		"	m3(m(new Object[]{}));\n" + 
30200
		"	^^^^^^^^^^^^^^^^^^^^^\n" + 
30201
		"Type safety : A generic array of Iterable<Object> is created for a varargs parameter\n" + 
30202
		"----------\n" + 
30203
		"4. ERROR in X.java (at line 13)\n" + 
30204
		"	Zork z;\n" + 
30205
		"	^^^^\n" + 
30206
		"Zork cannot be resolved to a type\n" + 
30207
		"----------\n");
30208
}
30209
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128418 - variation
30210
public void test0950() {
30211
	this.runNegativeTest(
30212
		new String[] {
30213
		"X.java", //================================
30214
		"import java.util.Arrays;\n" + 
30215
		"\n" + 
30216
		"public class X {\n" + 
30217
		"	public <T> Iterable<T> m(T[]... ts) {\n" + 
30218
		"		return Arrays.asList(ts[0]);\n" + 
30219
		"	}\n" + 
30220
		"	public <T> void m3(Iterable<T>... ts) {\n" + 
30221
		"	}\n" + 
30222
		"	public void m2() {\n" + 
30223
		"		m3(m(new Integer[]{3, 3, 3}));\n" + 
30224
		"		m3(m());\n" + 
30225
		"		m3(m(new Object[][]{}));\n" + 
30226
		"		Zork z;\n" +
30227
		"	}\n" + 
30228
		"}\n",
30229
		},
30230
		"----------\n" + 
30231
		"1. WARNING in X.java (at line 10)\n" + 
30232
		"	m3(m(new Integer[]{3, 3, 3}));\n" + 
30233
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
30234
		"Type safety : A generic array of Iterable<Object> is created for a varargs parameter\n" + 
30235
		"----------\n" + 
30236
		"2. WARNING in X.java (at line 11)\n" + 
30237
		"	m3(m());\n" + 
30238
		"	^^^^^^^\n" + 
30239
		"Type safety : A generic array of Iterable<Object> is created for a varargs parameter\n" + 
30240
		"----------\n" + 
30241
		"3. WARNING in X.java (at line 12)\n" + 
30242
		"	m3(m(new Object[][]{}));\n" + 
30243
		"	^^^^^^^^^^^^^^^^^^^^^^^\n" + 
30244
		"Type safety : A generic array of Iterable<Object> is created for a varargs parameter\n" + 
30245
		"----------\n" + 
30246
		"4. ERROR in X.java (at line 13)\n" + 
30247
		"	Zork z;\n" + 
30248
		"	^^^^\n" + 
30249
		"Zork cannot be resolved to a type\n" + 
30250
		"----------\n");
30251
}
30252
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128418 - variation
30253
public void test0951() {
30254
	this.runNegativeTest(
30255
		new String[] {
30256
		"X.java", //================================
30257
		"import java.util.Arrays;\n" + 
30258
		"\n" + 
30259
		"public class X {\n" + 
30260
		"	public <T> Iterable<T> m(T[]... ts) {\n" + 
30261
		"		return Arrays.asList(ts[0]);\n" + 
30262
		"	}\n" + 
30263
		"	public <T> void m3(Iterable<T>... ts) {\n" + 
30264
		"	}\n" + 
30265
		"	@SuppressWarnings(\"unchecked\")\n" +
30266
		"	public void m2() {\n" + 
30267
		"		m3(m(new Integer[]{3, 3, 3}));\n" + 
30268
		"		m3(m());\n" + 
30269
		"		m3(m(new Object[][]{}));\n" + 
30270
		"		Zork z;\n" +
30271
		"	}\n" + 
30272
		"}\n",
30273
		},
30274
		"----------\n" + 
30275
		"1. ERROR in X.java (at line 14)\n" + 
30276
		"	Zork z;\n" + 
30277
		"	^^^^\n" + 
30278
		"Zork cannot be resolved to a type\n" + 
30279
		"----------\n");
30280
}
30281
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=128418 - variation
30282
public void test0952() {
30283
	this.runNegativeTest(
30284
		new String[] {
30285
		"X.java", //================================
30286
		"public class X {\n" + 
30287
		"	public <T> Iterable<T> m(T... ts) {\n" + 
30288
		"		return null;\n" + 
30289
		"	}\n" + 
30290
		"	public <T> void m3(Iterable<T>... ts) {\n" + 
30291
		"	}\n" + 
30292
		"	public void m2() {\n" + 
30293
		"		m3(m(null));\n" + 
30294
		"		Zork z;\n" +
30295
		"	}\n" + 
30296
		"}\n",
30297
		},
30298
		"----------\n" + 
30299
		"1. WARNING in X.java (at line 8)\n" + 
30300
		"	m3(m(null));\n" + 
30301
		"	^^^^^^^^^^^\n" + 
30302
		"Type safety : A generic array of Iterable<Object> is created for a varargs parameter\n" + 
30303
		"----------\n" + 
30304
		"2. WARNING in X.java (at line 8)\n" + 
30305
		"	m3(m(null));\n" + 
30306
		"	   ^^^^^^^\n" + 
30307
		"The argument of type null should explicitly be cast to Object[] for the invocation of the varargs method m(Object...) from type X. It could alternatively be cast to Object for a varargs invocation\n" + 
30308
		"----------\n" + 
30309
		"3. ERROR in X.java (at line 9)\n" + 
30310
		"	Zork z;\n" + 
30311
		"	^^^^\n" + 
30312
		"Zork cannot be resolved to a type\n" + 
30313
		"----------\n");
30314
}
30315
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106325
30316
public void test0953() {
30317
	this.runNegativeTest(
30318
		new String[] {
30319
		"X.java", //================================
30320
		"import java.lang.ref.WeakReference;\n" + 
30321
		"import java.util.Arrays;\n" + 
30322
		"import java.util.List;\n" + 
30323
		"\n" + 
30324
		"public class X {\n" + 
30325
		"  void m(WeakReference<Integer> ref) {\n" + 
30326
		"    List<WeakReference<Integer>> list= Arrays.asList(ref);\n" + 
30327
		"    Zork z;\n" + 
30328
		"  }\n" + 
30329
		"}\n",
30330
		},
30331
		"----------\n" + 
30332
		"1. WARNING in X.java (at line 7)\n" + 
30333
		"	List<WeakReference<Integer>> list= Arrays.asList(ref);\n" + 
30334
		"	                                   ^^^^^^^^^^^^^^^^^^\n" + 
30335
		"Type safety : A generic array of WeakReference<Integer> is created for a varargs parameter\n" + 
30336
		"----------\n" + 
30337
		"2. ERROR in X.java (at line 8)\n" + 
30338
		"	Zork z;\n" + 
30339
		"	^^^^\n" + 
30340
		"Zork cannot be resolved to a type\n" + 
30341
		"----------\n");
30342
}
30343
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130543
30344
public void test0954() {
30345
	this.runNegativeTest(
30346
		new String[] {
30347
		"X.java", //================================
30348
		"import java.util.*;\n" + 
30349
		"\n" + 
30350
		"public class X<A,B> {\n" + 
30351
		"	class Member<C,D> {}\n" + 
30352
		"	static class SMember<U,V> {}\n" + 
30353
		"	void foo1() {\n" + 
30354
		"		X<?,?>[] xs = new X<?,?>[]{};//1\n" + 
30355
		"		for(X<?,?> x : xs) {\n" + 
30356
		"			System.out.println(x);\n" + 
30357
		"		}\n" + 
30358
		"	}\n" + 
30359
		"	void bar1() {\n" + 
30360
		"		Member<?,?>[] members = new Member<?,?>[]{};//2\n" + 
30361
		"		for(Member<?,?> m : members) {\n" + 
30362
		"			System.out.println(m);\n" + 
30363
		"		}\n" + 
30364
		"	}\n" + 
30365
		"	void bas1() {\n" + 
30366
		"		SMember<?,?>[] members = new SMember<?,?>[]{};//3\n" + 
30367
		"		for(SMember<?,?> m : members) {\n" + 
30368
		"			System.out.println(m);\n" + 
30369
		"		}\n" + 
30370
		"	}\n" + 
30371
		"	void baz1() {\n" + 
30372
		"		class Local<E,F>{}\n" + 
30373
		"		Local<?,?>[] locals = new Local<?,?>[]{};//4\n" + 
30374
		"		for(Local<?,?> l : locals) {\n" + 
30375
		"			System.out.println(l);\n" + 
30376
		"		}\n" + 
30377
		"	}\n" + 
30378
		"	void foo2() {\n" + 
30379
		"		X<?,?>[] xs = new X<?,?>[5];//5\n" + 
30380
		"		for(X<?,?> x : xs) {\n" + 
30381
		"			System.out.println(x);\n" + 
30382
		"		}\n" + 
30383
		"	}\n" + 
30384
		"	void bar2() {\n" + 
30385
		"		Member<?,?>[] members = new Member<?,?>[5];//6\n" + 
30386
		"		for(Member<?,?> m : members) {\n" + 
30387
		"			System.out.println(m);\n" + 
30388
		"		}\n" + 
30389
		"	}\n" + 
30390
		"	void bas2() {\n" + 
30391
		"		SMember<?,?>[] members = new SMember<?,?>[5];//7\n" + 
30392
		"		for(SMember<?,?> m : members) {\n" + 
30393
		"			System.out.println(m);\n" + 
30394
		"		}\n" + 
30395
		"	}\n" + 
30396
		"	void baz2() {\n" + 
30397
		"		class Local<E,F>{}\n" + 
30398
		"		Local<?,?>[] locals = new Local<?,?>[5];//8\n" + 
30399
		"		for(Local<?,?> l : locals) {\n" + 
30400
		"			System.out.println(l);\n" + 
30401
		"		}\n" + 
30402
		"	}\n" + 
30403
		"	void foo3() {\n" + 
30404
		"		X<?,?>[] xs = new X<?,?>[5];//9\n" + 
30405
		"		for(X<?,?> x : xs) {\n" + 
30406
		"			System.out.println(x);\n" + 
30407
		"		}\n" + 
30408
		"	}\n" + 
30409
		"	void bar3() {\n" + 
30410
		"		X<?,?>.Member<?,?>[] members = new X<?,?>.Member<?,?>[5];//10\n" + 
30411
		"		for(X<?,?>.Member<?,?> m : members) {\n" + 
30412
		"			System.out.println(m);\n" + 
30413
		"		}\n" + 
30414
		"	}\n" + 
30415
		"	static void baz3() {\n" + 
30416
		"		class Local<E,F>{}\n" + 
30417
		"		Local<?,?>[] locals = new Local<?,?>[5];//11\n" + 
30418
		"		for(Local<?,?> l : locals) {\n" + 
30419
		"			System.out.println(l);\n" + 
30420
		"		}\n" + 
30421
		"	}\n" + 
30422
		"}\n",
30423
		},
30424
		"----------\n" + 
30425
		"1. ERROR in X.java (at line 13)\n" + 
30426
		"	Member<?,?>[] members = new Member<?,?>[]{};//2\n" + 
30427
		"	                                         ^^\n" + 
30428
		"Cannot create a generic array of X<A,B>.Member<?,?>\n" + 
30429
		"----------\n" + 
30430
		"2. ERROR in X.java (at line 26)\n" + 
30431
		"	Local<?,?>[] locals = new Local<?,?>[]{};//4\n" + 
30432
		"	                                      ^^\n" + 
30433
		"Cannot create a generic array of Local<?,?>\n" + 
30434
		"----------\n" + 
30435
		"3. ERROR in X.java (at line 38)\n" + 
30436
		"	Member<?,?>[] members = new Member<?,?>[5];//6\n" + 
30437
		"	                        ^^^^^^^^^^^^^^^^^^\n" + 
30438
		"Cannot create a generic array of X<A,B>.Member<?,?>\n" + 
30439
		"----------\n" + 
30440
		"4. ERROR in X.java (at line 51)\n" + 
30441
		"	Local<?,?>[] locals = new Local<?,?>[5];//8\n" + 
30442
		"	                      ^^^^^^^^^^^^^^^^^\n" + 
30443
		"Cannot create a generic array of Local<?,?>\n" + 
30444
		"----------\n");
30445
}
30446
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=105049
30447
public void test0955() {
30448
	this.runNegativeTest(
30449
		new String[] {
30450
		"X.java", //================================
30451
		"import java.util.List;\n" + 
30452
		"public class X<E> {\n" + 
30453
		"    void method(Object o) {\n" + 
30454
		"        if (o instanceof List<E>[]) { //incorrect: bug 104695\n" + 
30455
		"            List<E>[] es= (List<E>[]) o; //unchecked\n" + 
30456
		"        }\n" + 
30457
		"    }\n" + 
30458
		"}\n",
30459
		},
30460
		"----------\n" + 
30461
		"1. ERROR in X.java (at line 4)\n" + 
30462
		"	if (o instanceof List<E>[]) { //incorrect: bug 104695\n" + 
30463
		"	    ^^^^^^^^^^^^^^^^^^^^^^\n" + 
30464
		"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" + 
30465
		"----------\n" + 
30466
		"2. WARNING in X.java (at line 5)\n" + 
30467
		"	List<E>[] es= (List<E>[]) o; //unchecked\n" + 
30468
		"	              ^^^^^^^^^^^^^\n" + 
30469
		"Type safety: Unchecked cast from Object to List<E>[]\n" + 
30470
		"----------\n");
30471
}
30472
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130128
30473
public void test0956() {
30474
	this.runConformTest(
30475
		new String[] {
30476
		"X.java", //================================
30477
		"public class X<F> {\n" + 
30478
		"\n" + 
30479
		"    public void printNickname(Person<F> person) {\n" + 
30480
		"        Person<F>.Nickname nickname = person.getNickname();\n" + 
30481
		"        System.out.println(nickname);\n" + 
30482
		"    }\n" + 
30483
		"\n" + 
30484
		"    static class Person<E> {\n" + 
30485
		"        private Nickname nickname;\n" + 
30486
		"\n" + 
30487
		"        public Nickname getNickname() {\n" + 
30488
		"            return nickname;\n" + 
30489
		"        }\n" + 
30490
		"\n" + 
30491
		"        public void setNickname(Nickname nickname) {\n" + 
30492
		"            this.nickname = nickname;\n" + 
30493
		"        }\n" + 
30494
		"\n" + 
30495
		"        class Nickname {\n" + 
30496
		"            private String name;\n" + 
30497
		"            private boolean insulting;\n" + 
30498
		"        }\n" + 
30499
		"    }\n" + 
30500
		"}\n",
30501
		},
30502
		"");
30503
}
30504
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=132348
30505
public void test0957() {
30506
	this.runNegativeTest(
30507
		new String[] {
30508
		"AnyInterface.java", //================================
30509
		"public interface AnyInterface {\n" + 
30510
		"        public void doSomething();\n" + 
30511
		"}",
30512
		"UsingGenericsClass",
30513
		"public class UsingGenericsClass<A,B extends A & AnyInterface> {\n" + 
30514
		"        public UsingGenericsClass(){\n" + 
30515
		"        }\n" + 
30516
		"}"
30517
		},
30518
		"----------\n" + 
30519
		"1. ERROR in UsingGenericsClass (at line 1)\n" + 
30520
		"	public class UsingGenericsClass<A,B extends A & AnyInterface> {\n" + 
30521
		"	                                                ^^^^^^^^^^^^\n" + 
30522
		"Cannot specify any additional bound AnyInterface when first bound is a type parameter\n" + 
30523
		"----------\n");
30524
}
30525
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=131935
30526
public void test0958() {
30527
	this.runNegativeTest(
30528
		new String[] {
30529
		"X.java", //================================
30530
		"import java.lang.ref.ReferenceQueue;\n" + 
30531
		"import java.lang.ref.SoftReference;\n" + 
30532
		"import java.util.Hashtable;\n" + 
30533
		"\n" + 
30534
		"public class X {\n" + 
30535
		"	private static final Hashtable<Integer, Soft> cache = new Hashtable<Integer, Soft>();\n" + 
30536
		"\n" + 
30537
		"	private static final ReferenceQueue<String> trash = new ReferenceQueue<String>();\n" + 
30538
		"\n" + 
30539
		"	private static final class Soft extends SoftReference<String> {\n" + 
30540
		"		int key;\n" + 
30541
		"\n" + 
30542
		"		Soft() {\n" + 
30543
		"			super(null);\n" + 
30544
		"		}\n" + 
30545
		"	}\n" + 
30546
		"\n" + 
30547
		"	final Thread clean = new Thread(\"BigTableModel cleaner\") {\n" + 
30548
		"		@Override\n" + 
30549
		"		public void run() {\n" + 
30550
		"			for (;;)\n" + 
30551
		"				try {\n" + 
30552
		"					cache.remove(((Soft) trash.remove()).key);\n" + 
30553
		"				} catch (final InterruptedException e) {\n" + 
30554
		"					return;\n" + 
30555
		"				}\n" + 
30556
		"				Zork z;\n" +
30557
		"		}\n" + 
30558
		"	};\n" + 
30559
		"}\n"
30560
		},
30561
		"----------\n" + 
30562
		"1. ERROR in X.java (at line 27)\n" + 
30563
		"	Zork z;\n" + 
30564
		"	^^^^\n" + 
30565
		"Zork cannot be resolved to a type\n" + 
30566
		"----------\n");
30567
}
30568
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=133803
30569
public void _test0959() {
30570
	this.runNegativeTest(
30571
		new String[] {
30572
			"X.java", //================================
30573
			"import java.lang.ref.*;\n" + 
30574
			"\n" + 
30575
			"class Soft extends SoftReference<String> {\n" + 
30576
			"    Soft() { super(null); }\n" + 
30577
			"}\n" + 
30578
			"\n" + 
30579
			"class Bug {\n" + 
30580
			"    void m(Reference<? extends Number> remove) {\n" + 
30581
			"        Soft soft= (Soft) remove;\n" + 
30582
			"    }\n" + 
30583
			"}\n"
30584
		},
30585
		"----------\n" + 
30586
		"1. ERROR in X.java (at line 9)\n" + 
30587
		"	Soft soft= (Soft) remove;\n" + 
30588
		"	           ^^^^^^^^^^^^^\n" + 
30589
		"Cannot cast from Reference<capture-of ? extends Number> to Soft\n" + 
30590
		"----------\n");
30591
}
30592
30593
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118273
30594
public void test0960() {
30595
	this.runNegativeTest(
30596
		new String[] {
30597
			"X.java", //================================
30598
			"public class X<A> {\n" + 
30599
			"        <B extends Comparable<B>> X<B> newInstance() {\n" + 
30600
			"                return new X<B>();\n" + 
30601
			"        }\n" + 
30602
			"\n" + 
30603
			"        X<String>[] bugDemo() {\n" + 
30604
			"                X x = newInstance();\n" + 
30605
			"                return new X[] { x };\n" + 
30606
			"        }\n" + 
30607
			"    Zork z;\n" + 
30608
			"}\n"
30609
		},
30610
		"----------\n" + 
30611
		"1. WARNING in X.java (at line 7)\n" + 
30612
		"	X x = newInstance();\n" + 
30613
		"	^\n" + 
30614
		"X is a raw type. References to generic type X<A> should be parameterized\n" + 
30615
		"----------\n" + 
30616
		"2. WARNING in X.java (at line 8)\n" + 
30617
		"	return new X[] { x };\n" + 
30618
		"	       ^^^^^^^^^^^^^\n" + 
30619
		"Type safety: The expression of type X[] needs unchecked conversion to conform to X<String>[]\n" + 
30620
		"----------\n" + 
30621
		"3. ERROR in X.java (at line 10)\n" + 
30622
		"	Zork z;\n" + 
30623
		"	^^^^\n" + 
30624
		"Zork cannot be resolved to a type\n" + 
30625
		"----------\n");
30626
}
30627
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118273 - variation
30628
public void test0961() {
30629
	this.runNegativeTest(
30630
		new String[] {
30631
			"X.java", //================================
30632
			"public class X<A> {\n" + 
30633
			"    <B extends Comparable<B>> B newInstance2(X<B> xb) {\n" + 
30634
			"            return null;\n" + 
30635
			"    }\n" + 
30636
			"    void foo() {\n" + 
30637
			"        X x = new X();\n" + 
30638
			"        Comparable c = newInstance2(x);\n" + 
30639
			"    }\n" + 
30640
			"    Zork z;\n" + 
30641
			"}\n"
30642
		},
30643
		"----------\n" + 
30644
		"1. WARNING in X.java (at line 6)\n" + 
30645
		"	X x = new X();\n" + 
30646
		"	^\n" + 
30647
		"X is a raw type. References to generic type X<A> should be parameterized\n" + 
30648
		"----------\n" + 
30649
		"2. WARNING in X.java (at line 6)\n" + 
30650
		"	X x = new X();\n" + 
30651
		"	          ^\n" + 
30652
		"X is a raw type. References to generic type X<A> should be parameterized\n" + 
30653
		"----------\n" + 
30654
		"3. WARNING in X.java (at line 7)\n" + 
30655
		"	Comparable c = newInstance2(x);\n" + 
30656
		"	^^^^^^^^^^\n" + 
30657
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
30658
		"----------\n" + 
30659
		"4. WARNING in X.java (at line 7)\n" + 
30660
		"	Comparable c = newInstance2(x);\n" + 
30661
		"	               ^^^^^^^^^^^^^^^\n" + 
30662
		"Type safety: Unchecked invocation newInstance2(X) of the generic method newInstance2(X<B>) of type X<A>\n" + 
30663
		"----------\n" + 
30664
		"5. WARNING in X.java (at line 7)\n" + 
30665
		"	Comparable c = newInstance2(x);\n" + 
30666
		"	                            ^\n" + 
30667
		"Type safety: The expression of type X needs unchecked conversion to conform to X<B>\n" + 
30668
		"----------\n" + 
30669
		"6. ERROR in X.java (at line 9)\n" + 
30670
		"	Zork z;\n" + 
30671
		"	^^^^\n" + 
30672
		"Zork cannot be resolved to a type\n" + 
30673
		"----------\n");
30674
}
30675
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=134645
30676
public void test0962() {
30677
	this.runNegativeTest(
30678
		new String[] {
30679
			"X.java", //================================
30680
			"public class X<T> {\n" + 
30681
			"    public void bug() throws Exception {\n" + 
30682
			"        throw new Exception(\"Bug134645\") {\n" + 
30683
			"            @Override\n" + 
30684
			"            public String toString() {\n" + 
30685
			"                return \"Bug134645\";\n" + 
30686
			"            }\n" + 
30687
			"        };\n" + 
30688
			"    }\n" + 
30689
			"}\n"
30690
		},
30691
		"----------\n" + 
30692
		"1. ERROR in X.java (at line 3)\n" + 
30693
		"	throw new Exception(\"Bug134645\") {\n" + 
30694
		"	          ^^^^^^^^^\n" + 
30695
		"The generic class new Exception(){} may not subclass java.lang.Throwable\n" + 
30696
		"----------\n" + 
30697
		"2. WARNING in X.java (at line 3)\n" + 
30698
		"	throw new Exception(\"Bug134645\") {\n" + 
30699
		"	          ^^^^^^^^^^^^^^^^^^^^^^\n" + 
30700
		"The serializable class  does not declare a static final serialVersionUID field of type long\n" + 
30701
		"----------\n");
30702
}
30703
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=134645 - variation
30704
public void test0963() {
30705
	this.runConformTest(
30706
		new String[] {
30707
			"X.java", //================================
30708
			"public class X {\n" + 
30709
			"    public void bug() throws Exception {\n" + 
30710
			"        throw new Exception(\"Bug134645\") {\n" + 
30711
			"            @Override\n" + 
30712
			"            public String toString() {\n" + 
30713
			"                return \"Bug134645\";\n" + 
30714
			"            }\n" + 
30715
			"        };\n" + 
30716
			"    }\n" + 
30717
			"}\n"
30718
		},
30719
		"");
30720
}
30721
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=134645 - variation
30722
public void test0964() {
30723
	this.runConformTest(
30724
		new String[] {
30725
			"X.java", //================================
30726
			"public class X<T> {\n" + 
30727
			"    public static void bug() throws Exception {\n" + 
30728
			"        throw new Exception(\"Bug134645\") {\n" + 
30729
			"            @Override\n" + 
30730
			"            public String toString() {\n" + 
30731
			"                return \"Bug134645\";\n" + 
30732
			"            }\n" + 
30733
			"        };\n" + 
30734
			"    }\n" + 
30735
			"}\n"
30736
		},
30737
		"");
30738
}
30739
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=97494
30740
public void test0965() {
30741
	this.runNegativeTest(
30742
		new String[] {
30743
			"X.java", //================================
30744
			"public class X<T> {\n" + 
30745
			"  protected static final Class<X<?>> theClass = (Class<X<?>>) X.class;\n" + 
30746
			"  void foo(Class<X> cx) {\n" + 
30747
			"	  Class<X<?>> cx1 = cx;\n" + 
30748
			"	  Class<X<?>> cx2 = (Class<X<?>>) cx;\n" + 
30749
			"  }\n" + 
30750
			"}\n"
30751
		},
30752
		"----------\n" + 
30753
		"1. ERROR in X.java (at line 2)\n" + 
30754
		"	protected static final Class<X<?>> theClass = (Class<X<?>>) X.class;\n" + 
30755
		"	                                              ^^^^^^^^^^^^^^^^^^^^^\n" + 
30756
		"Cannot cast from Class<X> to Class<X<?>>\n" + 
30757
		"----------\n" + 
30758
		"2. WARNING in X.java (at line 3)\n" + 
30759
		"	void foo(Class<X> cx) {\n" + 
30760
		"	               ^\n" + 
30761
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
30762
		"----------\n" + 
30763
		"3. ERROR in X.java (at line 4)\n" + 
30764
		"	Class<X<?>> cx1 = cx;\n" + 
30765
		"	                  ^^\n" + 
30766
		"Type mismatch: cannot convert from Class<X> to Class<X<?>>\n" + 
30767
		"----------\n" + 
30768
		"4. ERROR in X.java (at line 5)\n" + 
30769
		"	Class<X<?>> cx2 = (Class<X<?>>) cx;\n" + 
30770
		"	                  ^^^^^^^^^^^^^^^^\n" + 
30771
		"Cannot cast from Class<X> to Class<X<?>>\n" + 
30772
		"----------\n");
30773
}
30774
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115918
30775
public void test0966() {
30776
	this.runConformTest(
30777
		new String[] {
30778
			"Child.java", //================================
30779
			"public class Child extends Parent implements Comparable<Child> {\n" + 
30780
			"  public int compareTo(Child o) { return 0; }\n" + 
30781
			"}\n" + 
30782
			"class Parent extends Base<Child> {}\n" + 
30783
			"class Base<T extends Base> {}\n"
30784
		},
30785
		"");
30786
}
30787
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=81949
30788
public void test0967() {
30789
	this.runConformTest(
30790
		new String[] {
30791
			"CSS.java", //================================
30792
			"interface Ac<S extends St<S,A>,A extends Ac<S,A>> {}\n" + 
30793
			"interface St<S extends St<S,A>,A extends Ac<S,A>> {}\n" + 
30794
			"class CSN<X, Y> extends CSS<X, Y> implements Ac<CSS<X, Y>, CSN<X, Y>> {}\n" + 
30795
			"public class CSS<X, Y> implements St<CSS<X, Y>, CSN<X, Y>> {}\n"
30796
		},
30797
		"");
30798
}
30799
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=108045
30800
public void test0968() {
30801
	this.runNegativeTest(
30802
		new String[] {
30803
			"X.java", //================================
30804
			"import java.util.*;\n" + 
30805
			"public class X<T0> extends ArrayList<T0> implements I<T0> {\n" + 
30806
			"}\n" + 
30807
			"interface I<T1> extends Collection {\n" + 
30808
			"}\n"
30809
		},
30810
		"----------\n" + 
30811
		"1. ERROR in X.java (at line 2)\n" + 
30812
		"	public class X<T0> extends ArrayList<T0> implements I<T0> {\n" + 
30813
		"	             ^\n" + 
30814
		"The interface Collection cannot be implemented more than once with different arguments: Collection<T0> and Collection\n" + 
30815
		"----------\n" + 
30816
		"2. WARNING in X.java (at line 2)\n" + 
30817
		"	public class X<T0> extends ArrayList<T0> implements I<T0> {\n" + 
30818
		"	             ^\n" + 
30819
		"The serializable class X does not declare a static final serialVersionUID field of type long\n" + 
30820
		"----------\n" + 
30821
		"3. WARNING in X.java (at line 4)\n" + 
30822
		"	interface I<T1> extends Collection {\n" + 
30823
		"	                        ^^^^^^^^^^\n" + 
30824
		"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
30825
		"----------\n");
30826
}
30827
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=133071
30828
public void test0969() {
30829
	this.runConformTest(
30830
			new String[] {
30831
				"B.java", //================================
30832
				"class B<T extends C> extends A<T> {}\n" + 
30833
				"class C extends B<C> {}\n" + 
30834
				"class A<T extends C> {}"
30835
			},
30836
			"");
30837
}
30838
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=136946
30839
public void test0970() {
30840
	this.runNegativeTest(
30841
			new String[] {
30842
				"X.java", //================================
30843
				"public interface X<T> { \n" + 
30844
				"        interface I1<T> extends X<T> {\n" + 
30845
				"                interface I2<T> extends I1<T> {\n" + 
30846
				"                }\n" + 
30847
				"\n" + 
30848
				"                interface I3<T> extends I1<T> {\n" + 
30849
				"                }\n" + 
30850
				"\n" + 
30851
				"                interface I4<T> extends I1.I2<T>, I1.I3<T> {    \n" + 
30852
				"                }\n" + 
30853
				"        }\n" + 
30854
				"}\n" + 
30855
				"class XSub<E> implements X<E> {\n" + 
30856
				"    I1<E> i1 = null;\n" + 
30857
				"    I1.I2<E> i2 = null;\n" + 
30858
				"    I1<E>.I2<E> i1i2 = null;\n" + 
30859
				"}\n"
30860
			},
30861
			"----------\n" + 
30862
			"1. ERROR in X.java (at line 16)\n" + 
30863
			"	I1<E>.I2<E> i1i2 = null;\n" + 
30864
			"	^^^^^^^^\n" + 
30865
			"The member type X.I1<E>.I2 cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X.I1<E>\n" + 
30866
			"----------\n");
30867
}
30868
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=136946 - variation
30869
public void test0971() {
30870
	this.runNegativeTest(
30871
			new String[] {
30872
				"X.java", //================================
30873
				"public interface X<T> { \n" + 
30874
				"        interface I1<T> extends X {\n" + 
30875
				"                interface I2<T> extends I1 {\n" + 
30876
				"                }\n" + 
30877
				"\n" + 
30878
				"                interface I3<T> extends I1 {\n" + 
30879
				"                }\n" + 
30880
				"\n" + 
30881
				"                interface I4<T> extends I1.I2, I1.I3 {    \n" + 
30882
				"                }\n" + 
30883
				"        }\n" + 
30884
				"}\n" + 
30885
				"class XSub<E> implements X<E> {\n" + 
30886
				"    I1 i1 = null;\n" + 
30887
				"    I1.I2 i2 = null;\n" + 
30888
				"    I1<E>.I2 i1i2 = null;\n" + 
30889
				"}\n"
30890
			},
30891
			"----------\n" + 
30892
			"1. WARNING in X.java (at line 2)\n" + 
30893
			"	interface I1<T> extends X {\n" + 
30894
			"	                        ^\n" + 
30895
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
30896
			"----------\n" + 
30897
			"2. WARNING in X.java (at line 3)\n" + 
30898
			"	interface I2<T> extends I1 {\n" + 
30899
			"	                        ^^\n" + 
30900
			"X.I1 is a raw type. References to generic type X<T>.I1<T> should be parameterized\n" + 
30901
			"----------\n" + 
30902
			"3. WARNING in X.java (at line 6)\n" + 
30903
			"	interface I3<T> extends I1 {\n" + 
30904
			"	                        ^^\n" + 
30905
			"X.I1 is a raw type. References to generic type X<T>.I1<T> should be parameterized\n" + 
30906
			"----------\n" + 
30907
			"4. WARNING in X.java (at line 9)\n" + 
30908
			"	interface I4<T> extends I1.I2, I1.I3 {    \n" + 
30909
			"	                        ^^^^^\n" + 
30910
			"X.I1.I2 is a raw type. References to generic type X<T>.I1<T>.I2<T> should be parameterized\n" + 
30911
			"----------\n" + 
30912
			"5. WARNING in X.java (at line 9)\n" + 
30913
			"	interface I4<T> extends I1.I2, I1.I3 {    \n" + 
30914
			"	                               ^^^^^\n" + 
30915
			"X.I1.I3 is a raw type. References to generic type X<T>.I1<T>.I3<T> should be parameterized\n" + 
30916
			"----------\n" + 
30917
			"6. WARNING in X.java (at line 14)\n" + 
30918
			"	I1 i1 = null;\n" + 
30919
			"	^^\n" + 
30920
			"X.I1 is a raw type. References to generic type X<T>.I1<T> should be parameterized\n" + 
30921
			"----------\n" + 
30922
			"7. WARNING in X.java (at line 15)\n" + 
30923
			"	I1.I2 i2 = null;\n" + 
30924
			"	^^^^^\n" + 
30925
			"X.I1.I2 is a raw type. References to generic type X<T>.I1<T>.I2<T> should be parameterized\n" + 
30926
			"----------\n" + 
30927
			"8. ERROR in X.java (at line 16)\n" + 
30928
			"	I1<E>.I2 i1i2 = null;\n" + 
30929
			"	^^^^^^^^\n" + 
30930
			"The member type X.I1<E>.I2 cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type X.I1<E>\n" + 
30931
			"----------\n");
30932
}
30933
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=137203
30934
// simulate incremental compile
30935
public void test0972() {
30936
	this.runConformTest(
30937
			new String[] {
30938
				"Outer.java", //================================
30939
				"//Outer.java\n" + 
30940
				"public class Outer<O> {\n" + 
30941
				"  public class Inner {}\n" + 
30942
				"\n" + 
30943
				"  public static void method(Outer<?>.Inner x) {\n" + 
30944
				"    System.out.println(\"SUCCESS\");\n" +
30945
				"  }\n" + 
30946
				"  public static void main(String[] args) {\n" + 
30947
				"    Outer<?>.Inner x = null;\n" +
30948
				"    method(x);\n" +
30949
				"  }\n" + 
30950
				"}\n" + 
30951
				"\n",
30952
				"ExtendedOuter.java", //================================
30953
				"public class ExtendedOuter<E> extends Outer<E> {\n" + 
30954
				"  class ExtendedInner extends Inner {\n" + 
30955
				"    {\n" + 
30956
				"      Outer.method(this);\n" + 
30957
				"    }\n" + 
30958
				"  }\n" + 
30959
				"}\n"
30960
			},
30961
			"SUCCESS");
30962
	this.runConformTest(
30963
			new String[] {
30964
				"Outer.java", //================================
30965
				"//Outer.java\n" + 
30966
				"public class Outer<O> {\n" + 
30967
				"  public class Inner {}\n" + 
30968
				"\n" + 
30969
				"  public static void method(Outer.Inner x) {\n" + 
30970
				"    System.out.println(\"SUCCESS\");\n" +
30971
				"  }\n" + 
30972
				"  public static void main(String[] args) {\n" + 
30973
				"    Outer.Inner x = null;\n" +
30974
				"    method(x);\n" +
30975
				"  }\n" + 
30976
				"}\n" + 
30977
				"\n",
30978
			},
30979
			"SUCCESS",
30980
			null,
30981
			false,
30982
			null);
30983
	this.runConformTest(
30984
			new String[] {
30985
					"ExtendedOuter.java", //================================
30986
					"public class ExtendedOuter<E> extends Outer<E> {\n" + 
30987
					"  class ExtendedInner extends Inner {\n" + 
30988
					"    {\n" + 
30989
					"      Outer.method(this);\n" + 
30990
					"    }\n" + 
30991
					"  }\n" + 
30992
					"  public static void main(String[] args) {\n" + 
30993
					"    System.out.println(\"SUCCESS\");\n" +
30994
					"  }\n" + 
30995
					"}\n"
30996
30997
			},
30998
			"SUCCESS",
30999
			null,
31000
			false,
31001
			null);
31002
}
31003
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=137203 - variation
31004
//pure source scenario
31005
public void test0973() {
31006
	this.runConformTest(
31007
			new String[] {
31008
				"Outer.java", //================================
31009
				"//Outer.java\n" + 
31010
				"public class Outer<O> {\n" + 
31011
				"  public class Inner {}\n" + 
31012
				"\n" + 
31013
				"  public static void method(Outer.Inner x) {\n" + 
31014
				"    System.out.println(\"SUCCESS\");\n" +
31015
				"  }\n" + 
31016
				"  public static void main(String[] args) {\n" + 
31017
				"    Outer.Inner x = null;\n" +
31018
				"    method(x);\n" +
31019
				"  }\n" + 
31020
				"}\n" + 
31021
				"\n",
31022
				"ExtendedOuter.java", //================================
31023
				"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31024
				"  class ExtendedInner extends Inner {\n" + 
31025
				"    {\n" + 
31026
				"      Outer.method(this);\n" + 
31027
				"    }\n" + 
31028
				"  }\n" + 
31029
				"}\n"
31030
			},
31031
			"SUCCESS");
31032
}
31033
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=137203 - variation
31034
//simulate incremental compile
31035
public void test0974() {
31036
	this.runConformTest(
31037
			new String[] {
31038
				"Outer.java", //================================
31039
				"//Outer.java\n" + 
31040
				"public class Outer<O> {\n" + 
31041
				"  public class Inner {}\n" + 
31042
				"\n" + 
31043
				"  public static void method(Outer.Inner x) {\n" + 
31044
				"    System.out.println(\"SUCCESS\");\n" +
31045
				"  }\n" + 
31046
				"  public static void main(String[] args) {\n" + 
31047
				"    Outer.Inner x = null;\n" +
31048
				"    method(x);\n" +
31049
				"  }\n" + 
31050
				"}\n" + 
31051
				"\n",
31052
				"ExtendedOuter.java", //================================
31053
				"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31054
				"  class ExtendedInner extends Inner {\n" + 
31055
				"    {\n" + 
31056
				"      Outer.method(this);\n" + 
31057
				"    }\n" + 
31058
				"  }\n" + 
31059
				"}\n"
31060
			},
31061
			"SUCCESS");
31062
	this.runConformTest(
31063
			new String[] {
31064
					"ExtendedOuter.java", //================================
31065
					"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31066
					"  class ExtendedInner extends Inner {\n" + 
31067
					"    {\n" + 
31068
					"		Outer.Inner in;\n" +
31069
					"      Outer.method(this);\n" + 
31070
					"    }\n" + 
31071
					"  }\n" + 
31072
					"  public static void main(String[] args) {\n" + 
31073
					"    System.out.println(\"SUCCESS\");\n" +
31074
					"  }\n" + 
31075
					"}\n"
31076
31077
			},
31078
			"SUCCESS",
31079
			null,
31080
			false,
31081
			null);
31082
}
31083
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122999
31084
public void test0975() {
31085
	this.runNegativeTest(
31086
			new String[] {
31087
				"X.java", //================================
31088
				"import java.util.ArrayList;\n" + 
31089
				"\n" + 
31090
				"public class X extends ArrayList<Bean> {\n" + 
31091
				"   public static class Bean {}\n" + 
31092
				"}", // =================
31093
			},
31094
			"----------\n" + 
31095
			"1. ERROR in X.java (at line 3)\n" + 
31096
			"	public class X extends ArrayList<Bean> {\n" + 
31097
			"	                                 ^^^^\n" + 
31098
			"Bean cannot be resolved to a type\n" + 
31099
			"----------\n");
31100
}
31101
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139525
31102
public void test0976() {
31103
	this.runConformTest(
31104
			new String[] {
31105
					"S.java", // =================
31106
					"import java.util.Collection;\n" + 
31107
					"public class S {\n" + 
31108
					"        public static void cow(IDA<?, ?, ?, ?, ?, ?> s) {\n" + 
31109
					"                Collection<IDA.Enum1> ids = s.getIds();  // Error here\n" + 
31110
					"        }\n" + 
31111
					"		public static void main(String[] args) {\n" +
31112
					"			System.out.println(\"SUCCESS\");\n" +
31113
					"        }\n" + 
31114
					"}\n", // =================
31115
					"ID.java", // =================
31116
					"import java.util.Collection;\n" + 
31117
					"public interface ID {\n" + 
31118
					"        Collection<? extends Comparable<?>> getIds();\n" + 
31119
					"}\n", // =================
31120
					"IDA.java", // =================
31121
					"import java.util.Collection;\n" + 
31122
					"public interface IDA<T1, C1, E1, E2, C2, T2> extends ID {\n" + 
31123
					"        enum Enum1 {\n" + 
31124
					"                ONE, TWO\n" + 
31125
					"        }\n" + 
31126
					"        Collection<IDA.Enum1> getIds();\n" + 
31127
					"}\n", // =================
31128
			},
31129
			"SUCCESS");
31130
	this.runConformTest(
31131
			new String[] {
31132
					"S.java", // =================
31133
					"import java.util.Collection;\n" + 
31134
					"public class S {\n" + 
31135
					"        public static void cow(IDA<?, ?, ?, ?, ?, ?> s) {\n" + 
31136
					"                Collection<IDA.Enum1> ids = s.getIds();  // Error here\n" + 
31137
					"        }\n" + 
31138
					"		public static void main(String[] args) {\n" +
31139
					"			System.out.println(\"SUCCESS2\");\n" +
31140
					"        }\n" + 
31141
					"}\n", // =================
31142
			},
31143
			"SUCCESS2",
31144
			null,
31145
			false,
31146
			null);
31147
}
31148
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139619
31149
public void test0977() {
31150
	this.runConformTest(
31151
			new String[] {
31152
					"MMTPProtocol.java", // =================
31153
					"import java.io.InputStream;\n" + 
31154
					"import java.util.HashSet;\n" + 
31155
					"import bug.ProtocolManager;\n" + 
31156
					"abstract class AbstractProtocol<R, O> implements ProtocolManager<R, O> {\n" + 
31157
					"    public AbstractProtocol(HashSet<O> manager, String grp) {}\n" + 
31158
					"    AbstractProtocol(){} \n" + 
31159
					"     public void connect(ConnectType type) { }\n" + 
31160
					"}\n" +
31161
					"public abstract class MMTPProtocol extends AbstractProtocol<InputStream, String> {\n" + 
31162
					"    public void connect(ConnectType type) {}\n" + 
31163
					"}\n", // =================
31164
					"bug/ProtocolManager.java", // =================
31165
					"package bug;\n" + 
31166
					"public interface ProtocolManager<R, O>{\n" + 
31167
					"    public enum ConnectType {Client,Server}\n" + 
31168
					"    public void connect(ConnectType type) ;\n" + 
31169
					"    public boolean receive(R input) throws Exception;\n" + 
31170
					"}", // =================
31171
			},
31172
			"");
31173
	this.runConformTest(
31174
			new String[] {
31175
					"MMTPProtocol.java", // =================
31176
					"import java.io.InputStream;\n" + 
31177
					"import java.util.HashSet;\n" + 
31178
					"import bug.ProtocolManager;\n" + 
31179
					"abstract class AbstractProtocol<R, O> implements ProtocolManager<R, O> {\n" + 
31180
					"    public AbstractProtocol(HashSet<O> manager, String grp) {}\n" + 
31181
					"    AbstractProtocol(){} \n" + 
31182
					"     public void connect(ConnectType type) { }\n" + 
31183
					"}\n" +
31184
					"public abstract class MMTPProtocol extends AbstractProtocol<InputStream, String> {\n" + 
31185
					"    public void connect(ConnectType type) {}\n" + 
31186
					"}\n", // =================
31187
			},
31188
			"",
31189
			null,
31190
			false,
31191
			null);
31192
}
31193
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139669
31194
public void test0978() {
31195
	this.runConformTest(
31196
			new String[] {
31197
					"B.java", // =================
31198
					"public class B<T> implements A<T> {\n" + 
31199
					"  public void foo(A.C c) {}\n" + 
31200
					"}", // =================
31201
					"A.java", // =================
31202
					"public interface A<T> {\n" + 
31203
					"  void foo(A.C c);\n" + 
31204
					"  class C {}\n" + 
31205
					"}", // =================
31206
			},
31207
			"");
31208
	this.runConformTest(
31209
			new String[] {
31210
					"A.java", // =================
31211
					"public interface A<T> {\n" + 
31212
					"  void foo(A.C c);\n" + 
31213
					"  class C {}\n" + 
31214
					"}", // =================
31215
			},
31216
			"",
31217
			null,
31218
			false,
31219
			null);
31220
}
31221
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=139669
31222
public void test0979() {
31223
	this.runConformTest(
31224
			new String[] {
31225
					"B.java", // =================
31226
					"public class B<T> extends A<T> {\n" + 
31227
					"  @Override\n" +
31228
					"  public void foo(A.C c) {}\n" + 
31229
					"}", // =================
31230
					"A.java", // =================
31231
					"public class A<T> {\n" + 
31232
					"  public void foo(A.C c) {}\n" + 
31233
					"  public static class C {}\n" + 
31234
					"}", // =================
31235
			},
31236
			"");
31237
	this.runConformTest(
31238
			new String[] {
31239
					"A.java", // =================
31240
					"public class A<T> {\n" + 
31241
					"  public void foo(A.C c) {}\n" + 
31242
					"  public static class C {}\n" + 
31243
					"}", // =================
31244
			},
31245
			"",
31246
			null,
31247
			false,
31248
			null);
31249
}
31250
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140772
31251
public void test0980() {
31252
	this.runConformTest(
31253
			new String[] {
31254
					"X.java", // =================
31255
					"import java.util.Collections;\n" + 
31256
					"import java.util.Set;\n" + 
31257
					"\n" + 
31258
					"public class X {\n" + 
31259
					"        public Set<Object> keySet() {\n" + 
31260
					"                return Collections.<Object> emptySet();\n" + 
31261
					"        }\n" + 
31262
					"}", // =================
31263
			},
31264
			"");
31265
}
31266
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140569
31267
//simulate incremental compile
31268
public void test0981() {
31269
	this.runConformTest(
31270
			new String[] {
31271
				"Outer.java", //================================
31272
				"//Outer.java\n" + 
31273
				"public class Outer<O> {\n" + 
31274
				"  public class Inner {}\n" + 
31275
				"\n" + 
31276
				"  public static void main(String[] args) {\n" + 
31277
				"    System.out.println(\"SUCCESS\");\n" +
31278
				"  }\n" + 
31279
				"}\n" + 
31280
				"\n",
31281
				"ExtendedOuter.java", //================================
31282
				"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31283
				"  class ExtendedInner extends Inner {\n" + 
31284
				"    public void method(){\n" + 
31285
				"      Worker.method(this);\n" + 
31286
				"    }\n" + 
31287
				"  }\n" + 
31288
				"}\n",
31289
				"Worker.java", //================================
31290
				"public class Worker {\n" + 
31291
				"  public static void method(Outer.Inner i) {}\n" + 
31292
				"}\n", //================================
31293
			},
31294
			"SUCCESS");
31295
	this.runConformTest(
31296
			new String[] {
31297
					"ExtendedOuter.java", //================================
31298
					"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31299
					"  class ExtendedInner extends Inner {\n" + 
31300
					"    public void method(){\n" + 
31301
					"      Worker.method(this);\n" + 
31302
					"    }\n" + 
31303
					"  }\n" + 
31304
					"  public static void main(String[] args) {\n" + 
31305
					"    System.out.println(\"SUCCESS\");\n" +
31306
					"  }\n" + 
31307
					"}\n", //================================
31308
			},
31309
			"SUCCESS",
31310
			null,
31311
			false,
31312
			null);
31313
}
31314
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140569
31315
//simulate incremental compile
31316
public void test0982() {
31317
	this.runConformTest(
31318
			new String[] {
31319
				"Outer.java", //================================
31320
				"//Outer.java\n" + 
31321
				"public class Outer<O> {\n" + 
31322
				"  public class Inner {\n" + 
31323
				"  		public class Inner2 {}\n" + 
31324
				"	}\n" + 
31325
				"\n" + 
31326
				"  public static void main(String[] args) {\n" + 
31327
				"    System.out.println(\"SUCCESS\");\n" +
31328
				"  }\n" + 
31329
				"}\n" + 
31330
				"\n",
31331
				"ExtendedOuter.java", //================================
31332
				"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31333
				"  class ExtendedInner extends Inner {\n" + 
31334
				"    class ExtendedInner2 extends Inner2 {\n" + 
31335
				"      public void method(){\n" + 
31336
				"        Worker.method(this);\n" + 
31337
				"      }\n" + 
31338
				"    }\n" + 
31339
				"  }\n" + 
31340
				"}\n",
31341
				"Worker.java", //================================
31342
				"public class Worker {\n" + 
31343
				"  public static void method(Outer.Inner.Inner2 i) {}\n" + 
31344
				"}\n", //================================
31345
			},
31346
			"SUCCESS");
31347
	this.runConformTest(
31348
			new String[] {
31349
					"ExtendedOuter.java", //================================
31350
					"public class ExtendedOuter<E> extends Outer<E> {\n" + 
31351
					"  class ExtendedInner extends Inner {\n" + 
31352
					"    class ExtendedInner2 extends Inner2 {\n" + 
31353
					"      public void method(){\n" + 
31354
					"        Worker.method(this);\n" + 
31355
					"      }\n" + 
31356
					"    }\n" + 
31357
					"  }\n" + 
31358
					"  public static void main(String[] args) {\n" + 
31359
					"    System.out.println(\"SUCCESS\");\n" +
31360
					"  }\n" + 
31361
					"}\n", //================================
31362
			},
31363
			"SUCCESS",
31364
			null,
31365
			false,
31366
			null);
31367
}
31368
public void test0983() {
31369
	this.runNegativeTest(
31370
			new String[] {
31371
					"X.java", // =================
31372
					"import java.util.*;\n" + 
31373
					"\n" + 
31374
					"public class X {\n" + 
31375
					"    public static void main(String[] args) throws Throwable {\n" + 
31376
					"	List<?> l1 = new ArrayList<Integer>();\n" + 
31377
					"	List<?> l2 = new ArrayList<Integer>();\n" + 
31378
					"	l1.addAll(l2);\n" + 
31379
					"    }\n" + 
31380
					"}\n", // =================
31381
			},
31382
			"----------\n" + 
31383
			"1. ERROR in X.java (at line 7)\n" + 
31384
			"	l1.addAll(l2);\n" + 
31385
			"	   ^^^^^^\n" + 
31386
			"The method addAll(Collection<? extends capture#1-of ?>) in the type List<capture#1-of ?> is not applicable for the arguments (List<capture#2-of ?>)\n" + 
31387
			"----------\n");
31388
}
31389
// generic inner class within a non generic one
31390
public void test0984() {
31391
	this.runConformTest(
31392
		new String[] {
31393
			"X.java",
31394
			"public class X {\n" + 
31395
			"  public class XX<T> {}\n" + 
31396
			"}",
31397
			"I.java",
31398
			"public interface I {\n" + 
31399
			"    X.XX<String> foo();\n" + 
31400
			"}",
31401
			"Y.java",
31402
			"public class Y extends X implements I {\n" + 
31403
			"  public XX<String> foo() {\n" +
31404
			"    return null;\n" + 
31405
			"  }\n" + 
31406
			"}",
31407
			},
31408
		"");
31409
	this.runConformTest(
31410
		new String[] {
31411
			"Y.java",
31412
			"public class Y extends X implements I {\n" + 
31413
			"  public XX<String> foo() {\n" +
31414
			"    return null;\n" + 
31415
			"  }\n" + 
31416
			"}",
31417
			},
31418
		"",
31419
		null /* no extra class libraries */, 
31420
		false /* do not flush output directory */, 
31421
		null /* no vm arguments */,
31422
		null /* no custom options*/,
31423
		null /* no custom requestor*/,
31424
		false /* do not skip j for this peculiar test */);
31425
}
31426
private void runConformTest(String[] strings,
31427
        String string,
31428
        Object object,
31429
        boolean b,
31430
        Object object2,
31431
        Object object3,
31432
        Object object4,
31433
        boolean c) {
31434
	// TODO Auto-generated method stub
31435
	
31436
}
31437
31438
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=141330
31439
public void test0985() {
31440
	this.runNegativeTest(
31441
			new String[] {
31442
					"X.java", // =================
31443
					"import java.util.*;\n" + 
31444
					"public class X {\n" + 
31445
					"    public void testBreak() {\n" + 
31446
					"        List<Class<Object>>  lco = Arrays.asList(String.class, Integer.class, Long.class);\n" + 
31447
					"    }\n" + 
31448
					"}\n", // =================
31449
			},
31450
			"----------\n" + 
31451
			"1. WARNING in X.java (at line 4)\n" + 
31452
			"	List<Class<Object>>  lco = Arrays.asList(String.class, Integer.class, Long.class);\n" + 
31453
			"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
31454
			"Type safety : A generic array of Class<? extends Object&Serializable&Comparable<?>> is created for a varargs parameter\n" + 
31455
			"----------\n" + 
31456
			"2. ERROR in X.java (at line 4)\n" + 
31457
			"	List<Class<Object>>  lco = Arrays.asList(String.class, Integer.class, Long.class);\n" + 
31458
			"	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
31459
			"Type mismatch: cannot convert from List<Class<? extends Object&Serializable&Comparable<?>>> to List<Class<Object>>\n" + 
31460
			"----------\n");
31461
}
31462
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=91709
31463
public void test0986() {
31464
	this.runConformTest(
31465
			new String[] {
31466
					"T.java", // =================
31467
					"public class T {\n" + 
31468
					"	public T() {\n" + 
31469
					"		S<String> s = new S<String>();\n" + 
31470
					"		s.setObj(\"S\");\n" + 
31471
					"		System.out.print(s.getObj());\n" + 
31472
					"		S<Integer> i = new S<Integer>();\n" + 
31473
					"		i.setObj(new Integer(100));\n" + 
31474
					"		System.out.print(i.getObj());\n" + 
31475
					"		S<MyClass> m = new S<MyClass>();\n" + 
31476
					"		m.setObj(new MyClass(\"[Terry]\"));\n" + 
31477
					"		System.out.print(m.getObj());\n" + 
31478
					"		S<MyClass> x = new S<MyClass>(new MyClass(\"[Corbet]\"));\n" + 
31479
					"		System.out.print(x.getObj());\n" + 
31480
					"	} // End of Constructor for T.\n" + 
31481
					"	public static void main(String[] args) {\n" + 
31482
					"		try {\n" + 
31483
					"			new T();\n" + 
31484
					"			System.out.println(\"SUCCESS\");\n" +
31485
					"		} catch (Exception ex) {\n" + 
31486
					"			ex.printStackTrace();\n" + 
31487
					"		}\n" + 
31488
					"	} // End of main().\n" + 
31489
					"\n" + 
31490
					"	class MyClass {\n" + 
31491
					"		private String str;\n" + 
31492
					"		public MyClass(String str) {\n" + 
31493
					"			this.str = str;\n" + 
31494
					"		} // End of Constructor for MyClass.\n" + 
31495
					"		@Override\n" + 
31496
					"		public String toString() {\n" + 
31497
					"			return (\"MyClass = \" + str);\n" + 
31498
					"		} // End of toString().\n" + 
31499
					"	} // End of Embedded MyClass Class.\n" + 
31500
					"} // End of T Class.\n",  // =================
31501
					"S.java", // =================
31502
					"public class S<$T> extends B<$T> {\n" + 
31503
					"	public S() {\n" + 
31504
					"		super();\n" + 
31505
					"	} // End of Constructor for S.\n" + 
31506
					"	public S($T obj) {\n" + 
31507
					"		super(obj);\n" + 
31508
					"	} // End of Constructor for S.\n" + 
31509
					"} // End of S Class.\n",  // =================
31510
					"B.java", // =================
31511
					"public abstract class B<$T> {\n" + 
31512
					"	$T obj;\n" + 
31513
					"	public B() {\n" + 
31514
					"		;\n" + 
31515
					"	} // End of Constructor for B.\n" + 
31516
					"	public B($T obj) {\n" + 
31517
					"		this.obj = obj;\n" + 
31518
					"	} // End ofg Constructor of B.\n" + 
31519
					"	public $T getObj() {\n" + 
31520
					"		return (obj);\n" + 
31521
					"	} // End of getObj().\n" + 
31522
					"	public void setObj($T obj) {\n" + 
31523
					"		this.obj = obj;\n" + 
31524
					"	} // End of setObj().\n" + 
31525
					"} // End of B Class.", // =================
31526
31527
			},
31528
			"S100MyClass = [Terry]MyClass = [Corbet]SUCCESS");
31529
}
31530
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=140643
31531
public void test0987() {
31532
	String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6
31533
	?	"----------\n" + 
31534
		"1. ERROR in X.java (at line 7)\n" + 
31535
		"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31536
		"	               ^^^^^^^^^^^^^^^^\n" + 
31537
		"The return type is incompatible with EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31538
		"----------\n" + 
31539
		"2. ERROR in X.java (at line 11)\n" + 
31540
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31541
		"	       ^^^^^^^^^^^^\n" + 
31542
		"The return type is incompatible with EditPart.getViewer()\n" + 
31543
		"----------\n" + 
31544
		"3. ERROR in X.java (at line 11)\n" + 
31545
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31546
		"	                    ^^^^^^^^^^^\n" + 
31547
		"The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" + 
31548
		"----------\n"
31549
	:	"----------\n" + 
31550
		"1. ERROR in X.java (at line 7)\n" + 
31551
		"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31552
		"	               ^^^^^^^^^^^^^^^^\n" + 
31553
		"The return type is incompatible with EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31554
		"----------\n" + 
31555
		"2. ERROR in X.java (at line 11)\n" + 
31556
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31557
		"	       ^^^^^^^^^^^^\n" + 
31558
		"The return type is incompatible with EditPart.getViewer()\n" + 
31559
		"----------\n";	
31560
	this.runNegativeTest(
31561
			new String[] {
31562
				"X.java",//===================
31563
				"public class X {\n" + 
31564
				"	void bar(GLinkElementView<?,?> g) {\n" + 
31565
				"		g.getViewer();\n" + 
31566
				"	}\n" + 
31567
				"}\n" + 
31568
				"\n" + 
31569
				"abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31570
				"\n" + 
31571
				"abstract class AbstractLinkView<M> extends AbstractConnectionEditPart implements ILinkViewElement {\n" + 
31572
				"	@Override\n" + 
31573
				"	public ISheetViewer getViewer() { return null; }	\n" + 
31574
				"}\n" + 
31575
				"\n" + 
31576
				"abstract class AbstractConnectionEditPart implements EditPart {}\n" + 
31577
				"\n" + 
31578
				"abstract class AbstractEditPart implements EditPart {\n" + 
31579
				"	public EditPartViewer getViewer() { return null; }\n" + 
31580
				"}\n" + 
31581
				"\n" + 
31582
				"interface ILinkViewElement {\n" + 
31583
				"	public ISheetViewer getViewer();\n" + 
31584
				"}\n" + 
31585
				"\n" + 
31586
				"interface ISheetViewer {}\n" + 
31587
				"\n" + 
31588
				"interface EditPart {\n" + 
31589
				"	EditPartViewer getViewer();\n" + 
31590
				"}\n" + 
31591
				"\n" + 
31592
				"interface EditPartViewer {}\n", // =================			
31593
			},
31594
			expectedOutput);
31595
}
31596
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=140643 - variation
31597
public void test0988() {
31598
	this.runNegativeTest(
31599
			new String[] {
31600
				"X.java",//===================
31601
				"public class X {\n" + 
31602
				"	void bar(GLinkElementView<?,?> g) {\n" + 
31603
				"		g.getViewer();\n" + 
31604
				"	}\n" + 
31605
				"}\n" + 
31606
				"\n" + 
31607
				"abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31608
				"\n" + 
31609
				"abstract class AbstractLinkView<M> extends AbstractConnectionEditPart implements ILinkViewElement, IModelChangeListener {\n" + 
31610
				"	@Override\n" + 
31611
				"	public SheetViewer getViewer() { return null; }	\n" + 
31612
				"}\n" + 
31613
				"\n" + 
31614
				"abstract class AbstractConnectionEditPart extends AbstractGraphicalEditPart implements ConnectionEditPart {}\n" + 
31615
				"\n" + 
31616
				"abstract class AbstractGraphicalEditPart extends AbstractEditPart implements GraphicalEditPart {}\n" + 
31617
				"\n" + 
31618
				"abstract class AbstractEditPart implements EditPart {\n" + 
31619
				"	public EditPartViewer getViewer() { return null; }\n" + 
31620
				"}\n" + 
31621
				"\n" + 
31622
				"interface ILinkViewElement extends INodeViewElement {\n" + 
31623
				"	public ISheetViewer getViewer();\n" + 
31624
				"}\n" + 
31625
				"\n" + 
31626
				"class SheetViewer implements ISheetViewer {}\n" + 
31627
				"\n" + 
31628
				"interface ISheetViewer {}\n" + 
31629
				"\n" + 
31630
				"interface EditPart {\n" + 
31631
				"	EditPartViewer getViewer();\n" + 
31632
				"}\n" + 
31633
				"\n" + 
31634
				"interface ConnectionEditPart extends GraphicalEditPart {}\n" + 
31635
				"interface GraphicalEditPart extends EditPart {}\n" + 
31636
				"interface EditPartViewer {}\n" + 
31637
				"interface IModelChangeListener {}\n" + 
31638
				"\n" + 
31639
				"interface INodeViewElement {\n" + 
31640
				"	public ISheetViewer getViewer();\n" + 
31641
				"}", // =================			
31642
			},
31643
			"----------\n" + 
31644
			"1. ERROR in X.java (at line 11)\n" + 
31645
			"	public SheetViewer getViewer() { return null; }	\n" + 
31646
			"	       ^^^^^^^^^^^\n" + 
31647
			"The return type is incompatible with AbstractEditPart.getViewer()\n" + 
31648
			"----------\n");
31649
}
31650
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142653
31651
public void test0989() {
31652
	this.runNegativeTest(
31653
			new String[] {
31654
				"Child.java",//===================
31655
				"public class Child extends Parent<Object> {}\n" + 
31656
				"abstract class Parent<T> extends Grandparent<T> implements IParent {}\n" + 
31657
				"interface IParent<T> extends IGrandparent<T> {}\n" + 
31658
				"abstract class Grandparent<T> implements IGrandparent<T> {}\n" + 
31659
				"interface IGrandparent<T> {}", // =================, // =================			
31660
			},
31661
			"----------\n" + 
31662
			"1. ERROR in Child.java (at line 2)\n" + 
31663
			"	abstract class Parent<T> extends Grandparent<T> implements IParent {}\n" + 
31664
			"	               ^^^^^^\n" + 
31665
			"The interface IGrandparent cannot be implemented more than once with different arguments: IGrandparent<T> and IGrandparent\n" + 
31666
			"----------\n" + 
31667
			"2. WARNING in Child.java (at line 2)\n" + 
31668
			"	abstract class Parent<T> extends Grandparent<T> implements IParent {}\n" + 
31669
			"	                                                           ^^^^^^^\n" + 
31670
			"IParent is a raw type. References to generic type IParent<T> should be parameterized\n" + 
31671
			"----------\n");
31672
}
31673
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142653 - variation
31674
public void test0990() {
31675
	this.runNegativeTest(
31676
			new String[] {
31677
				"Child.java",//===================
31678
				"public class Child extends Parent<Object> {}\n" + 
31679
				"abstract class Parent<T> extends Grandparent<T> implements IParent<?> {}\n" + 
31680
				"interface IParent<T> extends IGrandparent<T> {}\n" + 
31681
				"abstract class Grandparent<T> implements IGrandparent<T> {}\n" + 
31682
				"interface IGrandparent<T> {}", // =================, // =================			
31683
			},
31684
			"----------\n" + 
31685
			"1. ERROR in Child.java (at line 1)\n" + 
31686
			"	public class Child extends Parent<Object> {}\n" + 
31687
			"	             ^^^^^\n" + 
31688
			"The hierarchy of the type Child is inconsistent\n" + 
31689
			"----------\n" + 
31690
			"2. ERROR in Child.java (at line 2)\n" + 
31691
			"	abstract class Parent<T> extends Grandparent<T> implements IParent<?> {}\n" + 
31692
			"	                                                           ^^^^^^^\n" + 
31693
			"The type Parent cannot extend or implement IParent<?>. A supertype may not specify any wildcard\n" + 
31694
			"----------\n");
31695
}
31696
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142653 - variation
31697
public void test0991() {
31698
	this.runNegativeTest(
31699
			new String[] {
31700
				"X.java",//===================
31701
				"public class X extends SX<String> implements IX<Object> {}\n" + 
31702
				"class SX<T> extends TX<Thread> implements IX<T> {}\n" + 
31703
				"class TX<U> implements IX<U> {}\n" + 
31704
				"interface IX<V> {}\n", // =================, // =================			
31705
			},
31706
			"----------\n" + 
31707
			"1. ERROR in X.java (at line 1)\n" + 
31708
			"	public class X extends SX<String> implements IX<Object> {}\n" + 
31709
			"	             ^\n" + 
31710
			"The interface IX cannot be implemented more than once with different arguments: IX<Thread> and IX<Object>\n" + 
31711
			"----------\n" + 
31712
			"2. ERROR in X.java (at line 2)\n" + 
31713
			"	class SX<T> extends TX<Thread> implements IX<T> {}\n" + 
31714
			"	      ^^\n" + 
31715
			"The interface IX cannot be implemented more than once with different arguments: IX<Thread> and IX<T>\n" + 
31716
			"----------\n");
31717
}
31718
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142653 - variation
31719
public void test0992() {
31720
	this.runNegativeTest(
31721
			new String[] {
31722
				"X.java",//===================
31723
				"import java.util.*;\n" + 
31724
				"public abstract class X<T0> implements Collection, I<T0> {\n" + 
31725
				"	\n" + 
31726
				"	void foo() {\n" + 
31727
				"		this.add(new Object());\n" + 
31728
				"		this.add(null);\n" + 
31729
				"	}\n" + 
31730
				"}\n" + 
31731
				"interface I<T1> extends Collection<String> {\n" + 
31732
				"}\n", // =================, // =================			
31733
			},
31734
			"----------\n" + 
31735
			"1. ERROR in X.java (at line 2)\n" + 
31736
			"	public abstract class X<T0> implements Collection, I<T0> {\n" + 
31737
			"	                      ^\n" + 
31738
			"The interface Collection cannot be implemented more than once with different arguments: Collection<String> and Collection\n" + 
31739
			"----------\n" + 
31740
			"2. WARNING in X.java (at line 2)\n" + 
31741
			"	public abstract class X<T0> implements Collection, I<T0> {\n" + 
31742
			"	                                       ^^^^^^^^^^\n" + 
31743
			"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + 
31744
			"----------\n" + 
31745
			"3. WARNING in X.java (at line 5)\n" + 
31746
			"	this.add(new Object());\n" + 
31747
			"	^^^^^^^^^^^^^^^^^^^^^^\n" + 
31748
			"Type safety: The method add(Object) belongs to the raw type Collection. References to generic type Collection<E> should be parameterized\n" + 
31749
			"----------\n" + 
31750
			"4. WARNING in X.java (at line 6)\n" + 
31751
			"	this.add(null);\n" + 
31752
			"	^^^^^^^^^^^^^^\n" + 
31753
			"Type safety: The method add(Object) belongs to the raw type Collection. References to generic type Collection<E> should be parameterized\n" + 
31754
			"----------\n");
31755
}
31756
31757
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142897
31758
public void test0993() {
31759
	this.runConformTest(
31760
			new String[] {
31761
				"X.java",//===================
31762
				"public class X {\n" + 
31763
				"  public class Inner {\n" + 
31764
				"    Inner() {\n" +
31765
				"      System.out.println(\"SUCCESS\");\n" +
31766
				"    }\n" +
31767
				"  }\n" + 
31768
				"  public static void main(String[] args) {\n" +
31769
				"    new ATest<X>();\n" +
31770
				"  }\n" + 
31771
				"}\n" + 
31772
				"\n" + 
31773
				"class ATest<T extends X> {\n" + 
31774
				"   public ATest() {\n" + 
31775
				"      T instance = makeInstance();\n" + 
31776
				"      X.Inner peq = instance.new Inner(); //**\n" + 
31777
				"   }\n" + 
31778
				"\n" + 
31779
				"   private T makeInstance() {\n" + 
31780
				"      return (T) new X();\n" + 
31781
				"   }\n" + 
31782
				"}", // =================
31783
			},
31784
			"SUCCESS");
31785
}
31786
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142897 - variation
31787
public void test0994() {
31788
	this.runConformTest(
31789
			new String[] {
31790
				"X.java",//===================
31791
				"public class X {\n" + 
31792
				"  public class Inner {\n" + 
31793
				"    Inner() {\n" +
31794
				"      System.out.println(\"SUCCESS\");\n" +
31795
				"    }\n" +
31796
				"  }\n" + 
31797
				"  void foo(boolean b, X1 x1, X2 x2) {\n" + 
31798
				"	  (b ? x1 : x2).new Inner();\n" + 
31799
				"  }\n" + 
31800
				"  public static void main(String[] args) {\n" +
31801
				"    new X().foo(true, new X1(), new X2());\n" +
31802
				"  }\n" + 
31803
				"}\n" + 
31804
				"\n" + 
31805
				"class X1 extends X implements Comparable<X1> {\n" +
31806
				"  public int compareTo(X1 other) {\n" +
31807
				"    return 0;\n" + 
31808
				"  }\n" + 
31809
				"}\n" + 
31810
				"class X2 extends X implements Comparable<X2> {\n" +
31811
				"  public int compareTo(X2 other) {\n" +
31812
				"    return 0;\n" + 
31813
				"  }\n" + 
31814
				"}\n", // =================
31815
			},
31816
			"SUCCESS");
31817
}
31818
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142964
31819
public void _test0995() {
31820
	this.runNegativeTest(
31821
			new String[] {
31822
				"X.java",//===================
31823
				"public class X {\n" + 
31824
				"  public class Inner {\n" + 
31825
				"  }\n" + 
31826
				"  void foo(boolean b, X1 x1, X2 x2) {\n" + 
31827
				"	  Comparable<? extends X> cx1 = b ? x1 : x2;\n" + 
31828
				"	  Comparable<X> cx2 = b ? x1 : x2;\n" + 
31829
				"	  String s = b ? x1 : x2;\n" + 
31830
				"  }\n" + 
31831
				"}\n" + 
31832
				"\n" + 
31833
				"abstract class X1 extends X implements Comparable<X1> {}\n" + 
31834
				"abstract class X2 extends X implements Comparable<X2> {}", // =================
31835
			},
31836
			"SUCCESS");
31837
}
31838
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=143793
31839
public void test0996() {
31840
	this.runNegativeTest(
31841
			new String[] {
31842
				"X.java",//===================
31843
				"import java.util.ArrayList;\n" + 
31844
				"import java.util.List;\n" + 
31845
				"\n" + 
31846
				"public class X<T> {\n" + 
31847
				"  private T aObject = null;\n" + 
31848
				"  public static <U> List<U> castList(final List<? extends Object> pList, final Class<U> pClass) {\n" + 
31849
				"    final List<U> result = new ArrayList<U>();\n" + 
31850
				"    for (Object o:pList) {\n" + 
31851
				"      if (pClass.isInstance(o)) {\n" + 
31852
				"        result.add(pClass.cast(o));\n" + 
31853
				"      }\n" + 
31854
				"    }\n" + 
31855
				"    return result;\n" + 
31856
				"  }\n" + 
31857
				"\n" + 
31858
				"  public static void main(final String[] pArgs) {\n" + 
31859
				"    final List<Object> l1 = new ArrayList<Object>();\n" + 
31860
				"    l1.add(new X<String>());\n" + 
31861
				"    l1.add(new X<String>());\n" + 
31862
				"    final List<X<?>> l2 = castList(l1, List.class);\n" + 
31863
				"    \n" + 
31864
				"    List<X> l3 = l2;\n" + 
31865
				"    List<X<String>> l4 = null;\n" + 
31866
				"    l3 = l4;\n" + 
31867
				"  }\n" + 
31868
				"\n" + 
31869
				"}\n", // =================
31870
			},
31871
			"----------\n" + 
31872
			"1. WARNING in X.java (at line 5)\n" + 
31873
			"	private T aObject = null;\n" + 
31874
			"	          ^^^^^^^\n" + 
31875
			"The field X<T>.aObject is never read locally\n" + 
31876
			"----------\n" + 
31877
			"2. ERROR in X.java (at line 20)\n" + 
31878
			"	final List<X<?>> l2 = castList(l1, List.class);\n" + 
31879
			"	                      ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
31880
			"Type mismatch: cannot convert from List<List> to List<X<?>>\n" + 
31881
			"----------\n" + 
31882
			"3. WARNING in X.java (at line 22)\n" + 
31883
			"	List<X> l3 = l2;\n" + 
31884
			"	     ^\n" + 
31885
			"X is a raw type. References to generic type X<T> should be parameterized\n" + 
31886
			"----------\n" + 
31887
			"4. ERROR in X.java (at line 22)\n" + 
31888
			"	List<X> l3 = l2;\n" + 
31889
			"	             ^^\n" + 
31890
			"Type mismatch: cannot convert from List<X<?>> to List<X>\n" + 
31891
			"----------\n" + 
31892
			"5. ERROR in X.java (at line 24)\n" + 
31893
			"	l3 = l4;\n" + 
31894
			"	     ^^\n" + 
31895
			"Type mismatch: cannot convert from List<X<String>> to List<X>\n" + 
31896
			"----------\n");
31897
}
31898
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142897 - variation
31899
public void test0997() {
31900
	this.runConformTest(
31901
			new String[] {
31902
				"X.java",//===================
31903
				"public class X implements Outer {\n" +
31904
				"  public static void main(String[] args) {\n" +
31905
				"    new ATest<X>();\n" +
31906
				"  }\n" + 
31907
				"}\n" +
31908
				"interface Outer {\n" + 
31909
				"  public class Inner {\n" + 
31910
				"    Inner() {\n" +
31911
				"      System.out.println(\"SUCCESS\");\n" +
31912
				"    }\n" +
31913
				"  }\n" + 
31914
				"}\n" + 
31915
				"\n" + 
31916
				"class ATest<T extends Outer> {\n" + 
31917
				"   public ATest() {\n" + 
31918
				"      Outer.Inner peq = new T.Inner(); //**\n" + 
31919
				"   }\n" + 
31920
				"\n" + 
31921
				"   private T makeInstance() {\n" + 
31922
				"      return (T) new X();\n" + 
31923
				"   }\n" + 
31924
				"}", // =================
31925
			},
31926
			"SUCCESS");
31927
}
31928
//regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=144261
31929
public void test0998() {
31930
	this.runConformTest(
31931
		new String[] {
31932
			"X.java",
31933
			"class X {\n" + 
31934
			"    static abstract class Generic<F> {\n" + 
31935
			"        static class Inner {\n" + 
31936
			"            static class InnerInner { }\n" + 
31937
			"            InnerInner createTableModel() {\n" + 
31938
			"                return new InnerInner();\n" + 
31939
			"            }\n" + 
31940
			"        }\n" + 
31941
			"    }\n" + 
31942
			"    static class SubGeneric<S> extends Generic<S> {\n" + 
31943
			"        static class SubInner extends Inner {\n" + 
31944
			"            InnerInner createTableModel() {\n" + 
31945
			"                return super.createTableModel(); \n" + 
31946
			"            }\n" + 
31947
			"        }\n" + 
31948
			"    }\n" + 
31949
			"}",
31950
		},
31951
		"");
31952
}
31953
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=144879
31954
public void test0999() {
31955
	this.runNegativeTest(
31956
		new String[] {
31957
			"X.java",
31958
			"import java.util.*;\n" + 
31959
			"public class X {\n" + 
31960
			"	public static final <T,E extends T> Iterator<T> chain(Iterator<E>... it) {\n" + 
31961
			"		return null;\n" + 
31962
			"	}\n" + 
31963
			"	void foo1() {\n" + 
31964
			"		List<Integer> l1 = Arrays.asList(1, 2, 3);\n" + 
31965
			"		List<Float> l2 = Arrays.asList(4f, 5f, 6f);\n" + 
31966
			"		Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
31967
			"	}\n" + 
31968
			"	void foo2() {\n" + 
31969
			"		List<Integer> l1 = Arrays.asList(1, 2, 3);\n" + 
31970
			"		List<Float> l2 = Arrays.asList(4f, 5f, 6f);\n" + 
31971
			"		Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
31972
			"	}\n" + 
31973
			"	void foo3() {\n" + 
31974
			"		List<Integer> l1 = Arrays.asList(1, 2, 3);\n" + 
31975
			"		Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
31976
			"	}\n" + 
31977
			"}", // =================
31978
		},
31979
		"----------\n" + 
31980
		"1. WARNING in X.java (at line 9)\n" + 
31981
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
31982
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
31983
		"Type safety: Unchecked invocation chain(Iterator...) of the generic method chain(Iterator<E>...) of type X\n" + 
31984
		"----------\n" + 
31985
		"2. WARNING in X.java (at line 9)\n" + 
31986
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
31987
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
31988
		"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + 
31989
		"----------\n" + 
31990
		"3. ERROR in X.java (at line 14)\n" + 
31991
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
31992
		"	                         ^^^^^\n" + 
31993
		"The method chain(Iterator<E>...) in the type X is not applicable for the arguments (Iterator<Integer>, Iterator<Float>)\n" + 
31994
		"----------\n" + 
31995
		"4. WARNING in X.java (at line 18)\n" + 
31996
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
31997
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
31998
		"Type safety : A generic array of Iterator<Integer> is created for a varargs parameter\n" + 
31999
		"----------\n");
32000
}
32001
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=144879
32002
public void test1000() {
32003
	this.runNegativeTest(
32004
		new String[] {
32005
			"X.java",
32006
			"import java.util.*;\n" + 
32007
			"public class X {\n" + 
32008
			"	public static final <T> Iterator<T> chain(Iterator<? extends T>... it) {\n" + 
32009
			"		return null;\n" + 
32010
			"	}\n" + 
32011
			"	void foo1() {\n" + 
32012
			"		List<Integer> l1 = Arrays.asList(1, 2, 3);\n" + 
32013
			"		List<Float> l2 = Arrays.asList(4f, 5f, 6f);\n" + 
32014
			"		Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32015
			"	}\n" + 
32016
			"	void foo2() {\n" + 
32017
			"		List<Integer> l1 = Arrays.asList(1, 2, 3);\n" + 
32018
			"		List<Float> l2 = Arrays.asList(4f, 5f, 6f);\n" + 
32019
			"		Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
32020
			"	}\n" + 
32021
			"	void foo3() {\n" + 
32022
			"		List<Integer> l1 = Arrays.asList(1, 2, 3);\n" + 
32023
			"		Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
32024
			"	}\n" + 
32025
			"}", // =================
32026
		},
32027
		"----------\n" + 
32028
		"1. WARNING in X.java (at line 9)\n" + 
32029
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32030
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32031
		"Type safety: Unchecked invocation chain(Iterator...) of the generic method chain(Iterator<? extends T>...) of type X\n" + 
32032
		"----------\n" + 
32033
		"2. WARNING in X.java (at line 9)\n" + 
32034
		"	Iterator<Number> it1 = X.chain(new Iterator[] { l1.iterator(), l2.iterator() });\n" + 
32035
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32036
		"Type safety: The expression of type Iterator needs unchecked conversion to conform to Iterator<Number>\n" + 
32037
		"----------\n" + 
32038
		"3. WARNING in X.java (at line 14)\n" + 
32039
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
32040
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32041
		"Type safety : A generic array of Iterator<? extends Number&Comparable<?>> is created for a varargs parameter\n" + 
32042
		"----------\n" + 
32043
		"4. ERROR in X.java (at line 14)\n" + 
32044
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l2.iterator());\n" + 
32045
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32046
		"Type mismatch: cannot convert from Iterator<Number&Comparable<?>> to Iterator<Number>\n" + 
32047
		"----------\n" + 
32048
		"5. WARNING in X.java (at line 18)\n" + 
32049
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
32050
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32051
		"Type safety : A generic array of Iterator<? extends Integer> is created for a varargs parameter\n" + 
32052
		"----------\n" + 
32053
		"6. ERROR in X.java (at line 18)\n" + 
32054
		"	Iterator<Number> it2 = X.chain(l1.iterator(), l1.iterator());\n" + 
32055
		"	                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32056
		"Type mismatch: cannot convert from Iterator<Integer> to Iterator<Number>\n" + 
32057
		"----------\n");
32058
}
32059
public void test1001() {
32060
	this.runConformTest(
32061
		new String[] {
32062
			"X.java",
32063
			"public class X {\n" + 
32064
			"	static class Box<T> {}\n" + 
32065
			"	static class ABox<T extends A> {}\n" + 
32066
			"	static class A {}\n" + 
32067
			"	\n" + 
32068
			"	void foo(ABox<? extends A> a1, ABox<?> a2) {\n" + 
32069
			"		a1 = a2;	\n" + 
32070
			"	}\n" + 
32071
			"}", // =================
32072
		},
32073
		"");
32074
}
32075
public void test1002() {
32076
	this.runNegativeTest(
32077
		new String[] {
32078
			"Base.java",
32079
			"class Base {\n" + 
32080
			"}\n" + 
32081
			"class Foo<U extends Base, V extends Bar<U, Foo<U, V>>> {\n" + 
32082
			"	U u;\n" + 
32083
			"	V v;\n" + 
32084
			"}\n" + 
32085
			"class Bar<E extends Base, F extends Foo<E, Bar<E, F>>> {\n" + 
32086
			"	E e;\n" + 
32087
			"	F f;\n" + 
32088
			"}\n", // =================
32089
		},
32090
		"----------\n" + 
32091
		"1. ERROR in Base.java (at line 3)\n" + 
32092
		"	class Foo<U extends Base, V extends Bar<U, Foo<U, V>>> {\n" + 
32093
		"	                                           ^^^\n" + 
32094
		"Bound mismatch: The type Foo<U,V> is not a valid substitute for the bounded parameter <F extends Foo<E,Bar<E,F>>> of the type Bar<E,F>\n" + 
32095
		"----------\n" + 
32096
		"2. ERROR in Base.java (at line 7)\n" + 
32097
		"	class Bar<E extends Base, F extends Foo<E, Bar<E, F>>> {\n" + 
32098
		"	                                           ^^^\n" + 
32099
		"Bound mismatch: The type Bar<E,F> is not a valid substitute for the bounded parameter <V extends Bar<U,Foo<U,V>>> of the type Foo<U,V>\n" + 
32100
		"----------\n");
32101
}
32102
public void test1003() {
32103
	this.runConformTest(
32104
		new String[] {
32105
			"B.java",
32106
			"class B {\n" + 
32107
			"}\n" + 
32108
			"class S<BB extends B, SS extends S<BB, SS, TT>, TT extends T<BB, SS, TT>> {\n" + 
32109
			"	BB b;\n" + 
32110
			"	TT t;\n" + 
32111
			"}\n" + 
32112
			"class T<BB extends B, SS extends S<BB, SS, TT>, TT extends T<BB, SS, TT>> {\n" + 
32113
			"	BB b;\n" + 
32114
			"	SS t;\n" + 
32115
			"}\n", // =================
32116
		},
32117
		"");
32118
}
32119
// **
32120
public void test1004() {
32121
	this.runConformTest(
32122
		new String[] {
32123
			"X.java",
32124
			"public class X {\n" + 
32125
			"	<B> B getOtherValue() {\n" + 
32126
			"		return null;\n" + 
32127
			"	}\n" + 
32128
			"	<A> A getValue() {\n" + 
32129
			"		return getOtherValue();\n" + 
32130
			"	}\n" + 
32131
			"}", // =================
32132
		},
32133
		"");
32134
}
32135
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=145420
32136
// **
32137
public void test1005() {
32138
	this.runConformTest(
32139
		new String[] {
32140
			"X.java",
32141
			"public class X<T1,T2> {\n" + 
32142
			"\n" + 
32143
			"    private static final Object NULL_REF = new Object();\n" + 
32144
			"    private Object data;\n" + 
32145
			"\n" + 
32146
			"    private static <RT> RT unwrap(Object obj) {\n" + 
32147
			"        return (RT)(obj == NULL_REF ? null : obj);\n" + 
32148
			"    }\n" + 
32149
			"\n" + 
32150
			"    public T1 getAsT1() {\n" + 
32151
			"        return unwrap(data);\n" + 
32152
			"    }\n" + 
32153
			"\n" + 
32154
			"    public T2 getAsT2() {\n" + 
32155
			"        return unwrap(data);\n" + 
32156
			"    }\n" + 
32157
			"}", // =================
32158
		},
32159
		"");
32160
}
32161
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=145420 - variant
32162
// **
32163
public void test1005b() {
32164
	this.runNegativeTest(
32165
		new String[] {
32166
			"X.java",
32167
			"public class X<T1,T2> {\n" + 
32168
			"\n" + 
32169
			"    private static final Object NULL_REF = new Object();\n" + 
32170
			"    private Object data;\n" + 
32171
			"\n" + 
32172
			"    private static <RT> RT unwrap(Object obj) {\n" + 
32173
			"        return (RT)(obj == NULL_REF ? null : obj);\n" + 
32174
			"    }\n" + 
32175
			"\n" + 
32176
			"    public T1 getAsT1() {\n" + 
32177
			"        return unwrap(data);\n" + 
32178
			"    }\n" + 
32179
			"\n" + 
32180
			"    public T2 getAsT2() {\n" + 
32181
			"        return unwrap(data);\n" + 
32182
			"    }\n" + 
32183
			"    Zork z;\n" + 
32184
			"}", // =================
32185
		},
32186
		"----------\n" + 
32187
		"1. WARNING in X.java (at line 7)\n" + 
32188
		"	return (RT)(obj == NULL_REF ? null : obj);\n" + 
32189
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32190
		"Type safety: Unchecked cast from Object to RT\n" + 
32191
		"----------\n" + 
32192
		"2. ERROR in X.java (at line 17)\n" + 
32193
		"	Zork z;\n" + 
32194
		"	^^^^\n" + 
32195
		"Zork cannot be resolved to a type\n" + 
32196
		"----------\n");
32197
}
32198
public void test1006() {
32199
	this.runConformTest(
32200
		new String[] {
32201
			"X.java",
32202
			"class Reference<T> {\n" + 
32203
			"	T target;\n" + 
32204
			"	Reference(T target) {\n" + 
32205
			"		this.target = target;\n" + 
32206
			"	}\n" + 
32207
			"	T deref() {\n" + 
32208
			"		return this.target;\n" + 
32209
			"	}\n" + 
32210
			"	static <U> Reference<U> create(U u) {\n" + 
32211
			"		return new Reference<U>(u);\n" + 
32212
			"	}\n" + 
32213
			"}\n" + 
32214
			"class BaseObject {}\n" + 
32215
			"class Person extends BaseObject {}\n" + 
32216
			"class Building extends BaseObject {}\n" + 
32217
			"\n" + 
32218
			"public class X {\n" + 
32219
			"	void foo(Building b, Person p) {\n" + 
32220
			"		Reference<Building> bRef = Reference.create(b);\n" + 
32221
			"		Reference<Person> pRef = Reference.create(p);\n" + 
32222
			"\n" + 
32223
			"		final Building building = bRef.deref();\n" + 
32224
			"		final Person person = pRef.deref();\n" + 
32225
			"	}\n" + 
32226
			"}", // =================
32227
		},
32228
		"");
32229
}
32230
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=147381
32231
public void test1007() {
32232
	this.runNegativeTest(
32233
		new String[] {
32234
			"GenericsProblem.java",
32235
			"public class GenericsProblem {\n" + 
32236
			"	public <T> void test(T val) {\n" + 
32237
			"		GenericsProblem gp = new GenericsProblem();\n" + 
32238
			"		Class<? extends GenericsProblem> cl2 = gp.getClass();\n" + 
32239
			"		Class<? extends T> cl = val.getClass();\n" + 
32240
			"	}\n" + 
32241
			"}\n",
32242
		},
32243
		"----------\n" + 
32244
		"1. ERROR in GenericsProblem.java (at line 5)\n" + 
32245
		"	Class<? extends T> cl = val.getClass();\n" + 
32246
		"	                        ^^^^^^^^^^^^^^\n" + 
32247
		"Type mismatch: cannot convert from Class<capture#2-of ? extends Object> to Class<? extends T>\n" + 
32248
		"----------\n");
32249
}
32250
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061
32251
public void test1008() {
32252
	this.runNegativeTest(
32253
		new String[] {
32254
			"X.java",
32255
			"public class X {\n" + 
32256
			"	void foo(L l, C<? extends X> c) {\n" + 
32257
			"		X x = bar(l, c);\n" + 
32258
			"	}\n" + 
32259
			"	<T> T bar(L<T> l, C<? extends T> c) { \n" + 
32260
			"		return null;\n" + 
32261
			"	}	\n" + 
32262
			"}\n" + 
32263
			"class C<E> {}\n" + 
32264
			"class L<E> {}\n" + 
32265
			"\n" + 
32266
			"\n", // =================
32267
		},
32268
		"----------\n" + 
32269
		"1. WARNING in X.java (at line 2)\r\n" + 
32270
		"	void foo(L l, C<? extends X> c) {\r\n" + 
32271
		"	         ^\n" + 
32272
		"L is a raw type. References to generic type L<E> should be parameterized\n" + 
32273
		"----------\n" + 
32274
		"2. WARNING in X.java (at line 3)\r\n" + 
32275
		"	X x = bar(l, c);\r\n" + 
32276
		"	      ^^^^^^^^^\n" + 
32277
		"Type safety: Unchecked invocation bar(L, C) of the generic method bar(L<T>, C<? extends T>) of type X\n" + 
32278
		"----------\n" + 
32279
		"3. ERROR in X.java (at line 3)\r\n" + 
32280
		"	X x = bar(l, c);\r\n" + 
32281
		"	      ^^^^^^^^^\n" + 
32282
		"Type mismatch: cannot convert from Object to X\n" + 
32283
		"----------\n" + 
32284
		"4. WARNING in X.java (at line 3)\r\n" + 
32285
		"	X x = bar(l, c);\r\n" + 
32286
		"	          ^\n" + 
32287
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + 
32288
		"----------\n");
32289
}
32290
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32291
public void test1009() {
32292
	this.runNegativeTest(
32293
		new String[] {
32294
			"X.java",
32295
			"import java.util.Map;\n" + 
32296
			"public class X {\n" + 
32297
			"\n" + 
32298
			"	void foo(Map<String,Map> map) {\n" + 
32299
			"		bar(map);\n" + 
32300
			"	}\n" + 
32301
			"	<U,V> void bar(Map<U,Map<U,V>> map) {\n" + 
32302
			"	}\n" + 
32303
			"}\n", // =================
32304
		},
32305
		"----------\n" + 
32306
		"1. WARNING in X.java (at line 4)\n" + 
32307
		"	void foo(Map<String,Map> map) {\n" + 
32308
		"	                    ^^^\n" + 
32309
		"Map is a raw type. References to generic type Map<K,V> should be parameterized\n" + 
32310
		"----------\n" + 
32311
		"2. ERROR in X.java (at line 5)\n" + 
32312
		"	bar(map);\n" + 
32313
		"	^^^\n" + 
32314
		"The method bar(Map<U,Map<U,V>>) in the type X is not applicable for the arguments (Map<String,Map>)\n" + 
32315
		"----------\n");
32316
}	
32317
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32318
public void test1010() {
32319
	this.runNegativeTest(
32320
		new String[] {
32321
			"X.java",
32322
			"import java.util.Map;\n" + 
32323
			"public class X {\n" + 
32324
			"\n" + 
32325
			"	void foo(Map<String,Map> map) {\n" + 
32326
			"		bar(map);\n" + 
32327
			"	}\n" + 
32328
			"	<U,V> void bar(Map<U,? extends Map<U,V>> map) {\n" + 
32329
			"	}\n" + 
32330
			"}\n", // =================
32331
		},
32332
		"----------\n" + 
32333
		"1. WARNING in X.java (at line 4)\n" + 
32334
		"	void foo(Map<String,Map> map) {\n" + 
32335
		"	                    ^^^\n" + 
32336
		"Map is a raw type. References to generic type Map<K,V> should be parameterized\n" + 
32337
		"----------\n" + 
32338
		"2. ERROR in X.java (at line 5)\n" + 
32339
		"	bar(map);\n" + 
32340
		"	^^^\n" + 
32341
		"The method bar(Map<U,? extends Map<U,V>>) in the type X is not applicable for the arguments (Map<String,Map>)\n" + 
32342
		"----------\n");
32343
}
32344
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32345
public void test1011() {
32346
	this.runNegativeTest(
32347
		new String[] {
32348
			"X.java",
32349
			"import java.util.*;\n" + 
32350
			"public class X {\n" + 
32351
			"	void foo(HashMap map, String s, Map<String,String> map2) {\n" + 
32352
			"		bar(map, s, map2); //1\n" + 
32353
			"		bar(map2, s, map2); //2\n" + 
32354
			"		bar2(map, s, map2); //3\n" + 
32355
			"		bar3(map, s, map2); //4\n" + 
32356
			"	}\n" + 
32357
			"	<U> void bar(Map<U,U> map, U u, Map<U,U> map2) {}\n" + 
32358
			"	void bar2(Map<String,String> map, String s, Map<String,String> map2) {}\n" + 
32359
			"	<U> void bar3(Map<String,String> map, U s, Map<U,U> map2) {}\n" + 
32360
			"}\n", // =================
32361
		},
32362
		"----------\n" + 
32363
		"1. WARNING in X.java (at line 3)\n" + 
32364
		"	void foo(HashMap map, String s, Map<String,String> map2) {\n" + 
32365
		"	         ^^^^^^^\n" + 
32366
		"HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized\n" + 
32367
		"----------\n" + 
32368
		"2. WARNING in X.java (at line 4)\n" + 
32369
		"	bar(map, s, map2); //1\n" + 
32370
		"	^^^^^^^^^^^^^^^^^\n" + 
32371
		"Type safety: Unchecked invocation bar(Map, Object, Map) of the generic method bar(Map<U,U>, U, Map<U,U>) of type X\n" + 
32372
		"----------\n" + 
32373
		"3. WARNING in X.java (at line 4)\n" + 
32374
		"	bar(map, s, map2); //1\n" + 
32375
		"	    ^^^\n" + 
32376
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<U,U>\n" + 
32377
		"----------\n" + 
32378
		"4. WARNING in X.java (at line 6)\n" + 
32379
		"	bar2(map, s, map2); //3\n" + 
32380
		"	     ^^^\n" + 
32381
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + 
32382
		"----------\n" + 
32383
		"5. WARNING in X.java (at line 7)\n" + 
32384
		"	bar3(map, s, map2); //4\n" + 
32385
		"	     ^^^\n" + 
32386
		"Type safety: The expression of type HashMap needs unchecked conversion to conform to Map<String,String>\n" + 
32387
		"----------\n");
32388
}
32389
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32390
public void test1012() {
32391
	this.runNegativeTest(
32392
		new String[] {
32393
			"X.java",
32394
			"public class X {\n" + 
32395
			"	void foo(L l, C<X> c) {\n" + 
32396
			"		X x = bar1(l, c);\n" + 
32397
			"		L<X> lx = bar2(l, c);\n" + 
32398
			"		C<X> cx = bar3(l, c);\n" + 
32399
			"	}\n" + 
32400
			"	<T> T bar1(L<T> l, C<T> c) {\n" + 
32401
			"		return null;\n" + 
32402
			"	}\n" + 
32403
			"	<T> L<T> bar2(L<T> l, C<T> c) {\n" + 
32404
			"		return null;\n" + 
32405
			"	}\n" + 
32406
			"	<T> C<T> bar3(L<T> l, C<T> c) {\n" + 
32407
			"		return null;\n" + 
32408
			"	}\n" + 
32409
			"}\n" + 
32410
			"\n" + 
32411
			"class C<E> {}\n" + 
32412
			"class L<E> {}\n", // =================
32413
		},
32414
		"----------\n" + 
32415
		"1. WARNING in X.java (at line 2)\r\n" + 
32416
		"	void foo(L l, C<X> c) {\r\n" + 
32417
		"	         ^\n" + 
32418
		"L is a raw type. References to generic type L<E> should be parameterized\n" + 
32419
		"----------\n" + 
32420
		"2. WARNING in X.java (at line 3)\r\n" + 
32421
		"	X x = bar1(l, c);\r\n" + 
32422
		"	      ^^^^^^^^^^\n" + 
32423
		"Type safety: Unchecked invocation bar1(L, C) of the generic method bar1(L<T>, C<T>) of type X\n" + 
32424
		"----------\n" + 
32425
		"3. ERROR in X.java (at line 3)\r\n" + 
32426
		"	X x = bar1(l, c);\r\n" + 
32427
		"	      ^^^^^^^^^^\n" + 
32428
		"Type mismatch: cannot convert from Object to X\n" + 
32429
		"----------\n" + 
32430
		"4. WARNING in X.java (at line 3)\r\n" + 
32431
		"	X x = bar1(l, c);\r\n" + 
32432
		"	           ^\n" + 
32433
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + 
32434
		"----------\n" + 
32435
		"5. WARNING in X.java (at line 4)\r\n" + 
32436
		"	L<X> lx = bar2(l, c);\r\n" + 
32437
		"	          ^^^^^^^^^^\n" + 
32438
		"Type safety: Unchecked invocation bar2(L, C) of the generic method bar2(L<T>, C<T>) of type X\n" + 
32439
		"----------\n" + 
32440
		"6. WARNING in X.java (at line 4)\r\n" + 
32441
		"	L<X> lx = bar2(l, c);\r\n" + 
32442
		"	          ^^^^^^^^^^\n" + 
32443
		"Type safety: The expression of type L needs unchecked conversion to conform to L<X>\n" + 
32444
		"----------\n" + 
32445
		"7. WARNING in X.java (at line 4)\r\n" + 
32446
		"	L<X> lx = bar2(l, c);\r\n" + 
32447
		"	               ^\n" + 
32448
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + 
32449
		"----------\n" + 
32450
		"8. WARNING in X.java (at line 5)\r\n" + 
32451
		"	C<X> cx = bar3(l, c);\r\n" + 
32452
		"	          ^^^^^^^^^^\n" + 
32453
		"Type safety: Unchecked invocation bar3(L, C) of the generic method bar3(L<T>, C<T>) of type X\n" + 
32454
		"----------\n" + 
32455
		"9. WARNING in X.java (at line 5)\r\n" + 
32456
		"	C<X> cx = bar3(l, c);\r\n" + 
32457
		"	          ^^^^^^^^^^\n" + 
32458
		"Type safety: The expression of type C needs unchecked conversion to conform to C<X>\n" + 
32459
		"----------\n" + 
32460
		"10. WARNING in X.java (at line 5)\r\n" + 
32461
		"	C<X> cx = bar3(l, c);\r\n" + 
32462
		"	               ^\n" + 
32463
		"Type safety: The expression of type L needs unchecked conversion to conform to L<T>\n" + 
32464
		"----------\n");
32465
}
32466
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32467
public void test1013() {
32468
	this.runNegativeTest(
32469
		new String[] {
32470
			"X.java",
32471
			"import java.util.*;\n" + 
32472
			"\n" + 
32473
			"public class X {\n" + 
32474
			"	public static void main(String[] args) {\n" + 
32475
			"		List<String> ls = new ArrayList<String>();\n" + 
32476
			"		ls.add(\"foo\");\n" + 
32477
			"		List<X> lx = new ArrayList<X>();\n" + 
32478
			"		lx.add(new X());\n" + 
32479
			"		new X().foo(ls, lx);\n" + 
32480
			"	}\n" + 
32481
			"	void done() {\n" + 
32482
			"		System.out.println(\"[done]\");\n" + 
32483
			"	}\n" + 
32484
			"	void foo(List l1, List<X> l2) {\n" + 
32485
			"		X x = bar1(l1, l2);\n" + 
32486
			"		x.done();\n" + 
32487
			"		List<X> lx = bar2(l1, l2);\n" + 
32488
			"		lx.get(0).done();\n" + 
32489
			"	}\n" + 
32490
			"	<T> T bar1(List<T> l1, List<T> l2) {\n" + 
32491
			"		return l1.get(0);\n" + 
32492
			"	}\n" + 
32493
			"	<T> List<T> bar2(List<T> l1, List<T> l2) {\n" + 
32494
			"		return l1;\n" + 
32495
			"	}\n" + 
32496
			"}\n", // =================
32497
		},
32498
		"----------\n" + 
32499
		"1. WARNING in X.java (at line 14)\r\n" + 
32500
		"	void foo(List l1, List<X> l2) {\r\n" + 
32501
		"	         ^^^^\n" + 
32502
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
32503
		"----------\n" + 
32504
		"2. WARNING in X.java (at line 15)\r\n" + 
32505
		"	X x = bar1(l1, l2);\r\n" + 
32506
		"	      ^^^^^^^^^^^^\n" + 
32507
		"Type safety: Unchecked invocation bar1(List, List) of the generic method bar1(List<T>, List<T>) of type X\n" + 
32508
		"----------\n" + 
32509
		"3. ERROR in X.java (at line 15)\r\n" + 
32510
		"	X x = bar1(l1, l2);\r\n" + 
32511
		"	      ^^^^^^^^^^^^\n" + 
32512
		"Type mismatch: cannot convert from Object to X\n" + 
32513
		"----------\n" + 
32514
		"4. WARNING in X.java (at line 15)\r\n" + 
32515
		"	X x = bar1(l1, l2);\r\n" + 
32516
		"	           ^^\n" + 
32517
		"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + 
32518
		"----------\n" + 
32519
		"5. WARNING in X.java (at line 17)\r\n" + 
32520
		"	List<X> lx = bar2(l1, l2);\r\n" + 
32521
		"	             ^^^^^^^^^^^^\n" + 
32522
		"Type safety: Unchecked invocation bar2(List, List) of the generic method bar2(List<T>, List<T>) of type X\n" + 
32523
		"----------\n" + 
32524
		"6. WARNING in X.java (at line 17)\r\n" + 
32525
		"	List<X> lx = bar2(l1, l2);\r\n" + 
32526
		"	             ^^^^^^^^^^^^\n" + 
32527
		"Type safety: The expression of type List needs unchecked conversion to conform to List<X>\n" + 
32528
		"----------\n" + 
32529
		"7. WARNING in X.java (at line 17)\r\n" + 
32530
		"	List<X> lx = bar2(l1, l2);\r\n" + 
32531
		"	                  ^^\n" + 
32532
		"Type safety: The expression of type List needs unchecked conversion to conform to List<T>\n" + 
32533
		"----------\n");
32534
}
32535
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32536
public void test1014() {
32537
	this.runNegativeTest(
32538
		new String[] {
32539
			"X.java",
32540
			"import java.util.*;\n" + 
32541
			"\n" + 
32542
			"public class X {\n" + 
32543
			"	void foo1(List l, List<String> ls) {\n" + 
32544
			"		Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
32545
			"		String s = bar(l, ls).entrySet();\n" + 
32546
			"	}\n" + 
32547
			"	<U,V> Map<U,V> bar(List<U> lu, List<V> lv) { return null; }\n" + 
32548
			"}\n", // =================
32549
		},
32550
		"----------\n" + 
32551
		"1. WARNING in X.java (at line 4)\n" + 
32552
		"	void foo1(List l, List<String> ls) {\n" + 
32553
		"	          ^^^^\n" + 
32554
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
32555
		"----------\n" + 
32556
		"2. WARNING in X.java (at line 5)\n" + 
32557
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
32558
		"	                                     ^^^^^^^^^^\n" + 
32559
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + 
32560
		"----------\n" + 
32561
		"3. WARNING in X.java (at line 5)\n" + 
32562
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
32563
		"	                                     ^^^^^^^^^^^^^^^^^^^^^\n" + 
32564
		"Type safety: The expression of type Set needs unchecked conversion to conform to Set<Map.Entry<String,String>>\n" + 
32565
		"----------\n" + 
32566
		"4. WARNING in X.java (at line 5)\n" + 
32567
		"	Set<Map.Entry<String,String>> mss1 = bar(l, ls).entrySet();\n" + 
32568
		"	                                         ^\n" + 
32569
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + 
32570
		"----------\n" + 
32571
		"5. WARNING in X.java (at line 6)\n" + 
32572
		"	String s = bar(l, ls).entrySet();\n" + 
32573
		"	           ^^^^^^^^^^\n" + 
32574
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + 
32575
		"----------\n" + 
32576
		"6. ERROR in X.java (at line 6)\n" + 
32577
		"	String s = bar(l, ls).entrySet();\n" + 
32578
		"	           ^^^^^^^^^^^^^^^^^^^^^\n" + 
32579
		"Type mismatch: cannot convert from Set to String\n" + 
32580
		"----------\n" + 
32581
		"7. WARNING in X.java (at line 6)\n" + 
32582
		"	String s = bar(l, ls).entrySet();\n" + 
32583
		"	               ^\n" + 
32584
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + 
32585
		"----------\n");
32586
}
32587
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32588
public void test1015() {
32589
	this.runNegativeTest(
32590
		new String[] {
32591
			"X.java",
32592
			"import java.util.*;\n" + 
32593
			"public class X {\n" + 
32594
			"	void foo1(List l, List<String> ls) {\n" + 
32595
			"		List<String> ls1 = bar(l, ls);\n" + 
32596
			"		String s = bar(l, ls);\n" + 
32597
			"	}\n" + 
32598
			"	<U,V> List<V> bar(List<U> lu, List<V> lv) { return null; }\n" + 
32599
			"}\n", // =================
32600
		},
32601
		"----------\n" + 
32602
		"1. WARNING in X.java (at line 3)\n" + 
32603
		"	void foo1(List l, List<String> ls) {\n" + 
32604
		"	          ^^^^\n" + 
32605
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
32606
		"----------\n" + 
32607
		"2. WARNING in X.java (at line 4)\n" + 
32608
		"	List<String> ls1 = bar(l, ls);\n" + 
32609
		"	                   ^^^^^^^^^^\n" + 
32610
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + 
32611
		"----------\n" + 
32612
		"3. WARNING in X.java (at line 4)\n" + 
32613
		"	List<String> ls1 = bar(l, ls);\n" + 
32614
		"	                   ^^^^^^^^^^\n" + 
32615
		"Type safety: The expression of type List needs unchecked conversion to conform to List<String>\n" + 
32616
		"----------\n" + 
32617
		"4. WARNING in X.java (at line 4)\n" + 
32618
		"	List<String> ls1 = bar(l, ls);\n" + 
32619
		"	                       ^\n" + 
32620
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + 
32621
		"----------\n" + 
32622
		"5. WARNING in X.java (at line 5)\n" + 
32623
		"	String s = bar(l, ls);\n" + 
32624
		"	           ^^^^^^^^^^\n" + 
32625
		"Type safety: Unchecked invocation bar(List, List) of the generic method bar(List<U>, List<V>) of type X\n" + 
32626
		"----------\n" + 
32627
		"6. ERROR in X.java (at line 5)\n" + 
32628
		"	String s = bar(l, ls);\n" + 
32629
		"	           ^^^^^^^^^^\n" + 
32630
		"Type mismatch: cannot convert from List to String\n" + 
32631
		"----------\n" + 
32632
		"7. WARNING in X.java (at line 5)\n" + 
32633
		"	String s = bar(l, ls);\n" + 
32634
		"	               ^\n" + 
32635
		"Type safety: The expression of type List needs unchecked conversion to conform to List<U>\n" + 
32636
		"----------\n");
32637
}
32638
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32639
public void test1016() {
32640
	this.runNegativeTest(
32641
		new String[] {
32642
			"X.java",
32643
			"import java.util.*;\n" + 
32644
			"public class X {\n" + 
32645
			"	void foo1() {\n" + 
32646
			"		List ls1 = bar(null);\n" + 
32647
			"		List<String> ls2 = bar(null);\n" + 
32648
			"		String s = bar(null);\n" + 
32649
			"	}\n" + 
32650
			"	<U> List<U> bar(List<U> lu) { return null; }\n" + 
32651
			"}\n", // =================
32652
		},
32653
		"----------\n" + 
32654
		"1. WARNING in X.java (at line 4)\n" + 
32655
		"	List ls1 = bar(null);\n" + 
32656
		"	^^^^\n" + 
32657
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
32658
		"----------\n" + 
32659
		"2. ERROR in X.java (at line 6)\n" + 
32660
		"	String s = bar(null);\n" + 
32661
		"	           ^^^^^^^^^\n" + 
32662
		"Type mismatch: cannot convert from List<Object> to String\n" + 
32663
		"----------\n");
32664
}
32665
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32666
public void test1017() {
32667
	this.runNegativeTest(
32668
		new String[] {
32669
			"SortedList.java",
32670
			"import java.util.*;\n" + 
32671
			"\n" + 
32672
			"public class SortedList<E extends Comparable> extends LinkedList<E>\n" + 
32673
			"{\n" + 
32674
			"    public boolean add(E e){\n" + 
32675
			"      int index = Collections.binarySearch(this,e);\n" + 
32676
			"      if (index<0)\n" + 
32677
			"      super.add(-index-1,e);\n" + 
32678
			"      return true;\n" + 
32679
			"  }\n" + 
32680
			"}", // =================
32681
		},
32682
		"----------\n" + 
32683
		"1. WARNING in SortedList.java (at line 3)\n" + 
32684
		"	public class SortedList<E extends Comparable> extends LinkedList<E>\n" + 
32685
		"	             ^^^^^^^^^^\n" + 
32686
		"The serializable class SortedList does not declare a static final serialVersionUID field of type long\n" + 
32687
		"----------\n" + 
32688
		"2. WARNING in SortedList.java (at line 3)\n" + 
32689
		"	public class SortedList<E extends Comparable> extends LinkedList<E>\n" + 
32690
		"	                                  ^^^^^^^^^^\n" + 
32691
		"Comparable is a raw type. References to generic type Comparable<T> should be parameterized\n" + 
32692
		"----------\n" + 
32693
		"3. WARNING in SortedList.java (at line 5)\n" + 
32694
		"	public boolean add(E e){\n" + 
32695
		"	               ^^^^^^^^\n" + 
32696
		"The method add(E) of type SortedList<E> should be tagged with @Override since it actually overrides a superclass method\n" + 
32697
		"----------\n" + 
32698
		"4. ERROR in SortedList.java (at line 6)\n" + 
32699
		"	int index = Collections.binarySearch(this,e);\n" + 
32700
		"	                        ^^^^^^^^^^^^\n" + 
32701
		"The method binarySearch(List<? extends Comparable<? super T>>, T) in the type Collections is not applicable for the arguments (SortedList<E>, E)\n" + 
32702
		"----------\n");
32703
}
32704
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148061 - variation
32705
public void test1018() {
32706
	this.runConformTest(
32707
		new String[] {
32708
			"X.java",
32709
			"public class X<U,V> {\n" + 
32710
			"\n" + 
32711
			"	void foo(U u) {\n" + 
32712
			"		bar(u, new Exception());\n" + 
32713
			"	}\n" + 
32714
			"	<T extends Exception> T bar(U u, T t) { return null; }\n" + 
32715
			"}", // =================
32716
		},
32717
		"");
32718
}
32719
// **
32720
public void test1018a() {
32721
	this.runConformTest(
32722
		new String[] {
32723
			"X.java",
32724
			"class A<T> {}\n" + 
32725
			"\n" + 
32726
			"class B<E> extends A<X<String>> {}\n" + 
32727
			"\n" + 
32728
			"public class X<E extends String> extends B<E> {\n" +
32729
			"    public static void main(String[] args) {\n" + 
32730
			"        System.out.println(\"SUCCESS\");\n" + 
32731
			"    }\n" + 
32732
			"}"
32733
		}, 
32734
		"SUCCESS");
32735
}
32736
public void test1019() {
32737
	this.runNegativeTest(
32738
		new String[] {
32739
			"X.java",
32740
			"public class X {\n" + 
32741
			"	public static void main(String[] args) {\n" + 
32742
			"		double[] d1 = new double[] { 1.0, 2.0, 3.0, 4.0 };\n" + 
32743
			"		System.out.println(deepToString(d1));\n" + 
32744
			"\n" + 
32745
			"		Double[] d2 = new Double[] { 1.0, 2.0, 3.0, 4.0 };\n" + 
32746
			"		System.out.println(deepToString(d2));\n" + 
32747
			"	\n" + 
32748
			"	}\n" + 
32749
			"\n" + 
32750
			"	public static <T> String deepToString(T[] array) {\n" + 
32751
			"		StringBuffer s = new StringBuffer();\n" + 
32752
			"		for (T t : array) {\n" + 
32753
			"			s.append(t.toString());\n" + 
32754
			"			s.append(\",\");\n" + 
32755
			"		}\n" + 
32756
			"		if (s.length() > 0) {\n" + 
32757
			"			s.setLength(s.length() - 1); // removes last \",\"\n" + 
32758
			"		}\n" + 
32759
			"		return s.toString();\n" + 
32760
			"	}\n" + 
32761
			"}\n", // =================
32762
		},
32763
		"----------\n" + 
32764
		"1. ERROR in X.java (at line 4)\n" + 
32765
		"	System.out.println(deepToString(d1));\n" + 
32766
		"	                   ^^^^^^^^^^^^\n" + 
32767
		"The method deepToString(T[]) in the type X is not applicable for the arguments (double[])\n" + 
32768
		"----------\n");
32769
}
32770
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=149573
32771
public void test1020() {
32772
	this.runNegativeTest(
32773
		new String[] {
32774
			"X.java",
32775
			"import java.util.List;\n" + 
32776
			"\n" + 
32777
			"public class X {\n" + 
32778
			"	void foo(List<? extends Exception> l1, List<? extends Exception> l2) {\n" + 
32779
			"		l1.add(l2.get(0));\n" + 
32780
			"	}\n" + 
32781
			"}\n", // =================
32782
		},
32783
		"----------\n" + 
32784
		"1. ERROR in X.java (at line 5)\n" + 
32785
		"	l1.add(l2.get(0));\n" + 
32786
		"	   ^^^\n" + 
32787
		"The method add(capture#1-of ? extends Exception) in the type List<capture#1-of ? extends Exception> is not applicable for the arguments (capture#2-of ? extends Exception)\n" + 
32788
		"----------\n");
32789
}
32790
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=149376
32791
public void test1021() {
32792
	this.runConformTest(
32793
		new String[] {
32794
			"p/SomeClass.java",
32795
			"package p;\n" + 
32796
			"import static p.SomeClass.SomeEnum.*;\n" + 
32797
			"public abstract class SomeClass<T> extends Object {\n" + 
32798
			"	public enum SomeEnum {\n" +
32799
			"		A;\n" + 
32800
			"	};\n" + 
32801
			"}\n",
32802
		},
32803
		""
32804
	);
32805
}
32806
public void test1021b() { // should this case be allowed?
32807
	this.runNegativeTest(
32808
		new String[] {
32809
			"p/SomeClass2.java",
32810
			"package p;\n" + 
32811
			"import static p.SomeClass2.M1.*;\n" + 
32812
			"public abstract class SomeClass2<T> extends M {\n" + 
32813
			"	public static class M1 extends M2 {}\n" + 
32814
			"	public static class M2 extends M3 {}\n" + 
32815
			"	public static class M3 {\n" +
32816
			"		public static class M {}\n" + 
32817
			"	}\n" + 
32818
			"}\n",
32819
		},
32820
		"----------\n" + 
32821
		"1. ERROR in p\\SomeClass2.java (at line 3)\n" + 
32822
		"	public abstract class SomeClass2<T> extends M {\n" + 
32823
		"	                                            ^\n" + 
32824
		"Cycle detected: the type SomeClass2<T> cannot extend/implement itself or one of its own member types\n" + 
32825
		"----------\n"
32826
	);
32827
}
32828
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=151410 (duplicate of 149376)
32829
public void test1021c() {
32830
	runConformTest(
32831
		new String[] {
32832
			"ccs/jdtbug/filters/NameRF.java",
32833
			"package ccs.jdtbug.filters;\n" + 
32834
			"import static ccs.jdtbug.ResultFilter.Action.*;\n" + 
32835
			"import ccs.jdtbug.*;\n" + 
32836
			"public class NameRF implements ResultFilter<String> {\n" + 
32837
			"	public NameRF() {}\n" + 
32838
			"	public Action getAction(String in, int ntotal, int naccept) {\n" + 
32839
			"		return YES;\n" + 
32840
			"	}\n" + 
32841
			"} // end class\n",
32842
			"ccs/jdtbug/ResultFilter.java",
32843
			"package ccs.jdtbug;\n" + 
32844
			"import java.io.*;\n" + 
32845
			"public interface ResultFilter<T> {\n" + 
32846
			"	public enum Action {\n" + 
32847
			"		YES, NO, CANCEL\n" + 
32848
			"	}\n" + 
32849
			"	public Action getAction(T in, int ntotal, int naccept) throws IOException;\n" + 
32850
			"} // end interface\n"
32851
		}
32852
	);
32853
}
32854
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150294
32855
public void test1022() {
32856
	this.runNegativeTest(
32857
		new String[] {
32858
			"X.java",
32859
			"public class X {\n" + 
32860
			"	public static void main(String[] args) {\n" + 
32861
			"		String testString = \"test string\";\n" + 
32862
			"\n" + 
32863
			"		testWithNonGeneric(testString);\n" + 
32864
			"		testWithGeneric(testString);\n" + 
32865
			"	}\n" + 
32866
			"\n" + 
32867
			"	private static void testWithNonGeneric(String input) {\n" + 
32868
			"		Class<? extends String> clazz = input.getClass();\n" + 
32869
			"\n" + 
32870
			"		System.out.println(clazz.getName());\n" + 
32871
			"	}\n" + 
32872
			"\n" + 
32873
			"	private static <T> void testWithGeneric(T input) {\n" + 
32874
			"		Class<? extends T> clazz = input.getClass();\n" + 
32875
			"\n" + 
32876
			"		System.out.println(clazz.getName());\n" + 
32877
			"	}\n" + 
32878
			"}", // =================,
32879
		},
32880
		"----------\n" + 
32881
		"1. ERROR in X.java (at line 16)\n" + 
32882
		"	Class<? extends T> clazz = input.getClass();\n" + 
32883
		"	                           ^^^^^^^^^^^^^^^^\n" + 
32884
		"Type mismatch: cannot convert from Class<capture#3-of ? extends Object> to Class<? extends T>\n" + 
32885
		"----------\n");
32886
}
32887
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150362
32888
public void test1023() {
32889
	this.runNegativeTest(
32890
		new String[] {
32891
			"X.java",
32892
			"import java.util.Map;\n" + 
32893
			"import java.util.Properties;\n" + 
32894
			"\n" + 
32895
			"public class X {\n" + 
32896
			"\n" + 
32897
			"	public static void main(String[] args) {\n" + 
32898
			"		Properties props = new Properties();\n" + 
32899
			"		for (Map.Entry<String, ?> entry : props.entrySet()) {\n" + 
32900
			"			System.out.println(entry);\n" + 
32901
			"		}\n" + 
32902
			"		for (Map.Entry<String, ?> entry : ((Map<String, ?>) props).entrySet()) {\n" + 
32903
			"			System.out.println(entry);\n" + 
32904
			"		}\n" + 
32905
			"		for (Map.Entry<Object, ?> entry : ((Map<Object, ?>) props).entrySet()) {\n" + 
32906
			"			System.out.println(entry);\n" + 
32907
			"		}\n" + 
32908
			"		for (Map.Entry<Object, ?> entry : props.entrySet()) {\n" + 
32909
			"			System.out.println(entry);\n" + 
32910
			"		}\n" + 
32911
			"		for (Map.Entry<?, ?> entry : ((Map<?, ?>) props).entrySet()) {\n" + 
32912
			"			System.out.println(entry);\n" + 
32913
			"		}\n" + 
32914
			"		for (Map.Entry<?, ?> entry : props.entrySet()) {\n" + 
32915
			"			System.out.println(entry);\n" + 
32916
			"		}\n" + 
32917
			"	}\n" + 
32918
			"}", // =================,
32919
		},
32920
		"----------\n" + 
32921
		"1. ERROR in X.java (at line 8)\n" + 
32922
		"	for (Map.Entry<String, ?> entry : props.entrySet()) {\n" + 
32923
		"	                                  ^^^^^^^^^^^^^^^^\n" + 
32924
		"Type mismatch: cannot convert from element type Map.Entry<Object,Object> to Map.Entry<String,?>\n" + 
32925
		"----------\n" + 
32926
		"2. ERROR in X.java (at line 11)\n" + 
32927
		"	for (Map.Entry<String, ?> entry : ((Map<String, ?>) props).entrySet()) {\n" + 
32928
		"	                                  ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
32929
		"Cannot cast from Properties to Map<String,?>\n" + 
32930
		"----------\n");
32931
}
32932
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=151275
32933
public void test1024() {
32934
	this.runConformTest(
32935
		new String[] {
32936
			"X.java",
32937
			"public class X {\n" + 
32938
			"	public static void main(String[] args) {\n" + 
32939
			"		Integer castInteger = genericCast(1); // works\n" + 
32940
			"		int castInt1 = genericCast(1); // fails in javac but works in Eclipse\n" + 
32941
			"		int castInt2 = X.<Integer> genericCast(1); // workaround for javac\n" + 
32942
			"		int castInt3 = (Integer) genericCast(1); // workaround for javac\n" + 
32943
			"	}\n" + 
32944
			"	private static <T> T genericCast(Object input) {\n" + 
32945
			"		@SuppressWarnings(\"unchecked\")\n" + 
32946
			"		T castValue = (T) input;\n" + 
32947
			"		return castValue;\n" + 
32948
			"	}\n" + 
32949
			"}", // =================,
32950
		},
32951
		"");
32952
}
32953
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155753
32954
public void test1025() {
32955
	this.runConformTest(
32956
		new String[] {
32957
			"GenericBaseClass.java",
32958
			"public class GenericBaseClass<P, C> {\n" + 
32959
			"  public GenericBaseClass() {\n" + 
32960
			"    if (!(this instanceof ASubGenericClass)) {\n" + 
32961
			"      System.out.println(\"I\'m not ASubClass\");\n" + 
32962
			"    }\n" + 
32963
			"  }\n" + 
32964
			"}\n" + 
32965
			"\n" + 
32966
			"class ASubGenericClass extends GenericBaseClass<GenericBaseClass, GenericBaseClass> {\n" + 
32967
			"  public ASubGenericClass() {\n" + 
32968
			"    // This compiles with both\n" + 
32969
			"    GenericBaseClass<GenericBaseClass, GenericBaseClass> hey = this;\n" + 
32970
			"  }\n" + 
32971
			"}", // =================
32972
		},
32973
		"");
32974
}
32975
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155753
32976
// **
32977
public void test1026() {
32978
	this.runConformTest(
32979
		new String[] {
32980
			"X.java",
32981
			"import java.util.LinkedHashSet;\n" + 
32982
			"import java.util.Set;\n" + 
32983
			"\n" + 
32984
			"public class X {\n" + 
32985
			"\n" + 
32986
			"    public class A {};\n" + 
32987
			"    public class B extends A {};\n" + 
32988
			"\n" + 
32989
			"	public static void main(String[] args) {\n" + 
32990
			"        X g = new X();\n" + 
32991
			"        Set<A> set = g.newSet(g.new B());\n" + 
32992
			"    }\n" + 
32993
			"    public <T, V extends T> Set<T> newSet(V v) {\n" + 
32994
			"        Set<T> set = new LinkedHashSet<T>();\n" + 
32995
			"        set.add(v);\n" + 
32996
			"        return set;\n" + 
32997
			"    }\n" + 
32998
			"}\n" // =================
32999
		},
33000
		"");
33001
}
33002
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155753 - variation
33003
// **
33004
public void test1027() {
33005
	this.runConformTest(
33006
		new String[] {
33007
			"X.java",
33008
			"import java.util.LinkedHashSet;\n" + 
33009
			"import java.util.Set;\n" + 
33010
			"\n" + 
33011
			"public class X {\n" + 
33012
			"\n" + 
33013
			"    public class A {};\n" + 
33014
			"    public class B extends A {};\n" + 
33015
			"\n" + 
33016
			"    public static void main(String[] args) {\n" + 
33017
			"        X g = new X();\n" + 
33018
			"        Set<A> set = g.newSet(g.new B());\n" + 
33019
			"    }\n" + 
33020
			"    public <T, V extends T> Set<T> newSet(V... objects) {\n" + 
33021
			"        Set<T> set = new LinkedHashSet<T>();\n" + 
33022
			"        for (T t : objects) {\n" + 
33023
			"            set.add(t);\n" + 
33024
			"        }\n" + 
33025
			"        return set;\n" + 
33026
			"    }\n" + 
33027
			"}\n" + 
33028
			"\n", // =================
33029
		},
33030
		"");
33031
}
33032
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155753 - variation
33033
// **
33034
public void test1028() {
33035
	this.runConformTest(
33036
		new String[] {
33037
			"X.java",
33038
			"import java.util.LinkedHashSet;\n" + 
33039
			"import java.util.Set;\n" + 
33040
			"\n" + 
33041
			"public class X {\n" + 
33042
			"\n" + 
33043
			"	public static void main(String[] args) {\n" + 
33044
			"        X g = new X();\n" + 
33045
			"        Set<A> set = g.newSet(new B());\n" + 
33046
			"    }\n" + 
33047
			"    public <T, V extends T> Set<T> newSet(V v) {\n" + 
33048
			"        Set<T> set = new LinkedHashSet<T>();\n" + 
33049
			"        set.add(v);\n" + 
33050
			"        return set;\n" + 
33051
			"    }\n" + 
33052
			"}\n" + 
33053
			"\n" + 
33054
			"class A {};\n" + 
33055
			"class B extends A {};\n", // =================
33056
		},
33057
		"");
33058
}
33059
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=156016
33060
public void test1029() {
33061
	this.runNegativeTest(
33062
		new String[] {
33063
			"X.java",
33064
			"import java.util.Arrays;\n" + 
33065
			"import java.util.List;\n" + 
33066
			"\n" + 
33067
			"public class X {\n" + 
33068
			"        public static <T extends Number> List<T> makeNumberList(T a, T b) {\n" + 
33069
			"                return Arrays.asList(a, b);\n" + 
33070
			"        }\n" + 
33071
			"\n" + 
33072
			"        public static void main(String... args) {\n" + 
33073
			"                List<Number> name = makeNumberList(5, 5D);\n" + 
33074
			"        }\n" + 
33075
			"}", // =================
33076
		},
33077
		"----------\n" + 
33078
		"1. WARNING in X.java (at line 6)\n" + 
33079
		"	return Arrays.asList(a, b);\n" + 
33080
		"	       ^^^^^^^^^^^^^^^^^^^\n" + 
33081
		"Type safety : A generic array of T is created for a varargs parameter\n" + 
33082
		"----------\n" + 
33083
		"2. ERROR in X.java (at line 10)\n" + 
33084
		"	List<Number> name = makeNumberList(5, 5D);\n" + 
33085
		"	                    ^^^^^^^^^^^^^^^^^^^^^\n" + 
33086
		"Type mismatch: cannot convert from List<Number&Comparable<?>> to List<Number>\n" + 
33087
		"----------\n");
33088
}
33089
public void test1030() {
33090
	this.runConformTest(
33091
		new String[] {
33092
			"X.java",
33093
			"import java.util.*;\n" + 
33094
			"\n" + 
33095
			"public class X {\n" + 
33096
			"	public class PointList<W> extends Object implements Iterable<W> {\n" + 
33097
			"		private List<W> theList = new ArrayList<W>();\n" + 
33098
			"\n" + 
33099
			"		public Iterator<W> iterator() {\n" + 
33100
			"			return theList.iterator();\n" + 
33101
			"		}\n" + 
33102
			"	}\n" + 
33103
			"\n" + 
33104
			"	private PointList<Waypoint> waypoints = new PointList<Waypoint>();\n" + 
33105
			"\n" + 
33106
			"	public void printWaypoints() {\n" + 
33107
			"		for (Waypoint waypoint : waypoints) { // ***** This line does not compile *****\n" + 
33108
			"			System.out.println(waypoint.toString());\n" + 
33109
			"		}\n" + 
33110
			"		for (Iterator<Waypoint> it = waypoints.iterator(); it.hasNext();) {\n" + 
33111
			"			Waypoint waypoint = it.next();\n" + 
33112
			"			System.out.println(waypoint.toString());\n" + 
33113
			"		}\n" + 
33114
			"	}\n" + 
33115
			"}\n" + 
33116
			"\n" + 
33117
			"class Waypoint {}", // =================
33118
		},
33119
		"");
33120
}
33121
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=156765
33122
public void test1031() {
33123
	this.runNegativeTest(
33124
		new String[] {
33125
			"X.java",
33126
			"import java.io.Serializable;\n" + 
33127
			"\n" + 
33128
			"interface IValue extends Serializable {\n" + 
33129
			"	public <T extends Comparable<? super T>> T getComparableValue();\n" + 
33130
			"}\n" + 
33131
			"\n" + 
33132
			"public class X {\n" + 
33133
			"	public static void foo0() {\n" + 
33134
			"		IValue val1 = null;\n" + 
33135
			"		Object o = val1.getComparableValue(); // 0\n" + 
33136
			"	}\n" + 
33137
			"	public static void foo1() {\n" + 
33138
			"		IValue val1 = null;\n" + 
33139
			"		String s = val1.getComparableValue(); // 1\n" + 
33140
			"	}\n" + 
33141
			"	public static int foo2() {\n" + 
33142
			"		IValue val1 = null;\n" + 
33143
			"		IValue val2 = null;\n" + 
33144
			"		return val1.getComparableValue().compareTo(val2.getComparableValue()); // 2\n" + 
33145
			"	}	\n" + 
33146
			"	public static int foo3() {\n" + 
33147
			"		Comparable<? super String> c = \"aaa\"; // 3\n" + 
33148
			"		Comparable<? super Object> o = new Object(); // 4\n" + 
33149
			"		return 0;\n" + 
33150
			"	}\n" + 
33151
			"}", // =================		
33152
		},
33153
		"----------\n" + 
33154
		"1. ERROR in X.java (at line 23)\n" + 
33155
		"	Comparable<? super Object> o = new Object(); // 4\n" + 
33156
		"	                               ^^^^^^^^^^^^\n" + 
33157
		"Type mismatch: cannot convert from Object to Comparable<? super Object>\n" + 
33158
		"----------\n");
33159
}
33160
// **
33161
public void test1032() {
33162
	this.runConformTest(
33163
		new String[] {
33164
			"X.java",
33165
			"import java.io.*;\n" + 
33166
			"\n" + 
33167
			"public class X {\n" + 
33168
			"	<T> T test(String name) {\n" + 
33169
			"\n" + 
33170
			"		try {\n" + 
33171
			"			InputStream in = new FileInputStream(name);\n" + 
33172
			"			return (T) new ObjectInputStream(in).readObject();\n" + 
33173
			"		} catch (Exception e) {\n" + 
33174
			"		}\n" + 
33175
			"		return null;\n" + 
33176
			"	}\n" + 
33177
			"\n" + 
33178
			"	<U> U text() {\n" + 
33179
			"		return test(\"data\");\n" + 
33180
			"	}\n" + 
33181
			"}", // =================
33182
		},
33183
		"");
33184
}
33185
// **
33186
public void test1032a() {
33187
	this.runNegativeTest(
33188
		new String[] {
33189
			"X.java",
33190
			"import java.io.*;\n" + 
33191
			"\n" + 
33192
			"public class X {\n" + 
33193
			"	<T> T test(String name) {\n" + 
33194
			"\n" + 
33195
			"		try {\n" + 
33196
			"			InputStream in = new FileInputStream(name);\n" + 
33197
			"			return (T) new ObjectInputStream(in).readObject();\n" + 
33198
			"		} catch (Exception e) {\n" + 
33199
			"		}\n" + 
33200
			"		return null;\n" + 
33201
			"	}\n" + 
33202
			"\n" + 
33203
			"	<U> U text() {\n" + 
33204
			"		return test(\"data\");\n" + 
33205
			"	}\n" + 
33206
			"	Zork z;\n" + 
33207
			"}", // =================
33208
		},
33209
		"----------\n" + 
33210
		"1. WARNING in X.java (at line 8)\n" + 
33211
		"	return (T) new ObjectInputStream(in).readObject();\n" + 
33212
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
33213
		"Type safety: Unchecked cast from Object to T\n" + 
33214
		"----------\n" + 
33215
		"2. ERROR in X.java (at line 17)\n" + 
33216
		"	Zork z;\n" + 
33217
		"	^^^^\n" + 
33218
		"Zork cannot be resolved to a type\n" + 
33219
		"----------\n");
33220
}
33221
public void test1033() {
33222
	this.runNegativeTest(
33223
		new String[] {
33224
			"X.java",
33225
			"public class X<T> {\n" + 
33226
			"	public static void main(String[] args) {\n" + 
33227
			"		X x = new X();\n" + 
33228
			"		x.bar1(Integer.TYPE);\n" + 
33229
			"		x.bar2(Integer.TYPE);\n" + 
33230
			"		x.bar2(\"\");\n" + 
33231
			"	} \n" + 
33232
			"	 void bar1(Class<?>... classes) {}\n" + 
33233
			"	 void bar2(Class... classes) {}\n" + 
33234
			"	 \n" + 
33235
			"}", // =================
33236
33237
		},
33238
		"----------\n" + 
33239
		"1. WARNING in X.java (at line 3)\n" + 
33240
		"	X x = new X();\n" + 
33241
		"	^\n" + 
33242
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
33243
		"----------\n" + 
33244
		"2. WARNING in X.java (at line 3)\n" + 
33245
		"	X x = new X();\n" + 
33246
		"	          ^\n" + 
33247
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
33248
		"----------\n" + 
33249
		"3. WARNING in X.java (at line 4)\n" + 
33250
		"	x.bar1(Integer.TYPE);\n" + 
33251
		"	^^^^^^^^^^^^^^^^^^^^\n" + 
33252
		"Type safety: The method bar1(Class...) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
33253
		"----------\n" + 
33254
		"4. ERROR in X.java (at line 6)\n" + 
33255
		"	x.bar2(\"\");\n" + 
33256
		"	  ^^^^\n" + 
33257
		"The method bar2(Class...) in the type X is not applicable for the arguments (String)\n" + 
33258
		"----------\n" + 
33259
		"5. WARNING in X.java (at line 9)\n" + 
33260
		"	void bar2(Class... classes) {}\n" + 
33261
		"	          ^^^^^\n" + 
33262
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" + 
33263
		"----------\n");
33264
}
33265
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158519
33266
// **
33267
public void test1034() {
33268
	this.runNegativeTest(
33269
		new String[] {
33270
			"ChainedClosure.java",
33271
			"interface Closure<I> {\n" + 
33272
			"    public void execute(I input);\n" + 
33273
			"}\n" + 
33274
			"\n" + 
33275
			"class ChainedClosure<I> implements Closure<I> {\n" + 
33276
			"    private final Closure<? super I>[] iClosures;\n" + 
33277
			"    @SuppressWarnings(\"unchecked\")\n" + 
33278
			"    public static <I> Closure<I> getInstance(Closure<? super I> closure1, Closure<? super I> closure2) {\n" + 
33279
			"        if (closure1 == null || closure2 == null) {\n" + 
33280
			"            throw new IllegalArgumentException(\"Closures must not be null\");\n" + 
33281
			"        }\n" + 
33282
			"        Closure<I>[] closures = new Closure[] { closure1, closure2 };\n" + 
33283
			"        return new ChainedClosure<I>(closures);\n" + 
33284
			"    }\n" + 
33285
			"    public ChainedClosure(Closure<? super I>[] closures) {\n" + 
33286
			"        super();\n" + 
33287
			"        iClosures = closures;\n" + 
33288
			"    }\n" + 
33289
			"    public void execute(I input) {\n" + 
33290
			"        for (int i = 0; i < iClosures.length; i++) {\n" + 
33291
			"            iClosures[i].execute(input);\n" + 
33292
			"        }\n" + 
33293
			"    }\n" + 
33294
			"}\n" + 
33295
			"class ClosureUtils {\n" + 
33296
			"    public static <J> Closure<J> chainedClosure(Closure<? super J> closure1, Closure<? super J> closure2) {\n" + 
33297
			"        return ChainedClosure.getInstance(closure1, closure2);\n" + 
33298
			"    }\n" + 
33299
			"    public static Closure<String> chainedClosure2(Closure<? super String> closure1, Closure<? super String> closure2) {\n" + 
33300
			"        return ChainedClosure.getInstance(closure1, closure2);\n" + 
33301
			"    }\n" + 
33302
			"    public static <J> Closure<String> chainedClosure3(Closure<? super J> closure1, Closure<? super J> closure2) {\n" + 
33303
			"        return ChainedClosure.getInstance(closure1, closure2);\n" + 
33304
			"    }\n" + 
33305
			"}", // =================
33306
33307
		},
33308
		"----------\n" + 
33309
		"1. ERROR in ChainedClosure.java (at line 33)\n" + 
33310
		"	return ChainedClosure.getInstance(closure1, closure2);\n" + 
33311
		"	                      ^^^^^^^^^^^\n" + 
33312
		"The method getInstance(Closure<? super I>, Closure<? super I>) in the type ChainedClosure is not applicable for the arguments (Closure<capture#10-of ? super J>, Closure<capture#11-of ? super J>)\n" + 
33313
		"----------\n");
33314
}
33315
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158531
33316
public void test1035() {
33317
	this.runNegativeTest(
33318
		new String[] {
33319
			"ComparableComparator.java",
33320
			"import java.util.Comparator;\n" + 
33321
			"\n" + 
33322
			"@SuppressWarnings(\"unchecked\")\n" + 
33323
			"class ComparableComparator<T extends Comparable<? super T>> implements Comparator<T> {\n" + 
33324
			"\n" + 
33325
			"	static ComparableComparator instance = new ComparableComparator();\n" + 
33326
			"\n" + 
33327
			"public static <W extends Comparable<? super W>> ComparableComparator<W> getInstance() {\n" + 
33328
			"	return instance;\n" + 
33329
			"}\n" + 
33330
			"static <M extends Comparable<M>> Comparator<M> bar() {\n" + 
33331
			"	return null;\n" + 
33332
			"}\n" + 
33333
			"static <M extends String> Comparator<M> baz() {\n" + 
33334
			"	return null;\n" + 
33335
			"}\n" + 
33336
			"public int compare(T obj1, T obj2) {\n" + 
33337
			"	return obj1.compareTo(obj2);\n" + 
33338
			"}\n" + 
33339
			"}\n" + 
33340
			"\n" + 
33341
			"@SuppressWarnings(\"unchecked\")\n" + 
33342
			"class ComparatorUtils {\n" + 
33343
			"\n" + 
33344
			"	static Comparator BAR = ComparableComparator.bar();//0\n" + 
33345
			"	static Comparator NATURAL_COMPARATOR = ComparableComparator.getInstance();//1\n" + 
33346
			"	static Object BAR2 = ComparableComparator.bar();//1a\n" + 
33347
			"	static Comparator BAR3 = ComparableComparator.baz();//1b\n" + 
33348
			"\n" + 
33349
			"public static <T extends Comparable<? super T>> Comparator<T> naturalComparator() {\n" + 
33350
			"	return NATURAL_COMPARATOR;\n" + 
33351
			"}\n" + 
33352
			"\n" + 
33353
			"public static <U> Comparator<U> nullLowComparator(Comparator<U> comparator) {\n" + 
33354
			"	if (comparator == null)\n" + 
33355
			"		comparator = (Comparator<U>) naturalComparator();//2\n" + 
33356
			"	return new NullComparator<U>(comparator, false);\n" + 
33357
			"}\n" + 
33358
			"}\n" + 
33359
			"\n" + 
33360
			"@SuppressWarnings(\"unchecked\")\n" + 
33361
			"class NullComparator<V> implements Comparator<V> {\n" + 
33362
			"\n" + 
33363
			"	Comparator<V> nonNullComparator;\n" + 
33364
			"	boolean nullsAreHigh;\n" + 
33365
			"\n" + 
33366
			"public NullComparator() {\n" + 
33367
			"	this((Comparator<V>) ComparableComparator.getInstance(), true);//3\n" + 
33368
			"}\n" + 
33369
			"\n" + 
33370
			"public NullComparator(Comparator<V> nonNullComparator) {\n" + 
33371
			"	this(nonNullComparator, true);\n" + 
33372
			"}\n" + 
33373
			"\n" + 
33374
			"public NullComparator(boolean nullsAreHigh) {\n" + 
33375
			"	this((Comparator<V>) ComparableComparator.getInstance(), nullsAreHigh);//4\n" + 
33376
			"}\n" + 
33377
			"\n" + 
33378
			"public NullComparator(Comparator<V> nonNullComparator, boolean nullsAreHigh) {\n" + 
33379
			"	this.nonNullComparator = nonNullComparator;\n" + 
33380
			"	this.nullsAreHigh = nullsAreHigh;\n" + 
33381
			"	if (nonNullComparator == null) {\n" + 
33382
			"		throw new NullPointerException(\"null nonNullComparator\");\n" + 
33383
			"	}\n" + 
33384
			"}\n" + 
33385
			"\n" + 
33386
			"public int compare(V obj1, V obj2) {\n" + 
33387
			"	return 0;\n" + 
33388
			"}\n" + 
33389
			"}", // =================
33390
33391
		},
33392
		"----------\n" + 
33393
		"1. WARNING in ComparableComparator.java (at line 14)\n" + 
33394
		"	static <M extends String> Comparator<M> baz() {\n" + 
33395
		"	                  ^^^^^^\n" + 
33396
		"The type parameter M should not be bounded by the final type String. Final types cannot be further extended\n" + 
33397
		"----------\n" + 
33398
		"2. ERROR in ComparableComparator.java (at line 27)\n" + 
33399
		"	static Object BAR2 = ComparableComparator.bar();//1a\n" + 
33400
		"	                                          ^^^\n" + 
33401
		"Bound mismatch: The generic method bar() of type ComparableComparator<T> is not applicable for the arguments (). The inferred type Comparable<Comparable<M>> is not a valid substitute for the bounded parameter <M extends Comparable<M>>\n" + 
33402
		"----------\n");
33403
}
33404
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158548
33405
public void test1036() {
33406
	this.runNegativeTest(
33407
		new String[] {
33408
			"X.java",
33409
			"public class X<T extends String> {\n" + 
33410
			"	\n" + 
33411
			"	List<Zork> list;\n" + 
33412
			"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33413
			"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33414
			"	\n" + 
33415
			"	p.q.Map.Entry entry3;\n" + 
33416
			"	\n" + 
33417
			"	String<Object>.Y<List> y; // wrong\n" + 
33418
			"	X<Object>.Y<List> y1; // wrong\n" + 
33419
			"	X<String>.Y<List> y2;\n" + 
33420
			"}", // =================
33421
		},
33422
		"----------\n" + 
33423
		"1. WARNING in X.java (at line 1)\n" + 
33424
		"	public class X<T extends String> {\n" + 
33425
		"	                         ^^^^^^\n" + 
33426
		"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
33427
		"----------\n" + 
33428
		"2. ERROR in X.java (at line 3)\n" + 
33429
		"	List<Zork> list;\n" + 
33430
		"	^^^^\n" + 
33431
		"List cannot be resolved to a type\n" + 
33432
		"----------\n" + 
33433
		"3. ERROR in X.java (at line 3)\n" + 
33434
		"	List<Zork> list;\n" + 
33435
		"	     ^^^^\n" + 
33436
		"Zork cannot be resolved to a type\n" + 
33437
		"----------\n" + 
33438
		"4. ERROR in X.java (at line 4)\n" + 
33439
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33440
		"	^^^\n" + 
33441
		"Map cannot be resolved to a type\n" + 
33442
		"----------\n" + 
33443
		"5. ERROR in X.java (at line 4)\n" + 
33444
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33445
		"	    ^^^^\n" + 
33446
		"Zork cannot be resolved to a type\n" + 
33447
		"----------\n" + 
33448
		"6. ERROR in X.java (at line 4)\n" + 
33449
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33450
		"	         ^^^^\n" + 
33451
		"Zork cannot be resolved to a type\n" + 
33452
		"----------\n" + 
33453
		"7. ERROR in X.java (at line 4)\n" + 
33454
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33455
		"	                     ^^^^\n" + 
33456
		"List cannot be resolved to a type\n" + 
33457
		"----------\n" + 
33458
		"8. ERROR in X.java (at line 4)\n" + 
33459
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33460
		"	                          ^^^^\n" + 
33461
		"Zork cannot be resolved to a type\n" + 
33462
		"----------\n" + 
33463
		"9. ERROR in X.java (at line 4)\n" + 
33464
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33465
		"	                                ^^^^\n" + 
33466
		"List cannot be resolved to a type\n" + 
33467
		"----------\n" + 
33468
		"10. ERROR in X.java (at line 4)\n" + 
33469
		"	Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry;\n" + 
33470
		"	                                     ^^^^\n" + 
33471
		"Zork cannot be resolved to a type\n" + 
33472
		"----------\n" + 
33473
		"11. ERROR in X.java (at line 5)\n" + 
33474
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33475
		"	^^^^^^\n" + 
33476
		"jaavaa cannot be resolved to a type\n" + 
33477
		"----------\n" + 
33478
		"12. ERROR in X.java (at line 5)\n" + 
33479
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33480
		"	                ^^^^\n" + 
33481
		"Zork cannot be resolved to a type\n" + 
33482
		"----------\n" + 
33483
		"13. ERROR in X.java (at line 5)\n" + 
33484
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33485
		"	                     ^^^^\n" + 
33486
		"Zork cannot be resolved to a type\n" + 
33487
		"----------\n" + 
33488
		"14. ERROR in X.java (at line 5)\n" + 
33489
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33490
		"	                                 ^^^^\n" + 
33491
		"List cannot be resolved to a type\n" + 
33492
		"----------\n" + 
33493
		"15. ERROR in X.java (at line 5)\n" + 
33494
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33495
		"	                                      ^^^^\n" + 
33496
		"Zork cannot be resolved to a type\n" + 
33497
		"----------\n" + 
33498
		"16. ERROR in X.java (at line 5)\n" + 
33499
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33500
		"	                                            ^^^^\n" + 
33501
		"List cannot be resolved to a type\n" + 
33502
		"----------\n" + 
33503
		"17. ERROR in X.java (at line 5)\n" + 
33504
		"	jaavaa.util.Map<Zork,Zork>.Entry<List<Zork>,List<Zork>>	entry2;\n" + 
33505
		"	                                                 ^^^^\n" + 
33506
		"Zork cannot be resolved to a type\n" + 
33507
		"----------\n" + 
33508
		"18. ERROR in X.java (at line 7)\n" + 
33509
		"	p.q.Map.Entry entry3;\n" + 
33510
		"	^\n" + 
33511
		"p cannot be resolved to a type\n" + 
33512
		"----------\n" + 
33513
		"19. ERROR in X.java (at line 9)\n" + 
33514
		"	String<Object>.Y<List> y; // wrong\n" + 
33515
		"	^^^^^^\n" + 
33516
		"The type String is not generic; it cannot be parameterized with arguments <Object>\n" + 
33517
		"----------\n" + 
33518
		"20. ERROR in X.java (at line 10)\n" + 
33519
		"	X<Object>.Y<List> y1; // wrong\n" + 
33520
		"	^^^^^^^^^^^\n" + 
33521
		"X.Y cannot be resolved to a type\n" + 
33522
		"----------\n" + 
33523
		"21. ERROR in X.java (at line 10)\n" + 
33524
		"	X<Object>.Y<List> y1; // wrong\n" + 
33525
		"	  ^^^^^^\n" + 
33526
		"Bound mismatch: The type Object is not a valid substitute for the bounded parameter <T extends String> of the type X<T>\n" + 
33527
		"----------\n" + 
33528
		"22. ERROR in X.java (at line 10)\n" + 
33529
		"	X<Object>.Y<List> y1; // wrong\n" + 
33530
		"	            ^^^^\n" + 
33531
		"List cannot be resolved to a type\n" + 
33532
		"----------\n" + 
33533
		"23. ERROR in X.java (at line 11)\n" + 
33534
		"	X<String>.Y<List> y2;\n" + 
33535
		"	^^^^^^^^^^^\n" + 
33536
		"X.Y cannot be resolved to a type\n" + 
33537
		"----------\n" + 
33538
		"24. ERROR in X.java (at line 11)\n" + 
33539
		"	X<String>.Y<List> y2;\n" + 
33540
		"	            ^^^^\n" + 
33541
		"List cannot be resolved to a type\n" + 
33542
		"----------\n");
33543
}
33544
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=158548 - variation
33545
public void test1037() {
33546
	this.runNegativeTest(
33547
		new String[] {
33548
			"X.java",
33549
			"public class X<T extends String> {\n" + 
33550
			"	\n" + 
33551
			"	List<? extends Zork> list;\n" + 
33552
			"	Map.Entry<?,? super Zork>	entry;\n" + 
33553
			"}", // =================
33554
		},
33555
		"----------\n" + 
33556
		"1. WARNING in X.java (at line 1)\n" + 
33557
		"	public class X<T extends String> {\n" + 
33558
		"	                         ^^^^^^\n" + 
33559
		"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + 
33560
		"----------\n" + 
33561
		"2. ERROR in X.java (at line 3)\n" + 
33562
		"	List<? extends Zork> list;\n" + 
33563
		"	^^^^\n" + 
33564
		"List cannot be resolved to a type\n" + 
33565
		"----------\n" + 
33566
		"3. ERROR in X.java (at line 3)\n" + 
33567
		"	List<? extends Zork> list;\n" + 
33568
		"	               ^^^^\n" + 
33569
		"Zork cannot be resolved to a type\n" + 
33570
		"----------\n" + 
33571
		"4. ERROR in X.java (at line 4)\n" + 
33572
		"	Map.Entry<?,? super Zork>	entry;\n" + 
33573
		"	^^^\n" + 
33574
		"Map cannot be resolved to a type\n" + 
33575
		"----------\n" + 
33576
		"5. ERROR in X.java (at line 4)\n" + 
33577
		"	Map.Entry<?,? super Zork>	entry;\n" + 
33578
		"	                    ^^^^\n" + 
33579
		"Zork cannot be resolved to a type\n" + 
33580
		"----------\n");
33581
}
33582
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159021 - variation
33583
public void test1038() {
33584
	Map options = getCompilerOptions();
33585
	options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
33586
	this.runConformTest(
33587
		new String[] {
33588
			"X.java",
33589
			"interface I<T> {\n" + 
33590
			"    int CONST = A.foo();\n" + 
33591
			"}\n" + 
33592
			"\n" + 
33593
			"class A<U> {\n" + 
33594
			"        static int foo() {\n" + 
33595
			"        System.out.println(\"SUCCESS\");\n" + 
33596
			"        return 0;\n" + 
33597
			"    }\n" + 
33598
			"}\n" + 
33599
			"class B<V> implements I<V> {\n" + 
33600
			"	static int LOCAL_STATIC;\n" + 
33601
			"	int local_field;\n" + 
33602
			"    B(int param) {\n" + 
33603
			"        int i = CONST; // keep for possible <clinit>\n" + 
33604
			"        int j = param; // may optimize out\n" + 
33605
			"        int k = LOCAL_STATIC; // may optimize out\n" + 
33606
			"        int l = local_field; // may optimize out\n" + 
33607
			"    }\n" + 
33608
			"}\n" + 
33609
			"public class X {\n" + 
33610
			"    public static void main(String[] args) {\n" + 
33611
			"        new B<String>(12);\n" + 
33612
			"    }\n" + 
33613
			"}", // =================
33614
		}, 
33615
		"SUCCESS",
33616
		null,
33617
		false,
33618
		null,
33619
		options,
33620
		null);
33621
	// check the reference to I.CONST still got generated (for <clinit> invocation side-effect)
33622
	String expectedOutput = 
33623
		"  // Method descriptor #10 (I)V\n" + 
33624
		"  // Stack: 1, Locals: 2\n" + 
33625
		"  B(int param);\n" + 
33626
		"    0  aload_0 [this]\n" + 
33627
		"    1  invokespecial java.lang.Object() [12]\n" + 
33628
		"    4  getstatic B.CONST : int [15]\n" + 
33629
		"    7  pop\n" + 
33630
		"    8  return\n" + 
33631
		"      Line numbers:\n" + 
33632
		"        [pc: 0, line: 14]\n" + 
33633
		"        [pc: 4, line: 15]\n" + 
33634
		"        [pc: 8, line: 19]\n" + 
33635
		"      Local variable table:\n" + 
33636
		"        [pc: 0, pc: 9] local: this index: 0 type: B\n" + 
33637
		"        [pc: 0, pc: 9] local: param index: 1 type: int\n";
33638
33639
	try {
33640
		File f = new File(OUTPUT_DIR + File.separator + "B.class");
33641
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
33642
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
33643
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
33644
		int index = result.indexOf(expectedOutput);
33645
		if (index == -1 || expectedOutput.length() == 0) {
33646
			System.out.println(Util.displayString(result, 3));
33647
		}
33648
		if (index == -1) {
33649
			assertEquals("Wrong contents", expectedOutput, result);
33650
		}
33651
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
33652
		assertTrue(false);
33653
	} catch (IOException e) {
33654
		assertTrue(false);
33655
	}			
33656
}
33657
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159021 - variation
33658
public void test1039() {
33659
	Map options = getCompilerOptions();
33660
	options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
33661
	this.runConformTest(
33662
		new String[] {
33663
			"X.java",
33664
			"interface I<T> {\n" + 
33665
			"	Value<String> CONST = A.foo(\"[I.CONST]\");\n" + 
33666
			"}\n" + 
33667
			"class Value<V> {\n" + 
33668
			"	static String NAME = \"\";\n" + 
33669
			"	V v;\n" + 
33670
			"	Value(V v) {\n" + 
33671
			"		this.v = v;\n" + 
33672
			"	}\n" + 
33673
			"}\n" + 
33674
			"class A {\n" + 
33675
			"	static Value<String> foo(String str) {\n" + 
33676
			"		System.out.print(str);\n" + 
33677
			"		return new Value<String>(\"str\");\n" + 
33678
			"	}\n" + 
33679
			"}\n" + 
33680
			"class B<V> implements I<V> {\n" + 
33681
			"	static Value<String> LOCAL_STATIC = A.foo(\"[B.LOCAL_STATIC]\");\n" + 
33682
			"	Value<String> local_field = A.foo(\"[B.local_field]\");\n" + 
33683
			"	B(Value<String> param) {\n" + 
33684
			"		String i = CONST.NAME; // keep for possible <clinit>\n" + 
33685
			"		String j = param.NAME; // may optimize out\n" + 
33686
			"		String k = LOCAL_STATIC.NAME; // may optimize out\n" + 
33687
			"		String l = local_field.NAME; // may optimize out\n" + 			
33688
			"	}\n" + 
33689
			"}\n" + 
33690
			"public class X {\n" + 
33691
			"	public static void main(String[] args) {\n" + 
33692
			"		new B<String>(new Value<String>(\"[PARAM]\"));\n" + 
33693
			"	}\n" + 
33694
			"}", // =================
33695
		}, 
33696
		"[B.LOCAL_STATIC][B.local_field][I.CONST]",
33697
		null,
33698
		false,
33699
		null,
33700
		options,
33701
		null);
33702
	// check the reference to I.CONST still got generated (for <clinit> invocation side-effect)
33703
	String expectedOutput = 
33704
		"  // Method descriptor #28 (LValue;)V\n" + 
33705
		"  // Signature: (LValue<Ljava/lang/String;>;)V\n" + 
33706
		"  // Stack: 2, Locals: 2\n" + 
33707
		"  B(Value param);\n" + 
33708
		"     0  aload_0 [this]\n" + 
33709
		"     1  invokespecial java.lang.Object() [30]\n" + 
33710
		"     4  aload_0 [this]\n" + 
33711
		"     5  ldc <String \"[B.local_field]\"> [32]\n" + 
33712
		"     7  invokestatic A.foo(java.lang.String) : Value [17]\n" + 
33713
		"    10  putfield B.local_field : Value [34]\n" + 
33714
		"    13  getstatic B.CONST : Value [36]\n" + 
33715
		"    16  pop\n" + 
33716
		"    17  getstatic Value.NAME : java.lang.String [39]\n" + 
33717
		"    20  pop\n" + 
33718
		"    21  getstatic Value.NAME : java.lang.String [39]\n" + 
33719
		"    24  pop\n" + 
33720
		"    25  getstatic Value.NAME : java.lang.String [39]\n" + 
33721
		"    28  pop\n" + 
33722
		"    29  getstatic Value.NAME : java.lang.String [39]\n" + 
33723
		"    32  pop\n" + 
33724
		"    33  return\n" + 
33725
		"      Line numbers:\n" + 
33726
		"        [pc: 0, line: 20]\n" + 
33727
		"        [pc: 4, line: 19]\n" + 
33728
		"        [pc: 13, line: 21]\n" + 
33729
		"        [pc: 21, line: 22]\n" + 
33730
		"        [pc: 25, line: 23]\n" + 
33731
		"        [pc: 29, line: 24]\n" + 
33732
		"        [pc: 33, line: 25]\n" + 
33733
		"      Local variable table:\n" + 
33734
		"        [pc: 0, pc: 34] local: this index: 0 type: B\n" + 
33735
		"        [pc: 0, pc: 34] local: param index: 1 type: Value\n";
33736
33737
	try {
33738
		File f = new File(OUTPUT_DIR + File.separator + "B.class");
33739
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
33740
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
33741
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
33742
		int index = result.indexOf(expectedOutput);
33743
		if (index == -1 || expectedOutput.length() == 0) {
33744
			System.out.println(Util.displayString(result, 3));
33745
		}
33746
		if (index == -1) {
33747
			assertEquals("Wrong contents", expectedOutput, result);
33748
		}
33749
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
33750
		assertTrue(false);
33751
	} catch (IOException e) {
33752
		assertTrue(false);
33753
	}			
33754
}
33755
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159021 - variation
33756
public void test1040() {
33757
	Map options = getCompilerOptions();
33758
	options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
33759
	this.runConformTest(
33760
		new String[] {
33761
			"X.java",
33762
			"interface I<T> {\n" + 
33763
			"	Value<String> CONST = A.foo(\"[I.CONST]\");\n" + 
33764
			"}\n" + 
33765
			"class Value<V> {\n" + 
33766
			"	static String NAME = \"\";\n" + 
33767
			"	V v;\n" + 
33768
			"	Value(V v) {\n" + 
33769
			"		this.v = v;\n" + 
33770
			"	}\n" + 
33771
			"}\n" + 
33772
			"class A {\n" + 
33773
			"	static Value<String> foo(String str) {\n" + 
33774
			"		System.out.print(str);\n" + 
33775
			"		return new Value<String>(\"str\");\n" + 
33776
			"	}\n" + 
33777
			"}\n" + 
33778
			"class B<V> implements I<V> {\n" + 
33779
			"	static Value<String> LOCAL_STATIC = A.foo(\"[B.LOCAL_STATIC]\");\n" + 
33780
			"	Value<String> local_field = A.foo(\"[B.local_field]\");\n" + 
33781
			"	B(Value<String> param) {\n" + 
33782
			"		String i = this.CONST.NAME; // keep for possible <clinit>\n" + 
33783
			"		String k = this.LOCAL_STATIC.NAME; // may optimize out\n" + 
33784
			"		String l = this.local_field.NAME; // may optimize out\n" + 			
33785
			"	}\n" + 
33786
			"}\n" + 
33787
			"public class X {\n" + 
33788
			"	public static void main(String[] args) {\n" + 
33789
			"		new B<String>(new Value<String>(\"[PARAM]\"));\n" + 
33790
			"	}\n" + 
33791
			"}", // =================
33792
		}, 
33793
		"[B.LOCAL_STATIC][B.local_field][I.CONST]",
33794
		null,
33795
		false,
33796
		null,
33797
		options,
33798
		null);
33799
	// check the reference to I.CONST still got generated (for <clinit> invocation side-effect)
33800
	String expectedOutput = 
33801
		"  // Method descriptor #28 (LValue;)V\n" + 
33802
		"  // Signature: (LValue<Ljava/lang/String;>;)V\n" + 
33803
		"  // Stack: 2, Locals: 2\n" + 
33804
		"  B(Value param);\n" + 
33805
		"     0  aload_0 [this]\n" + 
33806
		"     1  invokespecial java.lang.Object() [30]\n" + 
33807
		"     4  aload_0 [this]\n" + 
33808
		"     5  ldc <String \"[B.local_field]\"> [32]\n" + 
33809
		"     7  invokestatic A.foo(java.lang.String) : Value [17]\n" + 
33810
		"    10  putfield B.local_field : Value [34]\n" + 
33811
		"    13  getstatic B.CONST : Value [36]\n" + 
33812
		"    16  pop\n" + 
33813
		"    17  getstatic Value.NAME : java.lang.String [39]\n" + 
33814
		"    20  pop\n" + 
33815
		"    21  getstatic Value.NAME : java.lang.String [39]\n" + 
33816
		"    24  pop\n" + 
33817
		"    25  getstatic Value.NAME : java.lang.String [39]\n" + 
33818
		"    28  pop\n" + 
33819
		"    29  return\n" + 
33820
		"      Line numbers:\n" + 
33821
		"        [pc: 0, line: 20]\n" + 
33822
		"        [pc: 4, line: 19]\n" + 
33823
		"        [pc: 13, line: 21]\n" + 
33824
		"        [pc: 21, line: 22]\n" + 
33825
		"        [pc: 25, line: 23]\n" + 
33826
		"        [pc: 29, line: 24]\n" + 
33827
		"      Local variable table:\n" + 
33828
		"        [pc: 0, pc: 30] local: this index: 0 type: B\n" + 
33829
		"        [pc: 0, pc: 30] local: param index: 1 type: Value\n";
33830
33831
	try {
33832
		File f = new File(OUTPUT_DIR + File.separator + "B.class");
33833
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
33834
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
33835
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
33836
		int index = result.indexOf(expectedOutput);
33837
		if (index == -1 || expectedOutput.length() == 0) {
33838
			System.out.println(Util.displayString(result, 3));
33839
		}
33840
		if (index == -1) {
33841
			assertEquals("Wrong contents", expectedOutput, result);
33842
		}
33843
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
33844
		assertTrue(false);
33845
	} catch (IOException e) {
33846
		assertTrue(false);
33847
	}			
33848
}
33849
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159245
33850
public void test1041() {
33851
	this.runNegativeTest(
33852
		new String[] {
33853
			"p/X.java",
33854
			"package p;\n" + 
33855
			"\n" + 
33856
			"public class X<T> {\n" + 
33857
			"	{\n" + 
33858
			"		X rawx = null;\n" + 
33859
			"		X[] rawxs = { rawx };\n" + 
33860
			"		System.out.println(rawxs.length);\n" + 
33861
			"	}\n" + 
33862
			"	{\n" + 
33863
			"		p.X rawx = null;\n" + 
33864
			"		p.X[] rawxs = { rawx };\n" + 
33865
			"		System.out.println(rawxs.length);\n" + 
33866
			"	}\n" + 
33867
			"	Zork z;\n" +
33868
			"}", // =================
33869
		}, 
33870
		"----------\n" + 
33871
		"1. WARNING in p\\X.java (at line 5)\n" + 
33872
		"	X rawx = null;\n" + 
33873
		"	^\n" + 
33874
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
33875
		"----------\n" + 
33876
		"2. WARNING in p\\X.java (at line 6)\n" + 
33877
		"	X[] rawxs = { rawx };\n" + 
33878
		"	^\n" + 
33879
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
33880
		"----------\n" + 
33881
		"3. WARNING in p\\X.java (at line 10)\n" + 
33882
		"	p.X rawx = null;\n" + 
33883
		"	^^^\n" + 
33884
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
33885
		"----------\n" + 
33886
		"4. WARNING in p\\X.java (at line 11)\n" + 
33887
		"	p.X[] rawxs = { rawx };\n" + 
33888
		"	^^^\n" + 
33889
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
33890
		"----------\n" + 
33891
		"5. ERROR in p\\X.java (at line 14)\n" + 
33892
		"	Zork z;\n" + 
33893
		"	^^^^\n" + 
33894
		"Zork cannot be resolved to a type\n" + 
33895
		"----------\n");
33896
}
33897
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159818
33898
public void test1042() {
33899
	this.runNegativeTest(
33900
		new String[] {
33901
			"X.java",
33902
			"public class X {\n" + 
33903
			"	public <T extends Object> void foo(T x) {\n" + 
33904
			"	    Class<? extends T> c = x.getClass();\n" + 
33905
			"	}\n" + 
33906
			"}\n", // =================
33907
		}, 
33908
		"----------\n" + 
33909
		"1. ERROR in X.java (at line 3)\n" + 
33910
		"	Class<? extends T> c = x.getClass();\n" + 
33911
		"	                       ^^^^^^^^^^^^\n" + 
33912
		"Type mismatch: cannot convert from Class<capture#1-of ? extends Object> to Class<? extends T>\n" + 
33913
		"----------\n");
33914
}
33915
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159214
33916
public void test1043() {
33917
	this.runNegativeTest(
33918
		new String[] {
33919
			"A.java",
33920
			"class A<T extends Number, S extends T> {\n" + 
33921
			"  T t;\n" + 
33922
			"  S s;\n" + 
33923
			"  void test(A<? extends Long, ? extends S> a) {\n" + 
33924
			"    this.t = this.s; //fine\n" + 
33925
			"    a.t = a.s;\n" + 
33926
			"  }\n" + 
33927
			"}", // =================
33928
		}, 
33929
		"----------\n" + 
33930
		"1. ERROR in A.java (at line 6)\n" + 
33931
		"	a.t = a.s;\n" + 
33932
		"	      ^^^\n" + 
33933
		"Type mismatch: cannot convert from capture#4-of ? extends S to capture#1-of ? extends Long\n" + 
33934
		"----------\n");
33935
}
33936
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159214
33937
public void test1044() {
33938
	this.runNegativeTest(
33939
		new String[] {
33940
			"X.java",
33941
			"class X<T extends Number> {\n" + 
33942
			"    X<? extends Object> x;\n" + 
33943
			"}", // =================
33944
		}, 
33945
		"----------\n" + 
33946
		"1. ERROR in X.java (at line 2)\n" + 
33947
		"	X<? extends Object> x;\n" + 
33948
		"	  ^^^^^^^^^^^^^^^^\n" + 
33949
		"Bound mismatch: The type ? extends Object is not a valid substitute for the bounded parameter <T extends Number> of the type X<T>\n" + 
33950
		"----------\n");
33951
}
33952
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159214
33953
public void test1045() {
33954
	this.runConformTest(
33955
		new String[] {
33956
			"X.java",
33957
			"class X<T extends Number, S extends T> {\n" + 
33958
			"        X<? extends Long,? extends S> x;\n" + 
33959
			"}",
33960
		}, 
33961
		"");
33962
}
33963
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132
33964
public void test1046() {
33965
	this.runConformTest(
33966
		new String[] {
33967
			"X.java", //========================
33968
			"public interface X<E extends Object & X.Entry> {\n" + 
33969
			"  interface Entry {\n" + 
33970
			"    interface Internal extends Entry {\n" + 
33971
			"      Internal createEntry();\n" + 
33972
			"    }\n" + 
33973
			"  }\n" + 
33974
			"}\n", //========================
33975
			"Y.java",
33976
			"public class Y implements X.Entry.Internal {\n" + 
33977
			"  public Internal createEntry() {\n" + 
33978
			"    return null;\n" + 
33979
			"  }\n" + 
33980
			"}\n" , //========================
33981
		}, 
33982
		"");
33983
	// compile Y against X binary
33984
	this.runConformTest(
33985
			new String[] {
33986
				"Y.java", //========================
33987
				"public class Y implements X.Entry.Internal {\n" + 
33988
				"  public Internal createEntry() {\n" + 
33989
				"    return null;\n" + 
33990
				"  }\n" + 
33991
				"}\n" , //========================
33992
			}, 
33993
			"",
33994
			null,
33995
			false,
33996
			null);	
33997
}
33998
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 - variation
33999
public void test1047() {
34000
	this.runConformTest(
34001
		new String[] {
34002
			"p/X.java", //========================
34003
			"package p;\n" +
34004
			"public interface X<E extends Object & X.Entry> {\n" + 
34005
			"  interface Entry {\n" + 
34006
			"    interface Internal extends Entry {\n" + 
34007
			"      Internal createEntry();\n" + 
34008
			"    }\n" + 
34009
			"  }\n" + 
34010
			"}\n", //========================
34011
			"Y.java",
34012
			"import p.X.Entry.Internal;\n" +
34013
			"public class Y implements Internal {\n" + 
34014
			"  public Internal createEntry() {\n" + 
34015
			"    return null;\n" + 
34016
			"  }\n" + 
34017
			"}\n" , //========================
34018
		}, 
34019
		"");
34020
	// compile Y against X binary
34021
	this.runConformTest(
34022
			new String[] {
34023
				"Y.java", //========================
34024
				"import p.X.Entry.Internal;\n" +
34025
				"public class Y implements Internal {\n" + 
34026
				"  public Internal createEntry() {\n" + 
34027
				"    return null;\n" + 
34028
				"  }\n" + 
34029
				"}\n" , //========================
34030
			}, 
34031
			"",
34032
			null,
34033
			false,
34034
			null);	
34035
}
34036
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 - variation
34037
public void test1048() {
34038
	this.runConformTest(
34039
		new String[] {
34040
			"X.java", //========================
34041
			"public interface X {\n" + 
34042
			"  static class Entry {\n" + 
34043
			"    static abstract class Internal extends Entry {\n" + 
34044
			"      abstract Internal createEntry();\n" + 
34045
			"    }\n" + 
34046
			"  }\n" + 
34047
			"}\n", //========================
34048
			"Y.java",
34049
			"public class Y extends  X.Entry.Internal {\n" + 
34050
			"  @Override public Internal createEntry() {\n" + 
34051
			"    return null;\n" + 
34052
			"  }\n" + 
34053
			"}\n" , //========================
34054
		}, 
34055
		"");
34056
	// compile Y against X binary
34057
	this.runConformTest(
34058
			new String[] {
34059
				"Y.java", //========================
34060
				"public class Y extends X.Entry.Internal {\n" + 
34061
				"  @Override public Internal createEntry() {\n" + 
34062
				"    return null;\n" + 
34063
				"  }\n" + 
34064
				"}\n" , //========================
34065
			}, 
34066
			"",
34067
			null,
34068
			false,
34069
			null);	
34070
}
34071
public void test1049() {
34072
	this.runConformTest(
34073
		new String[] {
34074
			"X.java", //========================
34075
			"import java.util.*;\n" + 
34076
			"public class X {\n" +
34077
			"}\n" +
34078
			"\n" + 
34079
			"//===================\n" + 
34080
			"interface FooHandle<T extends Foo<T>> extends BarHandle<T> {}\n" + 
34081
			"interface Foo<T extends Foo<T>> extends FooHandle<T>, Bar<T> {\n" + 
34082
			"	FooHandle<T> foo();\n" + 
34083
			"}\n" + 
34084
			"//===================\n" + 
34085
			"interface EveHandle<T extends Baz<T>> extends SimpleHandle {}\n" + 
34086
			"interface Eve<T extends Baz<T>> extends Simple, EveHandle<T> {\n" + 
34087
			"	List<BobHandle> foo();\n" + 
34088
			"	BazHandle<T> handles();\n" + 
34089
			"}\n" + 
34090
			"\n" + 
34091
			"//===================\n" + 
34092
			"interface BobHandle extends BillHandle {}\n" + 
34093
			"interface Bob extends BobHandle, Bill {}\n" + 
34094
			"\n" + 
34095
			"//===================\n" + 
34096
			"interface BarHandle<T extends Bar<T>> extends BazHandle<T> {\n" + 
34097
			"	boolean same(BarHandle<?> o);\n" + 
34098
			"}\n" + 
34099
			"interface Bar<T extends Bar<T>> extends Baz<T>, BarHandle<T> {\n" + 
34100
			"	BarHandle<T> handle();\n" + 
34101
			"}\n" + 
34102
			"\n" + 
34103
			"//===================\n" + 
34104
			"interface BazHandle<T extends Baz<T>> {\n" + 
34105
			"	T baz();\n" + 
34106
			"	boolean same(BazHandle<?> o);\n" + 
34107
			"}\n" + 
34108
			"interface Baz<T extends Baz<T>> extends BazHandle<T> {\n" + 
34109
			"	BazHandle<T> handle();\n" + 
34110
			"	T baz();\n" + 
34111
			"}\n" + 
34112
			"\n" + 
34113
			"//===================\n" + 
34114
			"interface BillHandle extends FooHandle<Bill> {}\n" + 
34115
			"interface Bill extends BillHandle, Foo<Bill> {}\n" + 
34116
			"\n" + 
34117
			"//===================\n" + 
34118
			"interface SimpleHandle extends BazHandle<Simple> {}\n" + 
34119
			"interface Simple extends Baz<Simple>, SimpleHandle {}\n" + 
34120
			"\n" + 
34121
			"//===================\n" + 
34122
			"interface KeyHandle extends FooHandle<Key> {}\n" + 
34123
			"interface Key extends Foo<Key>, KeyHandle {}\n" + 
34124
			"\n" + 
34125
			"//===================\n" + 
34126
			"interface ClydeHandle extends BillHandle {}\n" + 
34127
			"interface Clyde extends ClydeHandle, Bill {\n" + 
34128
			"	void add(BobHandle h);\n" + 
34129
			"	public List<BobHandle> handles();\n" + 
34130
			"}\n" + 
34131
			"\n" + 
34132
			"//===================\n" + 
34133
			"interface FredHandle<T extends Fred<T>> extends BarHandle<T> {}\n" + 
34134
			"interface Fred<T extends Fred<T>> extends FredHandle<T>, Bar<T> {}\n" + 
34135
			"\n", // =================
34136
		}, 
34137
		"");
34138
}
34139
public void test1050() {
34140
	String expectedOutput =
34141
		"xxx\n" + 
34142
    	"true\n" + 
34143
    	"ClassCastException: Object[] cannot be cast to String[]\n" + 
34144
    	"ClassCastException: Object[] cannot be cast to String[]";
34145
34146
	this.runConformTest(
34147
		new String[] {
34148
			"X.java", //========================
34149
			"class Container<E> {\n" + 
34150
			"  public Container() {\n" + 
34151
			"    data = (E[]) new Object[100];\n" + 
34152
			"  }\n" + 
34153
			"  protected E[] data;\n" + 
34154
			"  protected int size;\n" + 
34155
			"  E get(int index) {\n" + 
34156
			"    return data[index];\n" + 
34157
			"  }\n" + 
34158
			"  void add(E object) {\n" + 
34159
			"    data[size++] = object;\n" + 
34160
			"  }\n" + 
34161
			"  E[] data() {\n" + 
34162
			"    return data;\n" + 
34163
			"  }\n" + 
34164
			"}\n" + 
34165
			"class StringContainer extends Container<String> {\n" + 
34166
			"  public StringContainer() {\n" + 
34167
			"  }\n" + 
34168
			"  public void doSomething() {\n" + 
34169
			"    add(\"xxx\");\n" + 
34170
			"    System.out.println(get(0));\n" + 
34171
			"    System.out.println((\"\" + data()).\n" +
34172
			"      startsWith(\"[Ljava.lang.Object;@\"));\n" + 
34173
			"    try {\n" + 
34174
			"      System.out.println(data[0]);\n" + 
34175
			"    } catch (ClassCastException e) {\n" + 
34176
			"      System.out.println(\"ClassCastException: Object[] cannot be cast to String[]\");\n" + 
34177
			"    }\n" + 
34178
			"    try {\n" + 
34179
			"      System.out.println(data()[0]);\n" + 
34180
			"    } catch (ClassCastException e) {\n" + 
34181
			"      System.out.println(\"ClassCastException: Object[] cannot be cast to String[]\");\n" + 
34182
			"    }\n" + 
34183
			"  }\n" + 
34184
			"}\n" + 
34185
			"public class X {\n" + 
34186
			"  public static void main(String[] args) {\n" + 
34187
			"    StringContainer x = new StringContainer();\n" + 
34188
			"    x.doSomething();\n" + 
34189
			"  }\n" + 
34190
			"}", // =================
34191
		}, 
34192
		expectedOutput);
34193
}
34194
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114088
34195
public void test1051() {
34196
	this.runConformTest(
34197
		new String[] {
34198
			"X.java",
34199
			"import java.util.List;\n" + 
34200
			"\n" + 
34201
			"public class X {\n" + 
34202
			"	public interface Intf<N> {\n" + 
34203
			"		void foo(List<Conc<N>.Inner> ls);\n" + 
34204
			"	}\n" + 
34205
			"\n" + 
34206
			"	public class Conc<N> {\n" + 
34207
			"		Intf<N> impl;\n" + 
34208
			"		public Conc(Intf<N> impl) {\n" + 
34209
			"			this.impl = impl;\n" + 
34210
			"		}\n" + 
34211
			"		public class Inner { }\n" + 
34212
			"\n" + 
34213
			"		public void bar(List<Conc<N>.Inner> ls) {\n" + 
34214
			"			impl.foo(ls);\n" + 
34215
			"		}\n" + 
34216
			"	}\n" + 
34217
			"}",
34218
		}, 
34219
		"");
34220
}
34221
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=115691
34222
public void test1052() {
34223
	Map options = this.getCompilerOptions();
34224
	options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);
34225
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.ERROR);
34226
	options.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.ERROR);
34227
	this.runConformTest(
34228
		new String[] {
34229
			"X.java",
34230
			"public class X extends java.util.ArrayList<Integer> {\n" + 
34231
			"	private static final long serialVersionUID = 713223190582506215L;\n" + 
34232
			"	static void test() {\n" + 
34233
			"		java.util.ArrayList<?> a1 = new X();\n" + 
34234
			"		X b1 = (X) a1;\n" + 
34235
			"		X c1 = X.class.cast(a1);\n" + 
34236
			"		java.util.ArrayList<Integer> a2 = new X();\n" + 
34237
			"		X b2 = (X) a2;\n" + 
34238
			"	}\n" + 
34239
			"}",
34240
		}, 
34241
		"",
34242
		null,
34243
		true,
34244
		null,
34245
		options,
34246
		null);
34247
}
34248
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=122163
34249
public void test1053() {
34250
	this.runConformTest(
34251
		new String[] {
34252
			"X.java",
34253
			"class X<V,R> {\n" + 
34254
			"    class innerclass {\n" + 
34255
			"        void foo() {\n" + 
34256
			"            X<V,R> c = X.this;\n" + 
34257
			"        }\n" + 
34258
			"    }\n" + 
34259
			"}",
34260
		}, 
34261
		"");
34262
}
34263
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142935
34264
public void test1054() {
34265
	Map customOptions = getCompilerOptions();
34266
	// check no unsafe type operation problem is issued
34267
	customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.IGNORE);
34268
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
34269
	String expectedOutput =
34270
		"----------\n" + 
34271
		"1. ERROR in X.java (at line 11)\n" + 
34272
		"	Bar bar= clazz.getAnnotation(Bar.class);\n" + 
34273
		"	         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
34274
		"Type mismatch: cannot convert from Annotation to Bar\n" + 
34275
		"----------\n";
34276
	this.runNegativeTest(
34277
		new String[] {
34278
			"X.java",
34279
			"import java.lang.annotation.Retention;\r\n" + 
34280
			"import java.lang.annotation.RetentionPolicy;\r\n" + 
34281
			"import java.lang.reflect.Method;\r\n" + 
34282
			"\r\n" + 
34283
			"@Bar\r\n" + 
34284
			"public class X {\r\n" + 
34285
			"\r\n" + 
34286
			"        @Bar\r\n" + 
34287
			"        public void bar() throws Exception {\r\n" + 
34288
			"                Class clazz= X.class;\r\n" + 
34289
			"                Bar bar= clazz.getAnnotation(Bar.class);\n" +
34290
			"                Method method= clazz.getMethod(\"bar\");\r\n" + 
34291
			"                Bar bar2= method.getAnnotation(Bar.class);\r\n" + 
34292
			"        }\r\n" + 
34293
			"}\r\n" + 
34294
			"\r\n" + 
34295
			"@Retention(RetentionPolicy.RUNTIME)\r\n" + 
34296
			"@interface Bar {\r\n" + 
34297
			"}",
34298
		},
34299
		expectedOutput,
34300
		null,
34301
		true,
34302
		customOptions);
34303
}
34304
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142935
34305
public void test1055() {
34306
	this.runConformTest(
34307
		new String[] {
34308
			"X.java",
34309
			"import java.lang.annotation.Retention;\r\n" + 
34310
			"import java.lang.annotation.RetentionPolicy;\r\n" + 
34311
			"import java.lang.reflect.Method;\r\n" + 
34312
			"\r\n" + 
34313
			"@Bar\r\n" + 
34314
			"public class X {\r\n" + 
34315
			"\r\n" + 
34316
			"        @Bar\r\n" + 
34317
			"        public void bar() throws Exception {\r\n" + 
34318
			"                Class<X> clazz= X.class;\r\n" + 
34319
			"                Bar bar= clazz.getAnnotation(Bar.class);\n" +
34320
			"                Method method= clazz.getMethod(\"bar\");\r\n" + 
34321
			"                Bar bar2= method.getAnnotation(Bar.class);\r\n" + 
34322
			"        }\r\n" + 
34323
			"}\r\n" + 
34324
			"\r\n" + 
34325
			"@Retention(RetentionPolicy.RUNTIME)\r\n" + 
34326
			"@interface Bar {\r\n" + 
34327
			"}",
34328
		}, 
34329
		"");
34330
}
34331
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162400
34332
public void test1056() {
34333
	this.runConformTest(
34334
		new String[] {
34335
			"X.java",
34336
			"public class X {\n" + 
34337
			"	static <T> T foo() {\n" + 
34338
			"		return null;\n" + 
34339
			"	}\n" + 
34340
			"	public static void main(String[] args) {\n" + 
34341
			"		String[] s = { foo() };\n" + 
34342
			"	}	\n" + 
34343
			"}\n",
34344
		}, 
34345
		"");
34346
}
34347
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159738
34348
public void test1057() {
34349
	this.runConformTest(
34350
		new String[] {
34351
			"X.java",
34352
			"import java.util.Map;\n" + 
34353
			"\n" + 
34354
			"class GenericType<E extends Object & Comparable<E> & Map.Entry<String, E>> {\n" + 
34355
			"	public void doSomething(E e) {\n" + 
34356
			"		System.out.println(e.compareTo(e.getValue()));\n" + 
34357
			"	}\n" + 
34358
			"}\n" + 
34359
			"class ConcreteType {\n" + 
34360
			"	public void doSomething(Object obj) {\n" + 
34361
			"		System.out.println(((Comparable) obj).compareTo(((Map.Entry) obj).getValue()));\n" + 
34362
			"	}\n" + 
34363
			"}\n" + 
34364
			"public class X {\n" + 
34365
			"	public static void main(String[] args) {\n" + 
34366
			"		try {\n" + 
34367
			"			new GenericType().doSomething(\"a1\");\n" + 
34368
			"		} catch (Throwable e) {\n" + 
34369
			"			System.out.print(\"[\" + e.getClass().getSimpleName() + \":1]\");\n" + 
34370
			"		}\n" + 
34371
			"		try {\n" + 
34372
			"			new ConcreteType().doSomething(\"a2\");\n" + 
34373
			"		} catch (Throwable e) {\n" + 
34374
			"			System.out.print(\"[\" + e.getClass().getSimpleName() + \":2]\");\n" + 
34375
			"		}\n" + 
34376
			"	}\n" + 
34377
			"}\n", // =================,
34378
		}, 
34379
		"[ClassCastException:1][ClassCastException:2]");
34380
}
34381
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=141289
34382
public void test1058() {
34383
	this.runConformTest(
34384
		new String[] {
34385
			"X.java", // =================
34386
			"public class X {\n" + 
34387
			"        public static void main(String[] args) {\n" + 
34388
			"        	try {\n" + 
34389
			"                int foo = 0;\n" + 
34390
			"                String bar = \"zero\";\n" + 
34391
			"                System.out.println((foo != 0 ? foo : bar).compareTo(null));\n" + 
34392
			"        	} catch(NullPointerException e) {\n" + 
34393
			"        		System.out.println(\"SUCCESS\");\n" + 
34394
			"        	}\n" + 
34395
			"        }\n" + 
34396
			"}", // =================
34397
		},
34398
		"SUCCESS");
34399
	String expectedOutput =
34400
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
34401
		"  // Stack: 3, Locals: 3\n" + 
34402
		"  public static void main(java.lang.String[] args);\n" + 
34403
		"     0  iconst_0\n" + 
34404
		"     1  istore_1 [foo]\n" + 
34405
		"     2  ldc <String \"zero\"> [16]\n" + 
34406
		"     4  astore_2 [bar]\n" + 
34407
		"     5  getstatic java.lang.System.out : java.io.PrintStream [18]\n" + 
34408
		"     8  iload_1 [foo]\n" + 
34409
		"     9  ifeq 19\n" + 
34410
		"    12  iload_1 [foo]\n" + 
34411
		"    13  invokestatic java.lang.Integer.valueOf(int) : java.lang.Integer [24]\n" + 
34412
		"    16  goto 20\n" + 
34413
		"    19  aload_2 [bar]\n" + 
34414
		"    20  aconst_null\n" + 
34415
		"    21  invokeinterface java.lang.Comparable.compareTo(java.lang.Object) : int [30] [nargs: 2]\n" + 
34416
		"    26  invokevirtual java.io.PrintStream.println(int) : void [36]\n" + 
34417
		"    29  goto 41\n" + 
34418
		"    32  astore_1 [e]\n" + 
34419
		"    33  getstatic java.lang.System.out : java.io.PrintStream [18]\n" + 
34420
		"    36  ldc <String \"SUCCESS\"> [42]\n" + 
34421
		"    38  invokevirtual java.io.PrintStream.println(java.lang.String) : void [44]\n" + 
34422
		"    41  return\n" + 
34423
		"      Exception Table:\n" + 
34424
		"        [pc: 0, pc: 29] -> 32 when : java.lang.NullPointerException\n" + 
34425
		"      Line numbers:\n" + 
34426
		"        [pc: 0, line: 4]\n" + 
34427
		"        [pc: 2, line: 5]\n" + 
34428
		"        [pc: 5, line: 6]\n" + 
34429
		"        [pc: 32, line: 7]\n" + 
34430
		"        [pc: 33, line: 8]\n" + 
34431
		"        [pc: 41, line: 10]\n" + 
34432
		"      Local variable table:\n" + 
34433
		"        [pc: 0, pc: 42] local: args index: 0 type: java.lang.String[]\n" + 
34434
		"        [pc: 2, pc: 32] local: foo index: 1 type: int\n" + 
34435
		"        [pc: 5, pc: 32] local: bar index: 2 type: java.lang.String\n" + 
34436
		"        [pc: 33, pc: 41] local: e index: 1 type: java.lang.NullPointerException\n";
34437
	
34438
	try {
34439
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
34440
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
34441
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
34442
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
34443
		int index = result.indexOf(expectedOutput);
34444
		if (index == -1 || expectedOutput.length() == 0) {
34445
			System.out.println(Util.displayString(result, 3));
34446
		}
34447
		if (index == -1) {
34448
			assertEquals("Wrong contents", expectedOutput, result);
34449
		}
34450
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
34451
		assertTrue(false);
34452
	} catch (IOException e) {
34453
		assertTrue(false);
34454
	}		
34455
}
34456
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160795
34457
public void test1059() {
34458
	this.runNegativeTest(
34459
		new String[] {
34460
			"A.java", // =================
34461
			"class A<T> {\n" + 
34462
			"    <S> S test(A<S> a) {\n" + 
34463
			"        return null;\n" + 
34464
			"    }\n" + 
34465
			"\n" + 
34466
			"    void m() {\n" + 
34467
			"        A<?> a = null;\n" + 
34468
			"        Number b = test(a);\n" + 
34469
			"    }\n" + 
34470
			"}", // =================
34471
		},
34472
		"----------\n" + 
34473
		"1. ERROR in A.java (at line 8)\n" + 
34474
		"	Number b = test(a);\n" + 
34475
		"	           ^^^^^^^\n" + 
34476
		"Type mismatch: cannot convert from capture#1-of ? to Number\n" + 
34477
		"----------\n");
34478
}
34479
// **
34480
public void test1060() {
34481
	this.runConformTest(
34482
		new String[] {
34483
			"X.java", // =================
34484
			"import java.util.Collection;\n" + 
34485
			"import java.util.List;\n" + 
34486
			"\n" + 
34487
			"public class X {\n" + 
34488
			"    public static <B> void m(List<? super B> list,Collection<? super B> coll) {\n" + 
34489
			"        m(list,coll);\n" + 
34490
			"    }\n" + 
34491
			"}", // =================
34492
		},
34493
		"");
34494
}
34495
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159752
34496
// **
34497
public void test1061() {
34498
	this.runConformTest(
34499
		new String[] {
34500
			"predicate/Predicate.java", // =================
34501
			"package predicate;\n" + 
34502
			"public interface Predicate<T> {\n" + 
34503
			"	public boolean evaluate(T object);\n" + 
34504
			"}\n" + 
34505
			"final class AndPredicate<T> implements Predicate<T> {\n" + 
34506
			"	private final Predicate<? super T> iPredicate1;\n" + 
34507
			"	private final Predicate<? super T> iPredicate2;\n" + 
34508
			"	public static <T> Predicate<T> getInstance(Predicate<? super T> predicate1,\n" + 
34509
			"			Predicate<? super T> predicate2) {\n" + 
34510
			"		if (predicate1 == null || predicate2 == null) {\n" + 
34511
			"			throw new IllegalArgumentException(\"Predicate must not be null\");\n" + 
34512
			"		}\n" + 
34513
			"		return new AndPredicate<T>(predicate1, predicate2);\n" + 
34514
			"	}\n" + 
34515
			"	public AndPredicate(Predicate<? super T> predicate1,\n" + 
34516
			"			Predicate<? super T> predicate2) {\n" + 
34517
			"		super();\n" + 
34518
			"		iPredicate1 = predicate1;\n" + 
34519
			"		iPredicate2 = predicate2;\n" + 
34520
			"	}\n" + 
34521
			"	public boolean evaluate(T object) {\n" + 
34522
			"		return iPredicate1.evaluate(object) && iPredicate2.evaluate(object);\n" + 
34523
			"	}\n" + 
34524
			"}\n" + 
34525
			"class PredicateUtils {\n" + 
34526
			"\n" + 
34527
			"	public static <T> Predicate<T> andPredicate(\n" + 
34528
			"			Predicate<? super T> predicate1, Predicate<? super T> predicate2) {\n" + 
34529
			"		return AndPredicate.getInstance(predicate1, predicate2);\n" + 
34530
			"	}\n" + 
34531
			"}", // =================
34532
		},
34533
		"");
34534
}
34535
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148041
34536
public void test1062() {
34537
	this.runNegativeTest(
34538
		new String[] {
34539
			"X.java", // =================
34540
			"import java.util.HashSet;\n" + 
34541
			"import java.util.Iterator;\n" + 
34542
			"import java.util.Set;\n" + 
34543
			"\n" + 
34544
			"public class X {\n" + 
34545
			"	public static void main(String[] args) {\n" + 
34546
			"		Set<X> set = new HashSet<X>();\n" + 
34547
			"		for (Iterator<X> iterator = set.iterator(); iterator.hasNext();) {\n" + 
34548
			"			Set<X> element1 = iterator.next();\n" + 
34549
			"			Set<X> element2 = (Set<X>) iterator.next(); // warning\n" + 
34550
			"		}\n" + 
34551
			"	}\n" + 
34552
			"}", // =================
34553
		},
34554
		"----------\n" + 
34555
		"1. ERROR in X.java (at line 9)\n" + 
34556
		"	Set<X> element1 = iterator.next();\n" + 
34557
		"	                  ^^^^^^^^^^^^^^^\n" + 
34558
		"Type mismatch: cannot convert from X to Set<X>\n" + 
34559
		"----------\n" + 
34560
		"2. WARNING in X.java (at line 10)\n" + 
34561
		"	Set<X> element2 = (Set<X>) iterator.next(); // warning\n" + 
34562
		"	                  ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
34563
		"Type safety: Unchecked cast from X to Set<X>\n" + 
34564
		"----------\n");
34565
}
34566
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148041 - variation
34567
public void test1063() {
34568
	this.runNegativeTest(
34569
		new String[] {
34570
			"X.java", // =================
34571
			"import java.util.HashSet;\n" + 
34572
			"import java.util.Iterator;\n" + 
34573
			"import java.util.Set;\n" + 
34574
			"\n" + 
34575
			"public class X {\n" + 
34576
			"	public static void main(String[] args) {\n" + 
34577
			"		Set<Cloneable> set = new HashSet<Cloneable>();\n" + 
34578
			"		for (Iterator<Cloneable> iterator = set.iterator(); iterator.hasNext();) {\n" + 
34579
			"			Set<Cloneable> element1 = iterator.next();\n" + 
34580
			"			Set<Cloneable> element2 = (Set<Cloneable>) iterator.next(); // warning\n" + 
34581
			"		}\n" + 
34582
			"	}\n" + 
34583
			"}", // =================
34584
		},
34585
		"----------\n" + 
34586
		"1. ERROR in X.java (at line 9)\n" + 
34587
		"	Set<Cloneable> element1 = iterator.next();\n" + 
34588
		"	                          ^^^^^^^^^^^^^^^\n" + 
34589
		"Type mismatch: cannot convert from Cloneable to Set<Cloneable>\n" + 
34590
		"----------\n" + 
34591
		"2. WARNING in X.java (at line 10)\n" + 
34592
		"	Set<Cloneable> element2 = (Set<Cloneable>) iterator.next(); // warning\n" + 
34593
		"	                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
34594
		"Type safety: Unchecked cast from Cloneable to Set<Cloneable>\n" + 
34595
		"----------\n");
34596
}
34597
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148041 - variation
34598
public void test1064() {
34599
	this.runNegativeTest(
34600
		new String[] {
34601
			"X.java", // =================
34602
			"import java.util.HashSet;\n" + 
34603
			"import java.util.Iterator;\n" + 
34604
			"\n" + 
34605
			"public class X {\n" + 
34606
			"	public static void main(String[] args) {\n" + 
34607
			"		HashSet<X> set = new HashSet<X>();\n" + 
34608
			"		for (Iterator<X> iterator = set.iterator(); iterator.hasNext();) {\n" + 
34609
			"			HashSet<X> element1 = iterator.next();\n" + 
34610
			"			HashSet<X> element2 = (HashSet<X>) iterator.next();\n" + 
34611
			"		}\n" + 
34612
			"	}\n" + 
34613
			"}", // =================
34614
		},
34615
		"----------\n" + 
34616
		"1. ERROR in X.java (at line 8)\n" + 
34617
		"	HashSet<X> element1 = iterator.next();\n" + 
34618
		"	                      ^^^^^^^^^^^^^^^\n" + 
34619
		"Type mismatch: cannot convert from X to HashSet<X>\n" + 
34620
		"----------\n" + 
34621
		"2. ERROR in X.java (at line 9)\n" + 
34622
		"	HashSet<X> element2 = (HashSet<X>) iterator.next();\n" + 
34623
		"	                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
34624
		"Cannot cast from X to HashSet<X>\n" + 
34625
		"----------\n");
34626
}
34627
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=141289 - variation
34628
public void test1065() {
34629
	this.runConformTest(
34630
		new String[] {
34631
			"X.java", // =================
34632
			"public class X {\n" + 
34633
			"	void testFoo(boolean t, A a, B b) {\n" + 
34634
			"		System.out.print((t ? a : b).foo());\n" + 
34635
			"	}\n" + 
34636
			"	void testBar(boolean t, A a, B b) {\n" + 
34637
			"		System.out.print((t ? a : b).bar());\n" + 
34638
			"	}\n" + 
34639
			"	public static void main(String[] args) {\n" + 
34640
			"		X x = new X();\n" + 
34641
			"		A a = new A();\n" + 
34642
			"		B b = new B();\n" + 
34643
			"		x.testFoo(true, a, b);\n" + 
34644
			"		x.testFoo(false, a, b);\n" + 
34645
			"		x.testBar(true, a, b);\n" + 
34646
			"		x.testBar(false, a, b);\n" + 
34647
			"	}\n" + 
34648
			"}\n" + 
34649
			"interface Foo { 	String foo(); }\n" + 
34650
			"interface Bar { String bar(); }\n" + 
34651
			"class A implements Foo, Bar {\n" + 
34652
			"	public String foo() { return \"[A#foo()]\"; }\n" + 
34653
			"	public String bar() { return \"[A#bar()]\"; }\n" + 
34654
			"}\n" + 
34655
			"class B implements Foo, Bar {\n" + 
34656
			"	public String foo() { return \"[B#foo()]\"; }\n" + 
34657
			"	public String bar() { return \"[B#bar()]\"; }\n" + 
34658
			"}\n", // =================
34659
		},
34660
		"[A#foo()][B#foo()][A#bar()][B#bar()]");
34661
	// 	check presence of checkcast in #testFoo() and #testBar()
34662
	String expectedOutput = this.complianceLevel.equals(COMPLIANCE_1_5)
34663
			?	"  // Method descriptor #15 (ZLA;LB;)V\n" + 
34664
				"  // Stack: 2, Locals: 4\n" + 
34665
				"  void testFoo(boolean t, A a, B b);\n" + 
34666
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
34667
				"     3  iload_1 [t]\n" + 
34668
				"     4  ifeq 11\n" + 
34669
				"     7  aload_2 [a]\n" + 
34670
				"     8  goto 12\n" + 
34671
				"    11  aload_3 [b]\n" + 
34672
				"    12  invokeinterface Foo.foo() : java.lang.String [22] [nargs: 1]\n" + 
34673
				"    17  invokevirtual java.io.PrintStream.print(java.lang.String) : void [28]\n" + 
34674
				"    20  return\n" + 
34675
				"      Line numbers:\n" + 
34676
				"        [pc: 0, line: 3]\n" + 
34677
				"        [pc: 20, line: 4]\n" + 
34678
				"      Local variable table:\n" + 
34679
				"        [pc: 0, pc: 21] local: this index: 0 type: X\n" + 
34680
				"        [pc: 0, pc: 21] local: t index: 1 type: boolean\n" + 
34681
				"        [pc: 0, pc: 21] local: a index: 2 type: A\n" + 
34682
				"        [pc: 0, pc: 21] local: b index: 3 type: B\n" + 
34683
				"  \n" + 
34684
				"  // Method descriptor #15 (ZLA;LB;)V\n" + 
34685
				"  // Stack: 2, Locals: 4\n" + 
34686
				"  void testBar(boolean t, A a, B b);\n" + 
34687
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
34688
				"     3  iload_1 [t]\n" + 
34689
				"     4  ifeq 11\n" + 
34690
				"     7  aload_2 [a]\n" + 
34691
				"     8  goto 12\n" + 
34692
				"    11  aload_3 [b]\n" + 
34693
				"    12  checkcast Bar [41]\n" + 
34694
				"    15  invokeinterface Bar.bar() : java.lang.String [43] [nargs: 1]\n" + 
34695
				"    20  invokevirtual java.io.PrintStream.print(java.lang.String) : void [28]\n" + 
34696
				"    23  return\n" + 
34697
				"      Line numbers:\n" + 
34698
				"        [pc: 0, line: 6]\n" + 
34699
				"        [pc: 23, line: 7]\n" + 
34700
				"      Local variable table:\n" + 
34701
				"        [pc: 0, pc: 24] local: this index: 0 type: X\n" + 
34702
				"        [pc: 0, pc: 24] local: t index: 1 type: boolean\n" + 
34703
				"        [pc: 0, pc: 24] local: a index: 2 type: A\n" + 
34704
				"        [pc: 0, pc: 24] local: b index: 3 type: B\n"
34705
			:	"  // Method descriptor #15 (ZLA;LB;)V\n" + 
34706
				"  // Stack: 2, Locals: 4\n" + 
34707
				"  void testFoo(boolean t, A a, B b);\n" + 
34708
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
34709
				"     3  iload_1 [t]\n" + 
34710
				"     4  ifeq 11\n" + 
34711
				"     7  aload_2 [a]\n" + 
34712
				"     8  goto 12\n" + 
34713
				"    11  aload_3 [b]\n" + 
34714
				"    12  invokeinterface Foo.foo() : java.lang.String [22] [nargs: 1]\n" + 
34715
				"    17  invokevirtual java.io.PrintStream.print(java.lang.String) : void [28]\n" + 
34716
				"    20  return\n" + 
34717
				"      Line numbers:\n" + 
34718
				"        [pc: 0, line: 3]\n" + 
34719
				"        [pc: 20, line: 4]\n" + 
34720
				"      Local variable table:\n" + 
34721
				"        [pc: 0, pc: 21] local: this index: 0 type: X\n" + 
34722
				"        [pc: 0, pc: 21] local: t index: 1 type: boolean\n" + 
34723
				"        [pc: 0, pc: 21] local: a index: 2 type: A\n" + 
34724
				"        [pc: 0, pc: 21] local: b index: 3 type: B\n" + 
34725
				"      Stack map table: number of frames 2\n" + 
34726
				"        [pc: 11, same_locals_1_stack_item, stack: {java.io.PrintStream}]\n" + 
34727
				"        [pc: 12, full, stack: {java.io.PrintStream, Foo}, locals: {X, int, A, B}]\n" + 
34728
				"  \n" + 
34729
				"  // Method descriptor #15 (ZLA;LB;)V\n" + 
34730
				"  // Stack: 2, Locals: 4\n" + 
34731
				"  void testBar(boolean t, A a, B b);\n" + 
34732
				"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
34733
				"     3  iload_1 [t]\n" + 
34734
				"     4  ifeq 11\n" + 
34735
				"     7  aload_2 [a]\n" + 
34736
				"     8  goto 12\n" + 
34737
				"    11  aload_3 [b]\n" + 
34738
				"    12  checkcast Bar [46]\n" + 
34739
				"    15  invokeinterface Bar.bar() : java.lang.String [48] [nargs: 1]\n" + 
34740
				"    20  invokevirtual java.io.PrintStream.print(java.lang.String) : void [28]\n" + 
34741
				"    23  return\n" + 
34742
				"      Line numbers:\n" + 
34743
				"        [pc: 0, line: 6]\n" + 
34744
				"        [pc: 23, line: 7]\n" + 
34745
				"      Local variable table:\n" + 
34746
				"        [pc: 0, pc: 24] local: this index: 0 type: X\n" + 
34747
				"        [pc: 0, pc: 24] local: t index: 1 type: boolean\n" + 
34748
				"        [pc: 0, pc: 24] local: a index: 2 type: A\n" + 
34749
				"        [pc: 0, pc: 24] local: b index: 3 type: B\n" + 
34750
				"      Stack map table: number of frames 2\n" + 
34751
				"        [pc: 11, same_locals_1_stack_item, stack: {java.io.PrintStream}]\n" + 
34752
				"        [pc: 12, full, stack: {java.io.PrintStream, Foo}, locals: {X, int, A, B}]\n";
34753
	
34754
	try {
34755
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
34756
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
34757
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
34758
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
34759
		int index = result.indexOf(expectedOutput);
34760
		if (index == -1 || expectedOutput.length() == 0) {
34761
			System.out.println(Util.displayString(result, 3));
34762
		}
34763
		if (index == -1) {
34764
			assertEquals("Wrong contents", expectedOutput, result);
34765
		}
34766
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
34767
		assertTrue(false);
34768
	} catch (IOException e) {
34769
		assertTrue(false);
34770
	}
34771
}
34772
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=141289 - variation
34773
public void test1066() {
34774
	this.runConformTest(
34775
		new String[] {
34776
			"X.java", // =================
34777
			"import java.util.*;\n" + 
34778
			"public class X {\n" + 
34779
			"	public static void main(String[] args) {\n" + 
34780
			"		X x = new X();\n" + 
34781
			"		List l = new ArrayList();\n" + 
34782
			"		l.add(\"zork\");\n" + 
34783
			"		List<A> la = l;\n" + 
34784
			"		List<B> lb = l;\n" + 
34785
			"		boolean t = true, f = false;\n" + 
34786
			"		try {\n" + 
34787
			"			System.out.print((t ? la.get(0) : lb.get(0)).foo());\n" + 
34788
			"		} catch (Throwable e) {\n" + 
34789
			"			System.out.print(\"[\" + e.getClass().getSimpleName() + \":foo(1)]\");\n" + 
34790
			"		}		\n" + 
34791
			"		try {\n" + 
34792
			"			System.out.print((f ? la.get(0) : lb.get(0)).foo());\n" + 
34793
			"		} catch (Throwable e) {\n" + 
34794
			"			System.out.print(\"[\" + e.getClass().getSimpleName() + \":foo(2)]\");\n" + 
34795
			"		}		\n" + 
34796
			"		try {\n" + 
34797
			"			System.out.print((t ? la.get(0) : lb.get(0)).bar());\n" + 
34798
			"		} catch (Throwable e) {\n" + 
34799
			"			System.out.print(\"[\" + e.getClass().getSimpleName() + \":bar(1)]\");\n" + 
34800
			"		}		\n" + 
34801
			"		try {\n" + 
34802
			"			System.out.print((f ? la.get(0) : lb.get(0)).bar());\n" + 
34803
			"		} catch (Throwable e) {\n" + 
34804
			"			System.out.print(\"[\" + e.getClass().getSimpleName() + \":bar(2)]\");\n" + 
34805
			"		}		\n" + 
34806
			"	}\n" + 
34807
			"}\n" + 
34808
			"interface Foo { 	String foo(); }\n" + 
34809
			"interface Bar { String bar(); }\n" + 
34810
			"abstract class A implements Foo, Bar { }\n" + 
34811
			"abstract class B implements Foo, Bar { }\n", // =================
34812
		},
34813
		"[ClassCastException:foo(1)][ClassCastException:foo(2)][ClassCastException:bar(1)][ClassCastException:bar(2)]");
34814
	// 	check presence of checkcast
34815
	String expectedOutput = this.complianceLevel.equals(COMPLIANCE_1_5)
34816
			?	"  // Stack: 4, Locals: 8\n" + 
34817
				"  public static void main(java.lang.String[] args);\n" + 
34818
				"      0  new X [1]\n" + 
34819
				"      3  dup\n" + 
34820
				"      4  invokespecial X() [16]\n" + 
34821
				"      7  astore_1 [x]\n" + 
34822
				"      8  new java.util.ArrayList [17]\n" + 
34823
				"     11  dup\n" + 
34824
				"     12  invokespecial java.util.ArrayList() [19]\n" + 
34825
				"     15  astore_2 [l]\n" + 
34826
				"     16  aload_2 [l]\n" + 
34827
				"     17  ldc <String \"zork\"> [20]\n" + 
34828
				"     19  invokeinterface java.util.List.add(java.lang.Object) : boolean [22] [nargs: 2]\n" + 
34829
				"     24  pop\n" + 
34830
				"     25  aload_2 [l]\n" + 
34831
				"     26  astore_3 [la]\n" + 
34832
				"     27  aload_2 [l]\n" + 
34833
				"     28  astore 4 [lb]\n" + 
34834
				"     30  iconst_1\n" + 
34835
				"     31  istore 5 [t]\n" + 
34836
				"     33  iconst_0\n" + 
34837
				"     34  istore 6 [f]\n" + 
34838
				"     36  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34839
				"     39  iload 5 [t]\n" + 
34840
				"     41  ifeq 57\n" + 
34841
				"     44  aload_3 [la]\n" + 
34842
				"     45  iconst_0\n" + 
34843
				"     46  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34844
				"     51  checkcast Foo [38]\n" + 
34845
				"     54  goto 68\n" + 
34846
				"     57  aload 4 [lb]\n" + 
34847
				"     59  iconst_0\n" + 
34848
				"     60  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34849
				"     65  checkcast Foo [38]\n" + 
34850
				"     68  invokeinterface Foo.foo() : java.lang.String [40] [nargs: 1]\n" + 
34851
				"     73  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34852
				"     76  goto 115\n" + 
34853
				"     79  astore 7 [e]\n" + 
34854
				"     81  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34855
				"     84  new java.lang.StringBuilder [50]\n" + 
34856
				"     87  dup\n" + 
34857
				"     88  ldc <String \"[\"> [52]\n" + 
34858
				"     90  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
34859
				"     93  aload 7 [e]\n" + 
34860
				"     95  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
34861
				"     98  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
34862
				"    101  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34863
				"    104  ldc <String \":foo(1)]\"> [69]\n" + 
34864
				"    106  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34865
				"    109  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
34866
				"    112  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34867
				"    115  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34868
				"    118  iload 6 [f]\n" + 
34869
				"    120  ifeq 136\n" + 
34870
				"    123  aload_3 [la]\n" + 
34871
				"    124  iconst_0\n" + 
34872
				"    125  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34873
				"    130  checkcast Foo [38]\n" + 
34874
				"    133  goto 147\n" + 
34875
				"    136  aload 4 [lb]\n" + 
34876
				"    138  iconst_0\n" + 
34877
				"    139  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34878
				"    144  checkcast Foo [38]\n" + 
34879
				"    147  invokeinterface Foo.foo() : java.lang.String [40] [nargs: 1]\n" + 
34880
				"    152  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34881
				"    155  goto 194\n" + 
34882
				"    158  astore 7 [e]\n" + 
34883
				"    160  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34884
				"    163  new java.lang.StringBuilder [50]\n" + 
34885
				"    166  dup\n" + 
34886
				"    167  ldc <String \"[\"> [52]\n" + 
34887
				"    169  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
34888
				"    172  aload 7 [e]\n" + 
34889
				"    174  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
34890
				"    177  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
34891
				"    180  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34892
				"    183  ldc <String \":foo(2)]\"> [74]\n" + 
34893
				"    185  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34894
				"    188  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
34895
				"    191  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34896
				"    194  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34897
				"    197  iload 5 [t]\n" + 
34898
				"    199  ifeq 215\n" + 
34899
				"    202  aload_3 [la]\n" + 
34900
				"    203  iconst_0\n" + 
34901
				"    204  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34902
				"    209  checkcast Foo [38]\n" + 
34903
				"    212  goto 226\n" + 
34904
				"    215  aload 4 [lb]\n" + 
34905
				"    217  iconst_0\n" + 
34906
				"    218  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34907
				"    223  checkcast Foo [38]\n" + 
34908
				"    226  checkcast Bar [76]\n" + 
34909
				"    229  invokeinterface Bar.bar() : java.lang.String [78] [nargs: 1]\n" + 
34910
				"    234  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34911
				"    237  goto 276\n" + 
34912
				"    240  astore 7 [e]\n" + 
34913
				"    242  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34914
				"    245  new java.lang.StringBuilder [50]\n" + 
34915
				"    248  dup\n" + 
34916
				"    249  ldc <String \"[\"> [52]\n" + 
34917
				"    251  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
34918
				"    254  aload 7 [e]\n" + 
34919
				"    256  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
34920
				"    259  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
34921
				"    262  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34922
				"    265  ldc <String \":bar(1)]\"> [81]\n" + 
34923
				"    267  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34924
				"    270  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
34925
				"    273  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34926
				"    276  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34927
				"    279  iload 6 [f]\n" + 
34928
				"    281  ifeq 297\n" + 
34929
				"    284  aload_3 [la]\n" + 
34930
				"    285  iconst_0\n" + 
34931
				"    286  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34932
				"    291  checkcast Foo [38]\n" + 
34933
				"    294  goto 308\n" + 
34934
				"    297  aload 4 [lb]\n" + 
34935
				"    299  iconst_0\n" + 
34936
				"    300  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
34937
				"    305  checkcast Foo [38]\n" + 
34938
				"    308  checkcast Bar [76]\n" + 
34939
				"    311  invokeinterface Bar.bar() : java.lang.String [78] [nargs: 1]\n" + 
34940
				"    316  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34941
				"    319  goto 358\n" + 
34942
				"    322  astore 7 [e]\n" + 
34943
				"    324  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
34944
				"    327  new java.lang.StringBuilder [50]\n" + 
34945
				"    330  dup\n" + 
34946
				"    331  ldc <String \"[\"> [52]\n" + 
34947
				"    333  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
34948
				"    336  aload 7 [e]\n" + 
34949
				"    338  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
34950
				"    341  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
34951
				"    344  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34952
				"    347  ldc <String \":bar(2)]\"> [83]\n" + 
34953
				"    349  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
34954
				"    352  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
34955
				"    355  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
34956
				"    358  return\n" + 
34957
				"      Exception Table:\n" + 
34958
				"        [pc: 36, pc: 76] -> 79 when : java.lang.Throwable\n" + 
34959
				"        [pc: 115, pc: 155] -> 158 when : java.lang.Throwable\n" + 
34960
				"        [pc: 194, pc: 237] -> 240 when : java.lang.Throwable\n" + 
34961
				"        [pc: 276, pc: 319] -> 322 when : java.lang.Throwable\n" + 
34962
				"      Line numbers:\n" + 
34963
				"        [pc: 0, line: 4]\n" + 
34964
				"        [pc: 8, line: 5]\n" + 
34965
				"        [pc: 16, line: 6]\n" + 
34966
				"        [pc: 25, line: 7]\n" + 
34967
				"        [pc: 27, line: 8]\n" + 
34968
				"        [pc: 30, line: 9]\n" + 
34969
				"        [pc: 36, line: 11]\n" + 
34970
				"        [pc: 79, line: 12]\n" + 
34971
				"        [pc: 81, line: 13]\n" + 
34972
				"        [pc: 115, line: 16]\n" + 
34973
				"        [pc: 158, line: 17]\n" + 
34974
				"        [pc: 160, line: 18]\n" + 
34975
				"        [pc: 194, line: 21]\n" + 
34976
				"        [pc: 240, line: 22]\n" + 
34977
				"        [pc: 242, line: 23]\n" + 
34978
				"        [pc: 276, line: 26]\n" + 
34979
				"        [pc: 322, line: 27]\n" + 
34980
				"        [pc: 324, line: 28]\n" + 
34981
				"        [pc: 358, line: 30]\n" + 
34982
				"      Local variable table:\n" + 
34983
				"        [pc: 0, pc: 359] local: args index: 0 type: java.lang.String[]\n" + 
34984
				"        [pc: 8, pc: 359] local: x index: 1 type: X\n" + 
34985
				"        [pc: 16, pc: 359] local: l index: 2 type: java.util.List\n" + 
34986
				"        [pc: 27, pc: 359] local: la index: 3 type: java.util.List\n" + 
34987
				"        [pc: 30, pc: 359] local: lb index: 4 type: java.util.List\n" + 
34988
				"        [pc: 33, pc: 359] local: t index: 5 type: boolean\n" + 
34989
				"        [pc: 36, pc: 359] local: f index: 6 type: boolean\n" + 
34990
				"        [pc: 81, pc: 115] local: e index: 7 type: java.lang.Throwable\n" + 
34991
				"        [pc: 160, pc: 194] local: e index: 7 type: java.lang.Throwable\n" + 
34992
				"        [pc: 242, pc: 276] local: e index: 7 type: java.lang.Throwable\n" + 
34993
				"        [pc: 324, pc: 358] local: e index: 7 type: java.lang.Throwable\n" + 
34994
				"      Local variable type table:\n" + 
34995
				"        [pc: 27, pc: 359] local: la index: 3 type: java.util.List<A>\n" + 
34996
				"        [pc: 30, pc: 359] local: lb index: 4 type: java.util.List<B>\n"
34997
			:	"  // Method descriptor #15 ([Ljava/lang/String;)V\n" + 
34998
				"  // Stack: 4, Locals: 8\n" + 
34999
				"  public static void main(java.lang.String[] args);\n" + 
35000
				"      0  new X [1]\n" + 
35001
				"      3  dup\n" + 
35002
				"      4  invokespecial X() [16]\n" + 
35003
				"      7  astore_1 [x]\n" + 
35004
				"      8  new java.util.ArrayList [17]\n" + 
35005
				"     11  dup\n" + 
35006
				"     12  invokespecial java.util.ArrayList() [19]\n" + 
35007
				"     15  astore_2 [l]\n" + 
35008
				"     16  aload_2 [l]\n" + 
35009
				"     17  ldc <String \"zork\"> [20]\n" + 
35010
				"     19  invokeinterface java.util.List.add(java.lang.Object) : boolean [22] [nargs: 2]\n" + 
35011
				"     24  pop\n" + 
35012
				"     25  aload_2 [l]\n" + 
35013
				"     26  astore_3 [la]\n" + 
35014
				"     27  aload_2 [l]\n" + 
35015
				"     28  astore 4 [lb]\n" + 
35016
				"     30  iconst_1\n" + 
35017
				"     31  istore 5 [t]\n" + 
35018
				"     33  iconst_0\n" + 
35019
				"     34  istore 6 [f]\n" + 
35020
				"     36  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35021
				"     39  iload 5 [t]\n" + 
35022
				"     41  ifeq 57\n" + 
35023
				"     44  aload_3 [la]\n" + 
35024
				"     45  iconst_0\n" + 
35025
				"     46  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35026
				"     51  checkcast Foo [38]\n" + 
35027
				"     54  goto 68\n" + 
35028
				"     57  aload 4 [lb]\n" + 
35029
				"     59  iconst_0\n" + 
35030
				"     60  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35031
				"     65  checkcast Foo [38]\n" + 
35032
				"     68  invokeinterface Foo.foo() : java.lang.String [40] [nargs: 1]\n" + 
35033
				"     73  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35034
				"     76  goto 115\n" + 
35035
				"     79  astore 7 [e]\n" + 
35036
				"     81  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35037
				"     84  new java.lang.StringBuilder [50]\n" + 
35038
				"     87  dup\n" + 
35039
				"     88  ldc <String \"[\"> [52]\n" + 
35040
				"     90  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
35041
				"     93  aload 7 [e]\n" + 
35042
				"     95  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
35043
				"     98  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
35044
				"    101  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35045
				"    104  ldc <String \":foo(1)]\"> [69]\n" + 
35046
				"    106  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35047
				"    109  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
35048
				"    112  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35049
				"    115  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35050
				"    118  iload 6 [f]\n" + 
35051
				"    120  ifeq 136\n" + 
35052
				"    123  aload_3 [la]\n" + 
35053
				"    124  iconst_0\n" + 
35054
				"    125  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35055
				"    130  checkcast Foo [38]\n" + 
35056
				"    133  goto 147\n" + 
35057
				"    136  aload 4 [lb]\n" + 
35058
				"    138  iconst_0\n" + 
35059
				"    139  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35060
				"    144  checkcast Foo [38]\n" + 
35061
				"    147  invokeinterface Foo.foo() : java.lang.String [40] [nargs: 1]\n" + 
35062
				"    152  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35063
				"    155  goto 194\n" + 
35064
				"    158  astore 7 [e]\n" + 
35065
				"    160  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35066
				"    163  new java.lang.StringBuilder [50]\n" + 
35067
				"    166  dup\n" + 
35068
				"    167  ldc <String \"[\"> [52]\n" + 
35069
				"    169  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
35070
				"    172  aload 7 [e]\n" + 
35071
				"    174  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
35072
				"    177  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
35073
				"    180  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35074
				"    183  ldc <String \":foo(2)]\"> [74]\n" + 
35075
				"    185  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35076
				"    188  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
35077
				"    191  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35078
				"    194  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35079
				"    197  iload 5 [t]\n" + 
35080
				"    199  ifeq 215\n" + 
35081
				"    202  aload_3 [la]\n" + 
35082
				"    203  iconst_0\n" + 
35083
				"    204  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35084
				"    209  checkcast Foo [38]\n" + 
35085
				"    212  goto 226\n" + 
35086
				"    215  aload 4 [lb]\n" + 
35087
				"    217  iconst_0\n" + 
35088
				"    218  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35089
				"    223  checkcast Foo [38]\n" + 
35090
				"    226  checkcast Bar [76]\n" + 
35091
				"    229  invokeinterface Bar.bar() : java.lang.String [78] [nargs: 1]\n" + 
35092
				"    234  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35093
				"    237  goto 276\n" + 
35094
				"    240  astore 7 [e]\n" + 
35095
				"    242  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35096
				"    245  new java.lang.StringBuilder [50]\n" + 
35097
				"    248  dup\n" + 
35098
				"    249  ldc <String \"[\"> [52]\n" + 
35099
				"    251  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
35100
				"    254  aload 7 [e]\n" + 
35101
				"    256  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
35102
				"    259  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
35103
				"    262  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35104
				"    265  ldc <String \":bar(1)]\"> [81]\n" + 
35105
				"    267  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35106
				"    270  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
35107
				"    273  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35108
				"    276  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35109
				"    279  iload 6 [f]\n" + 
35110
				"    281  ifeq 297\n" + 
35111
				"    284  aload_3 [la]\n" + 
35112
				"    285  iconst_0\n" + 
35113
				"    286  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35114
				"    291  checkcast Foo [38]\n" + 
35115
				"    294  goto 308\n" + 
35116
				"    297  aload 4 [lb]\n" + 
35117
				"    299  iconst_0\n" + 
35118
				"    300  invokeinterface java.util.List.get(int) : java.lang.Object [34] [nargs: 2]\n" + 
35119
				"    305  checkcast Foo [38]\n" + 
35120
				"    308  checkcast Bar [76]\n" + 
35121
				"    311  invokeinterface Bar.bar() : java.lang.String [78] [nargs: 1]\n" + 
35122
				"    316  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35123
				"    319  goto 358\n" + 
35124
				"    322  astore 7 [e]\n" + 
35125
				"    324  getstatic java.lang.System.out : java.io.PrintStream [28]\n" + 
35126
				"    327  new java.lang.StringBuilder [50]\n" + 
35127
				"    330  dup\n" + 
35128
				"    331  ldc <String \"[\"> [52]\n" + 
35129
				"    333  invokespecial java.lang.StringBuilder(java.lang.String) [54]\n" + 
35130
				"    336  aload 7 [e]\n" + 
35131
				"    338  invokevirtual java.lang.Object.getClass() : java.lang.Class [56]\n" + 
35132
				"    341  invokevirtual java.lang.Class.getSimpleName() : java.lang.String [60]\n" + 
35133
				"    344  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35134
				"    347  ldc <String \":bar(2)]\"> [83]\n" + 
35135
				"    349  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [65]\n" + 
35136
				"    352  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [71]\n" + 
35137
				"    355  invokevirtual java.io.PrintStream.print(java.lang.String) : void [44]\n" + 
35138
				"    358  return\n" + 
35139
				"      Exception Table:\n" + 
35140
				"        [pc: 36, pc: 76] -> 79 when : java.lang.Throwable\n" + 
35141
				"        [pc: 115, pc: 155] -> 158 when : java.lang.Throwable\n" + 
35142
				"        [pc: 194, pc: 237] -> 240 when : java.lang.Throwable\n" + 
35143
				"        [pc: 276, pc: 319] -> 322 when : java.lang.Throwable\n" + 
35144
				"      Line numbers:\n" + 
35145
				"        [pc: 0, line: 4]\n" + 
35146
				"        [pc: 8, line: 5]\n" + 
35147
				"        [pc: 16, line: 6]\n" + 
35148
				"        [pc: 25, line: 7]\n" + 
35149
				"        [pc: 27, line: 8]\n" + 
35150
				"        [pc: 30, line: 9]\n" + 
35151
				"        [pc: 36, line: 11]\n" + 
35152
				"        [pc: 79, line: 12]\n" + 
35153
				"        [pc: 81, line: 13]\n" + 
35154
				"        [pc: 115, line: 16]\n" + 
35155
				"        [pc: 158, line: 17]\n" + 
35156
				"        [pc: 160, line: 18]\n" + 
35157
				"        [pc: 194, line: 21]\n" + 
35158
				"        [pc: 240, line: 22]\n" + 
35159
				"        [pc: 242, line: 23]\n" + 
35160
				"        [pc: 276, line: 26]\n" + 
35161
				"        [pc: 322, line: 27]\n" + 
35162
				"        [pc: 324, line: 28]\n" + 
35163
				"        [pc: 358, line: 30]\n" + 
35164
				"      Local variable table:\n" + 
35165
				"        [pc: 0, pc: 359] local: args index: 0 type: java.lang.String[]\n" + 
35166
				"        [pc: 8, pc: 359] local: x index: 1 type: X\n" + 
35167
				"        [pc: 16, pc: 359] local: l index: 2 type: java.util.List\n" + 
35168
				"        [pc: 27, pc: 359] local: la index: 3 type: java.util.List\n" + 
35169
				"        [pc: 30, pc: 359] local: lb index: 4 type: java.util.List\n" + 
35170
				"        [pc: 33, pc: 359] local: t index: 5 type: boolean\n" + 
35171
				"        [pc: 36, pc: 359] local: f index: 6 type: boolean\n" + 
35172
				"        [pc: 81, pc: 115] local: e index: 7 type: java.lang.Throwable\n" + 
35173
				"        [pc: 160, pc: 194] local: e index: 7 type: java.lang.Throwable\n" + 
35174
				"        [pc: 242, pc: 276] local: e index: 7 type: java.lang.Throwable\n" + 
35175
				"        [pc: 324, pc: 358] local: e index: 7 type: java.lang.Throwable\n" + 
35176
				"      Local variable type table:\n" + 
35177
				"        [pc: 27, pc: 359] local: la index: 3 type: java.util.List<A>\n" + 
35178
				"        [pc: 30, pc: 359] local: lb index: 4 type: java.util.List<B>\n" + 
35179
				"      Stack map table: number of frames 16\n" + 
35180
				"        [pc: 57, full, stack: {java.io.PrintStream}, locals: {java.lang.String[], X, java.util.List, java.util.List, java.util.List, int, int}]\n" + 
35181
				"        [pc: 68, full, stack: {java.io.PrintStream, Foo}, locals: {java.lang.String[], X, java.util.List, java.util.List, java.util.List, int, int}]\n" + 
35182
				"        [pc: 79, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + 
35183
				"        [pc: 115, same]\n" + 
35184
				"        [pc: 136, same_locals_1_stack_item, stack: {java.io.PrintStream}]\n" + 
35185
				"        [pc: 147, full, stack: {java.io.PrintStream, Foo}, locals: {java.lang.String[], X, java.util.List, java.util.List, java.util.List, int, int}]\n" + 
35186
				"        [pc: 158, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + 
35187
				"        [pc: 194, same]\n" + 
35188
				"        [pc: 215, same_locals_1_stack_item, stack: {java.io.PrintStream}]\n" + 
35189
				"        [pc: 226, full, stack: {java.io.PrintStream, Foo}, locals: {java.lang.String[], X, java.util.List, java.util.List, java.util.List, int, int}]\n" + 
35190
				"        [pc: 240, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + 
35191
				"        [pc: 276, same]\n" + 
35192
				"        [pc: 297, same_locals_1_stack_item, stack: {java.io.PrintStream}]\n" + 
35193
				"        [pc: 308, full, stack: {java.io.PrintStream, Foo}, locals: {java.lang.String[], X, java.util.List, java.util.List, java.util.List, int, int}]\n" + 
35194
				"        [pc: 322, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + 
35195
				"        [pc: 358, same]\n";
35196
	
35197
	try {
35198
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
35199
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
35200
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
35201
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
35202
		int index = result.indexOf(expectedOutput);
35203
		if (index == -1 || expectedOutput.length() == 0) {
35204
			System.out.println(Util.displayString(result, 3));
35205
		}
35206
		if (index == -1) {
35207
			assertEquals("Wrong contents", expectedOutput, result);
35208
		}
35209
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
35210
		assertTrue(false);
35211
	} catch (IOException e) {
35212
		assertTrue(false);
35213
	}	
35214
}
35215
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162991
35216
// using only source types
35217
public void test1067() {
35218
	this.runConformTest(
35219
		new String[] {
35220
			"Something.java",
35221
			"public interface Something {\n" + 
35222
			"\n" + 
35223
			"}", // =================
35224
			"Doing.java", // =================
35225
			"public interface Doing {\n" + 
35226
			"        public <S extends Something, T extends S> T get(Class<S> clazz);\n" + 
35227
			"}", // =================
35228
			"DoingImpl.java", // =================
35229
			"public class DoingImpl implements Doing {\n" + 
35230
			"        public <S extends Something, T extends S> T get(Class<S> clazz) {\n" + 
35231
			"                return null;\n" + 
35232
			"        }\n" + 
35233
			"}" // =================
35234
		},
35235
		"");
35236
}
35237
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162991
35238
// using source and binary types
35239
public void test1068() {
35240
	this.runConformTest(
35241
		new String[] {
35242
			"Something.java",
35243
			"public interface Something {\n" + 
35244
			"\n" + 
35245
			"}", // =================
35246
			"Doing.java", // =================
35247
			"public interface Doing {\n" + 
35248
			"        public <S extends Something, T extends S> T get(Class<S> clazz);\n" + 
35249
			"}", // =================
35250
		},
35251
		"");
35252
	this.runConformTest(
35253
		new String[] {
35254
			"DoingImpl.java", // =================
35255
			"public class DoingImpl implements Doing {\n" + 
35256
			"        public <S extends Something, T extends S> T get(Class<S> clazz) {\n" + 
35257
			"                return null;\n" + 
35258
			"        }\n" + 
35259
			"}" // =================
35260
		},
35261
		"",
35262
		null,
35263
		false,
35264
		null);
35265
}
35266
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=163262
35267
public void test1069() {
35268
	this.runConformTest(
35269
		new String[] {
35270
			"Bug.java", // =================
35271
			"public class Bug<A> {\n" + 
35272
			"   void bug() {\n" + 
35273
			"      new Runnable() {\n" + 
35274
			"         public void run() {\n" + 
35275
			"            Bug<A> bug = Bug.this;\n" + 
35276
			"         }\n" + 
35277
			"      };\n" + 
35278
			"   }\n" + 
35279
			"}",
35280
		},
35281
		"");
35282
}
35283
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=163262
35284
public void test1070() {
35285
	this.runConformTest(
35286
		new String[] {
35287
			"Bug.java", // =================
35288
			"public class Bug<A> {\n" + 
35289
			"   Bug<A> reproduce() {\n" + 
35290
			"      return Bug.this;\n" + 
35291
			"   }\n" + 
35292
			"}",
35293
		},
35294
		"");
35295
}
35296
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159939
35297
public void test1071() {
35298
	this.runNegativeTest(
35299
		new String[] {
35300
			"X.java", // =================
35301
			"import java.util.*;\n" + 
35302
			"public class X {\n" + 
35303
			"        List<void[]> x = null;\n" + 
35304
			"        void[] y;\n" + 
35305
			"        void[] foo(void[] arg) {\n" + 
35306
			"                void[] local;\n" + 
35307
			"        }\n" + 
35308
			"}",
35309
		},
35310
		"----------\n" + 
35311
		"1. ERROR in X.java (at line 3)\n" + 
35312
		"	List<void[]> x = null;\n" + 
35313
		"	     ^^^^^^\n" + 
35314
		"void[] is an invalid type\n" + 
35315
		"----------\n" + 
35316
		"2. ERROR in X.java (at line 4)\n" + 
35317
		"	void[] y;\n" + 
35318
		"	^^^^^^\n" + 
35319
		"void[] is an invalid type\n" + 
35320
		"----------\n" + 
35321
		"3. ERROR in X.java (at line 5)\n" + 
35322
		"	void[] foo(void[] arg) {\n" + 
35323
		"	^^^^^^\n" + 
35324
		"void[] is an invalid type\n" + 
35325
		"----------\n" + 
35326
		"4. ERROR in X.java (at line 5)\n" + 
35327
		"	void[] foo(void[] arg) {\n" + 
35328
		"	           ^^^^^^\n" + 
35329
		"void[] is an invalid type\n" + 
35330
		"----------\n" + 
35331
		"5. ERROR in X.java (at line 6)\n" + 
35332
		"	void[] local;\n" + 
35333
		"	^^^^^^\n" + 
35334
		"void[] is an invalid type\n" + 
35335
		"----------\n");
35336
}
35337
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159939
35338
public void test1072() {
35339
	Map options = getCompilerOptions();
35340
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
35341
	this.runNegativeTest(
35342
		new String[] {
35343
			"X.java", // =================
35344
			"import java.util.*;\n" + 
35345
			"public class X {\n" + 
35346
			"        List<void[]> x = null;\n" + 
35347
			"        void[] y;\n" + 
35348
			"        void[] foo(void[] arg) {\n" + 
35349
			"                void[] local;\n" + 
35350
			"                Class c = void[].class;\n" + 
35351
			"        }\n" + 
35352
			"}",
35353
		},
35354
		"----------\n" + 
35355
		"1. ERROR in X.java (at line 3)\n" + 
35356
		"	List<void[]> x = null;\n" + 
35357
		"	     ^^^^^^\n" + 
35358
		"void[] is an invalid type\n" + 
35359
		"----------\n" + 
35360
		"2. ERROR in X.java (at line 4)\n" + 
35361
		"	void[] y;\n" + 
35362
		"	^^^^^^\n" + 
35363
		"void[] is an invalid type\n" + 
35364
		"----------\n" + 
35365
		"3. ERROR in X.java (at line 5)\n" + 
35366
		"	void[] foo(void[] arg) {\n" + 
35367
		"	^^^^^^\n" + 
35368
		"void[] is an invalid type\n" + 
35369
		"----------\n" + 
35370
		"4. ERROR in X.java (at line 5)\n" + 
35371
		"	void[] foo(void[] arg) {\n" + 
35372
		"	           ^^^^^^\n" + 
35373
		"void[] is an invalid type\n" + 
35374
		"----------\n" + 
35375
		"5. ERROR in X.java (at line 6)\n" + 
35376
		"	void[] local;\n" + 
35377
		"	^^^^^^\n" + 
35378
		"void[] is an invalid type\n" + 
35379
		"----------\n" + 
35380
		"6. ERROR in X.java (at line 7)\n" + 
35381
		"	Class c = void[].class;\n" + 
35382
		"	          ^^^^^^\n" + 
35383
		"void[] is an invalid type\n" + 
35384
		"----------\n",
35385
		null,
35386
		true,
35387
		options);
35388
}
35389
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159939
35390
public void test1073() {
35391
	Map options = getCompilerOptions();
35392
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
35393
	this.runNegativeTest(
35394
		new String[] {
35395
			"X.java", // =================
35396
			"import java.util.*;\n" + 
35397
			"public class X {\n" + 
35398
			"        List<void[]> x = null;\n" + 
35399
			"        void[] y;\n" + 
35400
			"        void[] foo(void[] arg) {\n" + 
35401
			"                try {\n" + 
35402
			"                        void[] local;\n" + 
35403
			"                        Class c = void[].class;\n" + 
35404
			"                } catch(void[] e) {\n" + 
35405
			"                }\n" + 
35406
			"        }\n" + 
35407
			"}",
35408
		},
35409
		"----------\n" + 
35410
		"1. ERROR in X.java (at line 3)\n" + 
35411
		"	List<void[]> x = null;\n" + 
35412
		"	     ^^^^^^\n" + 
35413
		"void[] is an invalid type\n" + 
35414
		"----------\n" + 
35415
		"2. ERROR in X.java (at line 4)\n" + 
35416
		"	void[] y;\n" + 
35417
		"	^^^^^^\n" + 
35418
		"void[] is an invalid type\n" + 
35419
		"----------\n" + 
35420
		"3. ERROR in X.java (at line 5)\n" + 
35421
		"	void[] foo(void[] arg) {\n" + 
35422
		"	^^^^^^\n" + 
35423
		"void[] is an invalid type\n" + 
35424
		"----------\n" + 
35425
		"4. ERROR in X.java (at line 5)\n" + 
35426
		"	void[] foo(void[] arg) {\n" + 
35427
		"	           ^^^^^^\n" + 
35428
		"void[] is an invalid type\n" + 
35429
		"----------\n" + 
35430
		"5. ERROR in X.java (at line 7)\n" + 
35431
		"	void[] local;\n" + 
35432
		"	^^^^^^\n" + 
35433
		"void[] is an invalid type\n" + 
35434
		"----------\n" + 
35435
		"6. ERROR in X.java (at line 8)\n" + 
35436
		"	Class c = void[].class;\n" + 
35437
		"	          ^^^^^^\n" + 
35438
		"void[] is an invalid type\n" + 
35439
		"----------\n" + 
35440
		"7. ERROR in X.java (at line 9)\n" + 
35441
		"	} catch(void[] e) {\n" + 
35442
		"	        ^^^^^^\n" + 
35443
		"void[] is an invalid type\n" + 
35444
		"----------\n",
35445
		null,
35446
		true,
35447
		options);
35448
}
35449
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=159939
35450
public void test1074() {
35451
	Map options = getCompilerOptions();
35452
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
35453
	this.runNegativeTest(
35454
		new String[] {
35455
			"X.java", // =================
35456
			"import java.util.*;\n" + 
35457
			"public class X {\n" + 
35458
			"        List<void[]> x = null;\n" + 
35459
			"        void[] y;\n" + 
35460
			"        void[] foo(void[] arg) {\n" + 
35461
			"                try {\n" + 
35462
			"                        void[] local = new void[0];\n" + 
35463
			"                        void[] local1 = new void[]{ null, null };\n" + 
35464
			"                        void[] local2 = { null, null };\n" + 
35465
			"                        System.out.println((void[]) null);\n" + 
35466
			"                        Class c = void[].class;\n" + 
35467
			"                } catch(void[] e) {\n" + 
35468
			"                }\n" + 
35469
			"        }\n" + 
35470
			"}",
35471
		},
35472
		"----------\n" + 
35473
		"1. ERROR in X.java (at line 3)\n" + 
35474
		"	List<void[]> x = null;\n" + 
35475
		"	     ^^^^^^\n" + 
35476
		"void[] is an invalid type\n" + 
35477
		"----------\n" + 
35478
		"2. ERROR in X.java (at line 4)\n" + 
35479
		"	void[] y;\n" + 
35480
		"	^^^^^^\n" + 
35481
		"void[] is an invalid type\n" + 
35482
		"----------\n" + 
35483
		"3. ERROR in X.java (at line 5)\n" + 
35484
		"	void[] foo(void[] arg) {\n" + 
35485
		"	^^^^^^\n" + 
35486
		"void[] is an invalid type\n" + 
35487
		"----------\n" + 
35488
		"4. ERROR in X.java (at line 5)\n" + 
35489
		"	void[] foo(void[] arg) {\n" + 
35490
		"	           ^^^^^^\n" + 
35491
		"void[] is an invalid type\n" + 
35492
		"----------\n" + 
35493
		"5. ERROR in X.java (at line 7)\n" + 
35494
		"	void[] local = new void[0];\n" + 
35495
		"	^^^^^^\n" + 
35496
		"void[] is an invalid type\n" + 
35497
		"----------\n" + 
35498
		"6. ERROR in X.java (at line 7)\n" + 
35499
		"	void[] local = new void[0];\n" + 
35500
		"	               ^^^^^^^^^^^\n" + 
35501
		"void[] is an invalid type\n" + 
35502
		"----------\n" + 
35503
		"7. ERROR in X.java (at line 8)\n" + 
35504
		"	void[] local1 = new void[]{ null, null };\n" + 
35505
		"	^^^^^^\n" + 
35506
		"void[] is an invalid type\n" + 
35507
		"----------\n" + 
35508
		"8. ERROR in X.java (at line 8)\n" + 
35509
		"	void[] local1 = new void[]{ null, null };\n" + 
35510
		"	                ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35511
		"void[] is an invalid type\n" + 
35512
		"----------\n" + 
35513
		"9. ERROR in X.java (at line 9)\n" + 
35514
		"	void[] local2 = { null, null };\n" + 
35515
		"	^^^^^^\n" + 
35516
		"void[] is an invalid type\n" + 
35517
		"----------\n" + 
35518
		"10. ERROR in X.java (at line 10)\n" + 
35519
		"	System.out.println((void[]) null);\n" + 
35520
		"	                    ^^^^^^\n" + 
35521
		"void[] is an invalid type\n" + 
35522
		"----------\n" + 
35523
		"11. ERROR in X.java (at line 11)\n" + 
35524
		"	Class c = void[].class;\n" + 
35525
		"	          ^^^^^^\n" + 
35526
		"void[] is an invalid type\n" + 
35527
		"----------\n" + 
35528
		"12. ERROR in X.java (at line 12)\n" + 
35529
		"	} catch(void[] e) {\n" + 
35530
		"	        ^^^^^^\n" + 
35531
		"void[] is an invalid type\n" + 
35532
		"----------\n",
35533
		null,
35534
		true,
35535
		options);
35536
}
35537
35538
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=163680
35539
public void test1075() {
35540
	this.runConformTest(
35541
		new String[] {
35542
			"X.java",
35543
			"public class X <T extends X<?>.J>{\n" + 
35544
			"	public class J implements I<T>{}\n" + 
35545
			"}\n",
35546
			"I.java",
35547
			"public interface I <T> {}\n",
35548
			"Y.java",
35549
			"public class Y extends X {}\n",
35550
		},
35551
		""
35552
	);
35553
35554
	this.runConformTest(
35555
		new String[] {
35556
			"Y.java",
35557
			"public class Y extends X {}",
35558
		},
35559
		"",
35560
		null,
35561
		false, // do not flush output
35562
		null);
35563
}
35564
35565
public void test1076() {
35566
	this.runNegativeTest(
35567
		new String[] {
35568
			"X.java",
35569
			"import java.util.List;\n" + 
35570
			"public class X {\n" + 
35571
			"	List<Thread> threads;\n" + 
35572
			"	void foo(String[] strings) {}\n" + 
35573
			"	void bar() {\n" + 
35574
			"		foo(this.threads.toArray(new String[this.threads.size()]));\n" + 
35575
			"		foo(myToArray(this.threads, new String[this.threads.size()]));\n" + 
35576
			"		foo(myToArray2(this.threads, new String[this.threads.size()]));\n" + 
35577
			"	}\n" + 
35578
			"	\n" + 
35579
			"	static <T, E> T[] myToArray(List<E> list, T[] a) {\n" + 
35580
			"		return list.toArray(a);\n" + 
35581
			"	}\n" + 
35582
			"	static <T, E extends T> T[] myToArray2(List<E> list, T[] a) {\n" + 
35583
			"		return list.toArray(a);\n" + 
35584
			"	}\n" + 
35585
			"}\n",
35586
		},
35587
		"----------\n" + 
35588
		"1. ERROR in X.java (at line 8)\n" + 
35589
		"	foo(myToArray2(this.threads, new String[this.threads.size()]));\n" + 
35590
		"	    ^^^^^^^^^^\n" + 
35591
		"Bound mismatch: The generic method myToArray2(List<E>, T[]) of type X is not applicable for the arguments (List<Thread>, String[]). The inferred type Thread is not a valid substitute for the bounded parameter <E extends T>\n" + 
35592
		"----------\n");
35593
}
35594
// check presence of field hiding warning
35595
public void test1077() {
35596
	this.runNegativeTest(
35597
		new String[] {
35598
			"X.java",
35599
			"public class X {\n" + 
35600
			"	static class Y<T> {\n" + 
35601
			"		static int foo;\n" + 
35602
			"	}\n" + 
35603
			"	static class Z<U> extends Y<U> {\n" + 
35604
			"		int foo;\n" + 
35605
			"		{\n" + 
35606
			"			foo = 1;\n" + 
35607
			"		}\n" + 
35608
			"	}\n" + 
35609
			"	Zork z;\n" + 
35610
			"}\n" + 
35611
			"\n",
35612
		},
35613
		"----------\n" + 
35614
		"1. WARNING in X.java (at line 6)\n" + 
35615
		"	int foo;\n" + 
35616
		"	    ^^^\n" + 
35617
		"The field X.Z<U>.foo is hiding a field from type X.Y<U>\n" + 
35618
		"----------\n" + 
35619
		"2. ERROR in X.java (at line 11)\n" + 
35620
		"	Zork z;\n" + 
35621
		"	^^^^\n" + 
35622
		"Zork cannot be resolved to a type\n" + 
35623
		"----------\n");
35624
}
35625
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165143
35626
public void test1078() { 
35627
	this.runNegativeTest(
35628
		new String[] {
35629
			"X.java",
35630
			"import java.util.List;\n" + 
35631
			"import java.util.Map;\n" + 
35632
			"\n" + 
35633
			"public class X \n" + 
35634
			"{\n" + 
35635
			"  public static void main(String[] args)\n" + 
35636
			"  {\n" + 
35637
			"    Object object = null;\n" + 
35638
			"\n" + 
35639
			"    List list = (List)object;//[1]\n" + 
35640
			"\n" + 
35641
			"    foo((List)object);//[2]\n" + 
35642
			"    foo((List<?>)object);//[3]\n" + 
35643
			"    foo((List<Object>)object);//[4]unchecked cast\n" + 
35644
			"    foo((List<? extends Object>)object);//[5]\n" + 
35645
			"\n" + 
35646
			"    foo((Map)object);//[6]\n" + 
35647
			"    foo((Map<?, ?>)object);//[7]\n" + 
35648
			"    foo((Map<Object, ?>)object);//[8]unchecked cast\n" + 
35649
			"    foo((Map<?, Object>)object);//[9]unchecked cast\n" + 
35650
			"    foo((Map<Object, Object>)object);//[10]unchecked cast\n" + 
35651
			"    foo((Map<? extends Object, Object>)object);//[11]unchecked cast\n" + 
35652
			"    foo((Map<? extends Object, ? extends Object>)object);//[12]\n" + 
35653
			"    Zork z;\n" + 
35654
			"  }\n" + 
35655
			"\n" + 
35656
			"  public static void foo(List<?> list) {\n" + 
35657
			"  }\n" + 
35658
			"\n" + 
35659
			"  public static void foo(Map<?, ?> map) {\n" + 
35660
			"  }\n" + 
35661
			"}", // =================,
35662
		},
35663
		// unchecked warnings on [4][5][8][9][10][11][12]
35664
		"----------\n" + 
35665
		"1. WARNING in X.java (at line 10)\n" + 
35666
		"	List list = (List)object;//[1]\n" + 
35667
		"	^^^^\n" + 
35668
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
35669
		"----------\n" + 
35670
		"2. WARNING in X.java (at line 10)\n" + 
35671
		"	List list = (List)object;//[1]\n" + 
35672
		"	             ^^^^\n" + 
35673
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
35674
		"----------\n" + 
35675
		"3. WARNING in X.java (at line 12)\n" + 
35676
		"	foo((List)object);//[2]\n" + 
35677
		"	     ^^^^\n" + 
35678
		"List is a raw type. References to generic type List<E> should be parameterized\n" + 
35679
		"----------\n" + 
35680
		"4. WARNING in X.java (at line 14)\n" + 
35681
		"	foo((List<Object>)object);//[4]unchecked cast\n" + 
35682
		"	    ^^^^^^^^^^^^^^^^^^^^\n" + 
35683
		"Type safety: Unchecked cast from Object to List<Object>\n" + 
35684
		"----------\n" + 
35685
		"5. WARNING in X.java (at line 15)\n" + 
35686
		"	foo((List<? extends Object>)object);//[5]\n" + 
35687
		"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35688
		"Type safety: Unchecked cast from Object to List<? extends Object>\n" + 
35689
		"----------\n" + 
35690
		"6. WARNING in X.java (at line 17)\n" + 
35691
		"	foo((Map)object);//[6]\n" + 
35692
		"	     ^^^\n" + 
35693
		"Map is a raw type. References to generic type Map<K,V> should be parameterized\n" + 
35694
		"----------\n" + 
35695
		"7. WARNING in X.java (at line 19)\n" + 
35696
		"	foo((Map<Object, ?>)object);//[8]unchecked cast\n" + 
35697
		"	    ^^^^^^^^^^^^^^^^^^^^^^\n" + 
35698
		"Type safety: Unchecked cast from Object to Map<Object,?>\n" + 
35699
		"----------\n" + 
35700
		"8. WARNING in X.java (at line 20)\n" + 
35701
		"	foo((Map<?, Object>)object);//[9]unchecked cast\n" + 
35702
		"	    ^^^^^^^^^^^^^^^^^^^^^^\n" + 
35703
		"Type safety: Unchecked cast from Object to Map<?,Object>\n" + 
35704
		"----------\n" + 
35705
		"9. WARNING in X.java (at line 21)\n" + 
35706
		"	foo((Map<Object, Object>)object);//[10]unchecked cast\n" + 
35707
		"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35708
		"Type safety: Unchecked cast from Object to Map<Object,Object>\n" + 
35709
		"----------\n" + 
35710
		"10. WARNING in X.java (at line 22)\n" + 
35711
		"	foo((Map<? extends Object, Object>)object);//[11]unchecked cast\n" + 
35712
		"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35713
		"Type safety: Unchecked cast from Object to Map<? extends Object,Object>\n" + 
35714
		"----------\n" + 
35715
		"11. WARNING in X.java (at line 23)\n" + 
35716
		"	foo((Map<? extends Object, ? extends Object>)object);//[12]\n" + 
35717
		"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35718
		"Type safety: Unchecked cast from Object to Map<? extends Object,? extends Object>\n" + 
35719
		"----------\n" + 
35720
		"12. ERROR in X.java (at line 24)\n" + 
35721
		"	Zork z;\n" + 
35722
		"	^^^^\n" + 
35723
		"Zork cannot be resolved to a type\n" + 
35724
		"----------\n");
35725
}
35726
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165143 - variation
35727
public void test1079() { 
35728
	this.runNegativeTest(
35729
		new String[] {
35730
			"X.java",
35731
			"public class X<E> {\n" + 
35732
			"    X<? extends String> bar(Object o) {\n" + 
35733
			"    	return (AX<? extends String>) o;\n" + 
35734
			"   	 Zork z;\n" + 
35735
			"    }\n" + 
35736
			"}\n" + 
35737
			"class AX<F> extends X<F> {}\n", // =================,
35738
		},
35739
		"----------\n" + 
35740
		"1. WARNING in X.java (at line 3)\n" + 
35741
		"	return (AX<? extends String>) o;\n" + 
35742
		"	       ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35743
		"Type safety: Unchecked cast from Object to AX<? extends String>\n" + 
35744
		"----------\n" + 
35745
		"2. ERROR in X.java (at line 4)\n" + 
35746
		"	Zork z;\n" + 
35747
		"	^^^^\n" + 
35748
		"Zork cannot be resolved to a type\n" + 
35749
		"----------\n");
35750
}
35751
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165143 - variation
35752
public void test1080() { 
35753
	this.runNegativeTest(
35754
		new String[] {
35755
			"X.java",
35756
			"public class X<E> {\n" + 
35757
			"	CX<E> foo(X<String> x) {\n" + 
35758
			"		return (CX<E>) x; // unchecked\n" + 
35759
			"	}\n" + 
35760
			"	BX bar(X<String> x) {\n" + 
35761
			"		return (BX) x;\n" + 
35762
			"	}\n" + 
35763
			"   Zork z;\n" + 
35764
			"}\n" + 
35765
			"class AX<F> extends X<F> {}\n" + 
35766
			"class BX extends AX<String> {}\n" + 
35767
			"class CX<G> extends AX<String> {}\n", // =================,
35768
		},
35769
		"----------\n" + 
35770
		"1. WARNING in X.java (at line 3)\n" + 
35771
		"	return (CX<E>) x; // unchecked\n" + 
35772
		"	       ^^^^^^^^^\n" + 
35773
		"Type safety: Unchecked cast from X<String> to CX<E>\n" + 
35774
		"----------\n" + 
35775
		"2. ERROR in X.java (at line 8)\n" + 
35776
		"	Zork z;\n" + 
35777
		"	^^^^\n" + 
35778
		"Zork cannot be resolved to a type\n" + 
35779
		"----------\n");
35780
}
35781
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165143 - variation
35782
public void test1081() { 
35783
	this.runNegativeTest(
35784
		new String[] {
35785
			"X.java",
35786
			"public class X<E> {\n" + 
35787
			"	AX<Object> foo(X<String> x) {\n" + 
35788
			"		return (BX) x;\n" + 
35789
			"	}\n" + 
35790
			"}\n" + 
35791
			"class AX<F> extends X<F> {}\n" + 
35792
			"class BX extends AX<Object> {}\n", // =================,
35793
		},
35794
		"----------\n" + 
35795
		"1. ERROR in X.java (at line 3)\n" + 
35796
		"	return (BX) x;\n" + 
35797
		"	       ^^^^^^\n" + 
35798
		"Cannot cast from X<String> to BX\n" + 
35799
		"----------\n");
35800
}
35801
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165143 - variation
35802
public void test1082() { 
35803
	this.runNegativeTest(
35804
		new String[] {
35805
			"X.java",
35806
			"public class X<E> {\n" + 
35807
			"	CX<E> foo(X<String> x) {\n" + 
35808
			"		return (CX<E>) x; // unchecked\n" + 
35809
			"	}\n" + 
35810
			"   Zork z;\n" + 
35811
			"}\n" + 
35812
			"class AX<F> extends X<F> {}\n" + 
35813
			"class CX<G> extends AX {}\n", // =================,
35814
		},
35815
		"----------\n" + 
35816
		"1. WARNING in X.java (at line 3)\n" + 
35817
		"	return (CX<E>) x; // unchecked\n" + 
35818
		"	       ^^^^^^^^^\n" + 
35819
		"Type safety: Unchecked cast from X<String> to CX<E>\n" + 
35820
		"----------\n" + 
35821
		"2. ERROR in X.java (at line 5)\n" + 
35822
		"	Zork z;\n" + 
35823
		"	^^^^\n" + 
35824
		"Zork cannot be resolved to a type\n" + 
35825
		"----------\n" + 
35826
		"3. WARNING in X.java (at line 8)\n" + 
35827
		"	class CX<G> extends AX {}\n" + 
35828
		"	                    ^^\n" + 
35829
		"AX is a raw type. References to generic type AX<F> should be parameterized\n" + 
35830
		"----------\n");
35831
}
35832
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=106451 - variation
35833
public void test1083() {
35834
	this.runNegativeTest(
35835
		new String[] {
35836
			"X.java", // =================
35837
			"import java.io.Serializable;\n" + 
35838
			"import java.util.LinkedList;\n" + 
35839
			"\n" + 
35840
			"class SerializableList extends LinkedList<Serializable> {\n" + 
35841
			"	private static final long serialVersionUID = 1L; \n" + 
35842
			"}\n" + 
35843
			"public class X {\n" + 
35844
			"    @SuppressWarnings({\"nls\", \"unused\"})\n" + 
35845
			"    public static void main(String[] args) {\n" + 
35846
			"        LinkedList<String> linkedList= new LinkedList<String>();\n" + 
35847
			"        linkedList.add(\"Hello\");\n" + 
35848
			"        java.util.List<? extends Serializable> a = linkedList;\n" + 
35849
			"        java.util.List<String> b = (LinkedList<String>) a; // unchecked\n" + 
35850
			"        java.util.List<Integer> c = (LinkedList<Integer>) a; // unchecked\n" + 
35851
			"        java.util.List<Runtime> d = (LinkedList<Runtime>) a; // inconvertible / unchecked ?\n" + 
35852
			"        c.get(0).intValue(); // fails at run time\n" + 
35853
			"        d.get(0).gc(); // fails at run time\n" + 
35854
			"        Zork z;\n" +
35855
			"    }\n" + 
35856
			"}\n", // =================
35857
		},
35858
		"----------\n" + 
35859
		"1. WARNING in X.java (at line 13)\n" + 
35860
		"	java.util.List<String> b = (LinkedList<String>) a; // unchecked\n" + 
35861
		"	                           ^^^^^^^^^^^^^^^^^^^^^^\n" + 
35862
		"Type safety: Unchecked cast from List<capture#1-of ? extends Serializable> to LinkedList<String>\n" + 
35863
		"----------\n" + 
35864
		"2. WARNING in X.java (at line 14)\n" + 
35865
		"	java.util.List<Integer> c = (LinkedList<Integer>) a; // unchecked\n" + 
35866
		"	                            ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35867
		"Type safety: Unchecked cast from List<capture#2-of ? extends Serializable> to LinkedList<Integer>\n" + 
35868
		"----------\n" + 
35869
		"3. WARNING in X.java (at line 15)\n" + 
35870
		"	java.util.List<Runtime> d = (LinkedList<Runtime>) a; // inconvertible / unchecked ?\n" + 
35871
		"	                            ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
35872
		"Type safety: Unchecked cast from List<capture#3-of ? extends Serializable> to LinkedList<Runtime>\n" + 
35873
		"----------\n" + 
35874
		"4. ERROR in X.java (at line 18)\n" + 
35875
		"	Zork z;\n" + 
35876
		"	^^^^\n" + 
35877
		"Zork cannot be resolved to a type\n" + 
35878
		"----------\n");
35879
}
35880
35881
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158870
35882
public void _test1084() {
35883
	this.runNegativeTest(
35884
		new String[] {
35885
			"X.java",
35886
			"class Y<T> {\n" + 
35887
			"}\n" + 
35888
			"class Z<T> {\n" + 
35889
			"}\n" + 
35890
			"class X {\n" + 
35891
			"  void foo() {\n" + 
35892
			"    Z<Y<?>> l1 = null;\n" + 
35893
			"    Z<Y> l2 = (Z<Y>) l1;\n" + 
35894
			// javac raises an error but we only raise a warning here
35895
			"  }\n" + 
35896
			"}",
35897
		},
35898
		"ERR");
35899
}
35900
35901
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165291
35902
public void test1085() {
35903
	this.runNegativeTest(
35904
		new String[] {
35905
			"Y.java",
35906
			"class Z {\n" + 
35907
			"        Z z1 = z1;\n" + 
35908
			"        Z[] z2 = z2;\n" + 
35909
			"}\n" + 
35910
			"public class Y<E> {\n" + 
35911
			"		E e0 = es[0];\n" + 
35912
			"		E e = e;\n" + 
35913
			"        E[] es = es;\n" + 
35914
			"		E e2 = e2.e;\n" + 
35915
			"}", // =================
35916
		},
35917
		"----------\n" + 
35918
		"1. ERROR in Y.java (at line 2)\n" + 
35919
		"	Z z1 = z1;\n" + 
35920
		"	       ^^\n" + 
35921
		"Cannot reference a field before it is defined\n" + 
35922
		"----------\n" + 
35923
		"2. ERROR in Y.java (at line 3)\n" + 
35924
		"	Z[] z2 = z2;\n" + 
35925
		"	         ^^\n" + 
35926
		"Cannot reference a field before it is defined\n" + 
35927
		"----------\n" + 
35928
		"3. ERROR in Y.java (at line 6)\n" + 
35929
		"	E e0 = es[0];\n" + 
35930
		"	       ^^\n" + 
35931
		"Cannot reference a field before it is defined\n" + 
35932
		"----------\n" + 
35933
		"4. ERROR in Y.java (at line 7)\n" + 
35934
		"	E e = e;\n" + 
35935
		"	      ^\n" + 
35936
		"Cannot reference a field before it is defined\n" + 
35937
		"----------\n" + 
35938
		"5. ERROR in Y.java (at line 8)\n" + 
35939
		"	E[] es = es;\n" + 
35940
		"	         ^^\n" + 
35941
		"Cannot reference a field before it is defined\n" + 
35942
		"----------\n" + 
35943
		"6. ERROR in Y.java (at line 9)\n" + 
35944
		"	E e2 = e2.e;\n" + 
35945
		"	       ^^^^\n" + 
35946
		"Cannot reference a field before it is defined\n" + 
35947
		"----------\n" + 
35948
		"7. ERROR in Y.java (at line 9)\n" + 
35949
		"	E e2 = e2.e;\n" + 
35950
		"	       ^^^^\n" + 
35951
		"e2.e cannot be resolved or is not a field\n" + 
35952
		"----------\n");
35953
}
35954
35955
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165645
35956
public void test1086() {
35957
	this.runNegativeTest(
35958
		new String[] {
35959
			"X.java",
35960
			"interface IFoo { void foo(); }\n" + 
35961
			"interface IBar { void bar(); }\n" + 
35962
			"public class X<Bar extends IFoo> {\n" + 
35963
			"	class Bar implements IBar { public void bar(){} }\n" + 
35964
			"	void foo(Bar b) {\n" + 
35965
			"		b.foo(); // unbound (Bar is member type)\n" + 
35966
			"		b.bar(); // ok\n" + 
35967
			"	}\n" + 
35968
			"}\n", // =================,
35969
		},
35970
		"----------\n" + 
35971
		"1. ERROR in X.java (at line 6)\n" + 
35972
		"	b.foo(); // unbound (Bar is member type)\n" + 
35973
		"	  ^^^\n" + 
35974
		"The method foo() is undefined for the type X<Bar>.Bar\n" + 
35975
		"----------\n");
35976
}
35977
35978
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165645 - variation
35979
// **
35980
public void test1087() {
35981
	this.runConformTest(
35982
		new String[] {
35983
			"X.java",
35984
			"public class X<M> {\n" + 
35985
			"	static public class M {\n" + 
35986
			"	}\n" + 
35987
			"	static public class M2 extends M {\n" + 
35988
			"	}\n" + 
35989
			"}\n" + 
35990
			"\n", // =================
35991
		},
35992
		"");
35993
}
35994
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165679
35995
public void test1088() {
35996
	this.runNegativeTest(
35997
			new String[] {
35998
				"X.java",
35999
				"public class X<M> {\n" + 
36000
				"	static public class M {}\n" + 
36001
				"	Zork z;\n" +
36002
				"	void foo() {\n" + 
36003
				"		class M {} // hides member\n" + 
36004
				"	}\n" + 
36005
				"}\n" + 
36006
				"class Y <T> {\n" + 
36007
				"	class Local {}\n" + 
36008
				"	void foo() {\n" + 
36009
				"		class T {}; // hiding warning\n" + 
36010
				"		class Local {};\n" + 
36011
				"	}\n" + 
36012
				"	static void bar() {\n" + 
36013
				"		class T {}; // no hiding warning\n" + 
36014
				"		class Local {}; // no hiding warning\n" + 
36015
				"	}	\n" + 
36016
				"}\n", // =================
36017
			},
36018
			"----------\n" + 
36019
			"1. ERROR in X.java (at line 3)\n" + 
36020
			"	Zork z;\n" + 
36021
			"	^^^^\n" + 
36022
			"Zork cannot be resolved to a type\n" + 
36023
			"----------\n" + 
36024
			"2. WARNING in X.java (at line 5)\n" + 
36025
			"	class M {} // hides member\n" + 
36026
			"	      ^\n" + 
36027
			"The type M is hiding the type X<M>.M\n" + 
36028
			"----------\n" + 
36029
			"3. WARNING in X.java (at line 11)\n" + 
36030
			"	class T {}; // hiding warning\n" + 
36031
			"	      ^\n" + 
36032
			"The nested type T is hiding the type parameter T of type Y<T>\n" + 
36033
			"----------\n" + 
36034
			"4. WARNING in X.java (at line 11)\n" +
36035
			"	class T {}; // hiding warning\n" +
36036
			"	      ^\n" +
36037
			"The type T is never used locally\n" +
36038
			"----------\n" +
36039
			"5. WARNING in X.java (at line 12)\n" + 
36040
			"	class Local {};\n" + 
36041
			"	      ^^^^^\n" + 
36042
			"The type Local is hiding the type Y<T>.Local\n" + 
36043
			"----------\n" +
36044
			"6. WARNING in X.java (at line 12)\n" +
36045
			"	class Local {};\n" +
36046
			"	      ^^^^^\n" +
36047
			"The type Local is never used locally\n" +
36048
			"----------\n" +
36049
			"7. WARNING in X.java (at line 15)\n" +
36050
			"	class T {}; // no hiding warning\n" +
36051
			"	      ^\n" +
36052
			"The type T is never used locally\n" +
36053
			"----------\n" +
36054
			"8. WARNING in X.java (at line 16)\n" +
36055
			"	class Local {}; // no hiding warning\n" +
36056
			"	      ^^^^^\n" +
36057
			"The type Local is never used locally\n" +
36058
			"----------\n");
36059
}
36060
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165679 - variation
36061
public void test1089() {
36062
	this.runNegativeTest(
36063
		new String[] {
36064
			"X.java",
36065
			"public class X {\n" + 
36066
			"	class U {}\n" + 
36067
			"	<T> void foo(T t) {\n" + 
36068
			"		class T {\n" + 
36069
			"			T t = t;\n" + 
36070
			"		}\n" + 
36071
			"		class U {\n" + 
36072
			"		}\n" + 
36073
			"	}\n" + 
36074
			"}\n" + 
36075
			"\n", // =================
36076
		},
36077
		"----------\n" + 
36078
		"1. WARNING in X.java (at line 4)\n" + 
36079
		"	class T {\n" + 
36080
		"	      ^\n" + 
36081
		"The nested type T is hiding the type parameter T of the generic method foo(T) of type X\n" + 
36082
		"----------\n" + 
36083
		"2. WARNING in X.java (at line 5)\n" + 
36084
		"	T t = t;\n" + 
36085
		"	  ^\n" + 
36086
		"The field T.t is hiding another local variable defined in an enclosing type scope\n" + 
36087
		"----------\n" + 
36088
		"3. ERROR in X.java (at line 5)\n" + 
36089
		"	T t = t;\n" + 
36090
		"	      ^\n" + 
36091
		"Cannot reference a field before it is defined\n" + 
36092
		"----------\n" + 
36093
		"4. WARNING in X.java (at line 7)\n" + 
36094
		"	class U {\n" + 
36095
		"	      ^\n" + 
36096
		"The type U is hiding the type X.U\n" + 
36097
		"----------\n");
36098
}
36099
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165679 - variation
36100
public void _test1090() {
36101
	this.runNegativeTest(
36102
		new String[] {
36103
			"X.java",
36104
			"public class X <T,U> {\n" + 
36105
			"	class T {} // warn hiding type parameter\n" + 
36106
			"	class U<U> {}// warn hiding type parameter+warn param hiding member type\n" + 
36107
			"	\n" + 
36108
			"	void foo() {\n" + 
36109
			"		class Local {\n" + 
36110
			"			class T {} // warn hiding type parameter\n" + 
36111
			"			class U<U> {}// warn hiding type parameter+warn param hiding member type\n" + 
36112
			"		}\n" + 
36113
			"	}\n" + 
36114
			"	static void bar() {\n" + 
36115
			"		class Local {\n" + 
36116
			"			class T {} // no warn\n" + 
36117
			"			class U<U> {} // no warn\n" + 
36118
			"		}\n" + 
36119
			"	}\n" + 
36120
			"}", // =================
36121
		},
36122
		"???");
36123
}
36124
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165909
36125
public void test1091() {
36126
	this.runNegativeTest(
36127
		new String[] {
36128
			"X.java",
36129
			"import java.util.Map;\n" + 
36130
			"\n" + 
36131
			"public class X {\n" + 
36132
			"	void foo() {\n" + 
36133
			"		  Object a = null;\n" + 
36134
			"		  Map.Entry<String, String> aa = (Map.Entry<String, String>)a;		\n" + 
36135
			"	}\n" + 
36136
			"	void bar() {\n" + 
36137
			"		  Number a = null;\n" + 
36138
			"		  Map.Entry<String, String> aa = (Map.Entry<String, String>)a;		\n" + 
36139
			"		  Zork z;\n" +
36140
			"	}\n" + 
36141
			"}\n", // =================
36142
		},
36143
		"----------\n" + 
36144
		"1. WARNING in X.java (at line 6)\n" + 
36145
		"	Map.Entry<String, String> aa = (Map.Entry<String, String>)a;		\n" + 
36146
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
36147
		"Type safety: Unchecked cast from Object to Map.Entry<String,String>\n" + 
36148
		"----------\n" + 
36149
		"2. WARNING in X.java (at line 10)\n" + 
36150
		"	Map.Entry<String, String> aa = (Map.Entry<String, String>)a;		\n" + 
36151
		"	                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
36152
		"Type safety: Unchecked cast from Number to Map.Entry<String,String>\n" + 
36153
		"----------\n" + 
36154
		"3. ERROR in X.java (at line 11)\n" + 
36155
		"	Zork z;\n" + 
36156
		"	^^^^\n" + 
36157
		"Zork cannot be resolved to a type\n" + 
36158
		"----------\n");
36159
}
36160
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=166490
36161
public void test1092() {
36162
	Map customOptions = this.getCompilerOptions();
36163
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
36164
	this.runConformTest(
36165
		new String[] {
36166
			"Class_01.java",
36167
			"public interface Class_01<H extends Class_02<? extends Class_01>> extends\r\n" + 
36168
			"		Class_09<H> {\r\n" + 
36169
			"}",
36170
			"Class_02.java",
36171
			"public interface Class_02<E extends Class_01<? extends Class_02>> extends\r\n" + 
36172
			"		Class_10<E> {\r\n" + 
36173
			"}",
36174
			"Class_03.java",
36175
			"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" + 
36176
			"		extends Class_08<E, H, P> implements Class_05 {\r\n" + 
36177
			"}",
36178
			"Class_04.java",
36179
			"public interface Class_04 extends Class_06<Class_18>, Class_19{\r\n" + 
36180
			"}",
36181
			"Class_05.java",
36182
			"public interface Class_05{\r\n" + 
36183
			"}",
36184
			"Class_06.java",
36185
			"public interface Class_06<H extends Class_07<? extends Class_06>> extends\r\n" + 
36186
			"		Class_13<H, Class_12>, Class_17 {\r\n" + 
36187
			"}",
36188
			"Class_07.java",
36189
			"public interface Class_07<P extends Class_06<? extends Class_07>> extends\r\n" + 
36190
			"		Class_14<P, Class_12> {\r\n" + 
36191
			"}",
36192
			"Class_08.java",
36193
			"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" + 
36194
			"		extends Class_11<E, H, Class_12> implements Class_05 {\r\n" + 
36195
			"}",
36196
			"Class_09.java",
36197
			"public interface Class_09<H extends Class_10<? extends Class_09>> extends\r\n" + 
36198
			"		Class_13<H, Class_12>, Class_17 {\r\n" + 
36199
			"}",
36200
			"Class_10.java",
36201
			"public interface Class_10<E extends Class_09<? extends Class_10>> extends\r\n" + 
36202
			"		Class_14<E, Class_12> {\r\n" + 
36203
			"}",
36204
			"Class_11.java",
36205
			"public abstract class Class_11<E extends Class_13<? super H, O>, H extends Class_14<? super E, O>, O>\r\n" + 
36206
			"		extends Class_15<E, H, O> implements Class_05 {\r\n" + 
36207
			"}",
36208
			"Class_12.java",
36209
			"public final class Class_12 {\r\n" + 
36210
			"}",
36211
			"Class_13.java",
36212
			"public interface Class_13<H extends Class_14<?, O>, O>{\r\n" + 
36213
			"}",
36214
			"Class_14.java",
36215
			"public interface Class_14<E extends Class_13<?, O>, O>{\r\n" + 
36216
			"}",
36217
			"Class_15.java",
36218
			"public abstract class Class_15<E extends Class_13<? super H, O>, H extends Class_14<? super E, O>, O>\r\n" + 
36219
			"		extends Class_16 {\r\n" + 
36220
			"}",
36221
			"Class_16.java",
36222
			"public abstract class Class_16{\r\n" + 
36223
			"}",
36224
			"Class_17.java",
36225
			"public interface Class_17{\r\n" + 
36226
			"}",
36227
			"Class_18.java",
36228
			"public interface Class_18 extends Class_07<Class_04>{\r\n" + 
36229
			"}",
36230
			"Class_19.java",
36231
			"public interface Class_19{\r\n" + 
36232
			"}",
36233
			"MyClass.java",
36234
			"abstract class MyClass<E extends Class_01<? super H>, H extends Class_02<? super E>>\r\n" + 
36235
			"		extends Class_03<E, H, Class_04> implements Class_05 {\r\n" + 
36236
			"}"
36237
		},
36238
		"",
36239
		null,
36240
		true,
36241
		null,
36242
		customOptions,
36243
		null);
36244
36245
	// incremental build
36246
	this.runConformTest(
36247
			new String[] {
36248
					"Class_01.java",
36249
					"public interface Class_01<H extends Class_02<? extends Class_01>> extends\r\n" + 
36250
					"		Class_09<H> {\r\n" + 
36251
					"}",
36252
			},
36253
			"",
36254
			null,
36255
			false,
36256
			null,
36257
			customOptions,
36258
			null);
36259
}
36260
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=156952
36261
// invalid bug - regression test only
36262
public void test1093() {
36263
	Map customOptions = this.getCompilerOptions();
36264
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
36265
	this.runNegativeTest(new String[] {
36266
			"X.java",
36267
			"public class X<T> {\n" +
36268
			"  X<T> foo() {\n" +
36269
			"    return this;\n" +
36270
			"  }\n" +
36271
			"  T bar(T p) {\n" +
36272
			"    return p;\n" + "  }\n"	+
36273
			"  public static void main (String args) {\n" +
36274
			"    X<String> x1 = new X<String>();\n"	+
36275
			"    System.out.println(x1.foo().bar(\"OK\"));\n" + // OK
36276
			"    X x2 = new X<String>();\n"	+
36277
			"    System.out.println(x2.foo().bar(\"OK\"));\n" + // KO: type safety issue
36278
			"  }\n" +
36279
			"}\n"
36280
		}, 
36281
		"----------\n" + 
36282
		"1. WARNING in X.java (at line 12)\n" + 
36283
		"	System.out.println(x2.foo().bar(\"OK\"));\n" + 
36284
		"	                   ^^^^^^^^^^^^^^^^^^\n" + 
36285
		"Type safety: The method bar(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
36286
		"----------\n",
36287
		null /* no extra class libraries */, 
36288
		true /* flush output directory */, 
36289
		customOptions,
36290
		false /* do not generate output */,
36291
		false /* do not show category */, 
36292
		false /* do not show warning token */, 
36293
		false  /* do not skip javac for this peculiar test */,
36294
		false  /* do not perform statements recovery */);
36295
}
36296
private void runNegativeTest(String[] strings,
36297
        String string,
36298
        Object object,
36299
        boolean b,
36300
        Map customOptions,
36301
        boolean c,
36302
        boolean d,
36303
        boolean e,
36304
        boolean f,
36305
        boolean g) {
36306
	// TODO Auto-generated method stub
36307
	
36308
}
36309
36310
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=167268
36311
public void test1094() {
36312
	Map customOptions = this.getCompilerOptions();
36313
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
36314
	this.runConformTest(
36315
		new String[] {
36316
			"Crazy.java",
36317
			"public interface Crazy<O extends Other, T extends O> {}",
36318
			"ExampleFactory.java",
36319
			"public interface ExampleFactory {\n" + 
36320
			"	<O extends Other, T extends O> Crazy<O, T> createCrazy();\n" + 
36321
			"}",
36322
			"Other.java",
36323
			"public interface Other {}",
36324
			"ExampleFactoryImpl.java",
36325
			"public class ExampleFactoryImpl implements ExampleFactory {\n" + 
36326
			"	public <O extends Other, T extends O> Crazy<O, T> createCrazy() {\n" + 
36327
			"		return null;\n" + 
36328
			"	}\n" + 
36329
			"}"
36330
		}, 
36331
		"",
36332
		null /* no extra class libraries */, 
36333
		true /* flush output directory */,
36334
		null /* vm arguments*/,
36335
		customOptions,
36336
		null /* compiler requestor*/);
36337
	this.runConformTest(
36338
		new String[] {
36339
			"ExampleFactoryImpl.java",
36340
			"public class ExampleFactoryImpl implements ExampleFactory {\n" + 
36341
			"	public <O extends Other, T extends O> Crazy<O, T> createCrazy() {\n" + 
36342
			"		return null;\n" + 
36343
			"	}\n" + 
36344
			"}"
36345
		}, 
36346
		"",
36347
		null /* no extra class libraries */, 
36348
		false /* flush output directory */,
36349
		null /* vm arguments*/,
36350
		customOptions,
36351
		null /* compiler requestor*/);
36352
}
36353
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=167952
36354
//invalid bug - regression test only
36355
public void test1095() {
36356
	Map customOptions = this.getCompilerOptions();
36357
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
36358
	customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.IGNORE);
36359
	this.runNegativeTest(new String[] {
36360
			"X.java",
36361
			"import java.lang.reflect.Constructor;\n" + 
36362
			"\n" + 
36363
			"@interface Annot {\n" + 
36364
			"	String message() default \"\"; //$NON-NLS-1$\n" + 
36365
			"}\n" + 
36366
			"\n" + 
36367
			"public class X {\n" + 
36368
			"	X() {\n" + 
36369
			"	}\n" + 
36370
			"	public String getAnnotationValue(Constructor constructor){\n" + 
36371
			"		Annot annotation = constructor.getAnnotation(Annot.class);\n" + 
36372
			"		return (annotation != null) ? annotation.message() : null;\n" + 
36373
			"	}\n" + 
36374
			"}"
36375
		}, 
36376
		"----------\n" + 
36377
		"1. ERROR in X.java (at line 11)\n" + 
36378
		"	Annot annotation = constructor.getAnnotation(Annot.class);\n" + 
36379
		"	                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
36380
		"Type mismatch: cannot convert from Annotation to Annot\n" + 
36381
		"----------\n",
36382
		null /* no extra class libraries */, 
36383
		true /* flush output directory */, 
36384
		customOptions,
36385
		false /* do not generate output */,
36386
		false /* do not show category */, 
36387
		false /* do not show warning token */, 
36388
		false  /* do not skip javac for this peculiar test */,
36389
		false  /* do not perform statements recovery */);
36390
}
36391
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=167952
36392
//invalid bug - regression test only
36393
public void test1096() {
36394
	Map customOptions = this.getCompilerOptions();
36395
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
36396
	customOptions.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.IGNORE);
36397
	this.runConformTest(
36398
		new String[] {
36399
			"X.java",
36400
			"import java.lang.reflect.Constructor;\n" + 
36401
			"\n" + 
36402
			"@interface Annot {\n" + 
36403
			"	String message() default \"\"; //$NON-NLS-1$\n" + 
36404
			"}\n" + 
36405
			"\n" + 
36406
			"public class X {\n" + 
36407
			"	X() {\n" + 
36408
			"	}\n" + 
36409
			"	public String getAnnotationValue(Constructor<X> constructor){\n" + 
36410
			"		Annot annotation = constructor.getAnnotation(Annot.class);\n" + 
36411
			"		return (annotation != null) ? annotation.message() : null;\n" + 
36412
			"	}\n" + 
36413
			"}"
36414
		}, 
36415
		"",
36416
		null /* no extra class libraries */, 
36417
		true /* flush output directory */,
36418
		null,
36419
		customOptions,
36420
		null/* do not perform statements recovery */);
36421
}
36422
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=168232
36423
// **
36424
public void test1097() {
36425
	this.runNegativeTest(new String[] {
36426
			"X.java",
36427
			"public class X {\n" + 
36428
			"	String[] foo = new <Zork>String[] {};\n" + 
36429
			"}"
36430
		}, 
36431
		"----------\n" + 
36432
		"1. ERROR in X.java (at line 2)\n" + 
36433
		"	String[] foo = new <Zork>String[] {};\n" + 
36434
		"	               ^^^^^^^^^^^^^^^^^^\n" + 
36435
		"Syntax error on token(s), misplaced construct(s)\n" + 
36436
		"----------\n" + 
36437
		"2. ERROR in X.java (at line 2)\n" + 
36438
		"	String[] foo = new <Zork>String[] {};\n" + 
36439
		"	                        ^\n" + 
36440
		"Syntax error on token \">\", , expected\n" + 
36441
		"----------\n");
36442
}
36443
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152961
36444
public void test1098() {
36445
	this.runNegativeTest(new String[] {
36446
			"X.java",
36447
			"public class X { \n" + 
36448
			"   private class A {\n" + 
36449
			"    class B {}\n" + 
36450
			"  }\n" + 
36451
			"  private class Y<T> extends A {\n" + 
36452
			"  }\n" + 
36453
			"  Y<String>.B d = null;\n" + 
36454
			"}\n" + 
36455
			"class Y extends Zork {}\n"
36456
		}, 
36457
		"----------\n" + 
36458
		"1. WARNING in X.java (at line 5)\n" + 
36459
		"	private class Y<T> extends A {\n" + 
36460
		"	              ^\n" + 
36461
		"Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
36462
		"----------\n" + 
36463
		"2. ERROR in X.java (at line 9)\n" + 
36464
		"	class Y extends Zork {}\n" + 
36465
		"	                ^^^^\n" + 
36466
		"Zork cannot be resolved to a type\n" + 
36467
		"----------\n");
36468
}
36469
// **
36470
public void test1099() {
36471
	this.runConformTest(new String[] {
36472
			"X.java",
36473
			"import java.util.*;\n" + 
36474
			"\n" + 
36475
			"public class X {\n" + 
36476
			"\n" + 
36477
			"    public class A {};\n" + 
36478
			"    public class B extends A {\n" + 
36479
			"    	@Override\n" + 
36480
			"    	public String toString() {\n" + 
36481
			"    		return \"SUCCESS\";\n" + 
36482
			"    	}\n" + 
36483
			"    }\n" + 
36484
			"\n" + 
36485
			"    public static void main(String[] args) {\n" + 
36486
			"        X x = new X();\n" + 
36487
			"        List<A> l = x.newList(x.new B());\n" + 
36488
			"		for (A a: l) {\n" + 
36489
			"			System.out.println(a);\n" + 
36490
			"		}\n" + 
36491
			"    }\n" + 
36492
			"\n" + 
36493
			"    public <U, V extends U> List<U> newList(V... values) {\n" + 
36494
			"        List<U> l = new ArrayList<U>();\n" + 
36495
			"        for (V v : values) {\n" + 
36496
			"            l.add(v);\n" + 
36497
			"        }\n" + 
36498
			"        return l;\n" + 
36499
			"    }\n" + 
36500
			"\n" + 
36501
			"}\n"
36502
		}, 
36503
		"SUCCESS");
36504
}
36505
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170318
36506
public void test1100() {
36507
	this.runNegativeTest(new String[] {
36508
			"X.java",
36509
			"class X<T> {\n" + 
36510
			"}\n" + 
36511
			"class Y<T> {\n" + 
36512
			"  public void foo(final X<?> x) {\n" + 
36513
			"  }\n" + 
36514
			"}\n" + 
36515
			"class Z extends Y {\n" + 
36516
			"  public void foo(final X<?> x) {\n" + 
36517
			"    super.foo(x);\n" + 
36518
			"  }\n" + 
36519
			"}"
36520
		}, 
36521
		"----------\n" + 
36522
		"1. WARNING in X.java (at line 7)\n" + 
36523
		"	class Z extends Y {\n" + 
36524
		"	                ^\n" + 
36525
		"Y is a raw type. References to generic type Y<T> should be parameterized\n" + 
36526
		"----------\n" + 
36527
		"2. ERROR in X.java (at line 8)\n" + 
36528
		"	public void foo(final X<?> x) {\n" + 
36529
		"	            ^^^^^^^^^^^^^^^^^\n" + 
36530
		"Name clash: The method foo(X<?>) of type Z has the same erasure as foo(X) of type Y but does not override it\n" + 
36531
		"----------\n" + 
36532
		"3. WARNING in X.java (at line 9)\n" + 
36533
		"	super.foo(x);\n" + 
36534
		"	^^^^^^^^^^^^\n" + 
36535
		"Type safety: The method foo(X) belongs to the raw type Y. References to generic type Y<T> should be parameterized\n" + 
36536
		"----------\n");
36537
}
36538
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=172189
36539
public void test1101() {
36540
	this.runNegativeTest(new String[] {
36541
			"X.java",
36542
			"import java.util.*;\n" + 
36543
			"\n" + 
36544
			"public final class X<A, B> {\n" + 
36545
			"    public A a;\n" + 
36546
			"    public B b;\n" + 
36547
			"    public X(A pa, B pb) {\n" + 
36548
			"        a = pa;\n" + 
36549
			"        b = pb;\n" + 
36550
			"    }\n" + 
36551
			"    public static <A, B> X<A, B> create(A pa, B pb) {\n" + 
36552
			"        return new X<A, B>(pa, pb);\n" + 
36553
			"    }\n" + 
36554
			"    public static void main(String[] args) {\n" + 
36555
			"        List<X<String, Object>> list = new ArrayList<X<String,Object>>();\n" + 
36556
			"        list.add(X.<?, Object>create(\"\", \"\"));\n" + 
36557
			"    }\n" + 
36558
			"}"
36559
		},
36560
		"----------\n" + 
36561
		"1. ERROR in X.java (at line 15)\n" + 
36562
		"	list.add(X.<?, Object>create(\"\", \"\"));\n" + 
36563
		"	            ^\n" + 
36564
		"Wildcard is not allowed at this location\n" + 
36565
		"----------\n");
36566
}
36567
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174434
36568
public void test1102() {
36569
	this.runNegativeTest(new String[] {
36570
			"X.java",
36571
			"public class X {\n" + 
36572
			"	<T> X(T t) {\n" + 
36573
			"	}\n" + 
36574
			"\n" + 
36575
			"	class A {\n" + 
36576
			"		<T> A(T t) {\n" + 
36577
			"		}\n" + 
36578
			"	}\n" + 
36579
			"\n" + 
36580
			"	public static void main(String[] args) {\n" + 
36581
			"		new<?> X(null);\n" + 
36582
			"	}\n" + 
36583
			"}"
36584
		},
36585
		"----------\n" + 
36586
		"1. ERROR in X.java (at line 11)\n" + 
36587
		"	new<?> X(null);\n" + 
36588
		"	    ^\n" + 
36589
		"Wildcard is not allowed at this location\n" + 
36590
		"----------\n");
36591
}
36592
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174434
36593
public void test1103() {
36594
	this.runNegativeTest(new String[] {
36595
			"X.java",
36596
			"public class X {\n" + 
36597
			"	<T> X(T t) {\n" + 
36598
			"	}\n" + 
36599
			"	X(int i) {\n" +
36600
			"		<?>this(null);\n" +
36601
			"	}\n" + 
36602
			"}"
36603
		},
36604
		"----------\n" + 
36605
		"1. ERROR in X.java (at line 5)\n" + 
36606
		"	<?>this(null);\n" + 
36607
		"	 ^\n" + 
36608
		"Wildcard is not allowed at this location\n" + 
36609
		"----------\n");
36610
}
36611
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174434
36612
public void test1104() {
36613
	this.runNegativeTest(new String[] {
36614
			"X.java",
36615
			"public class X {\n" + 
36616
			"	<T> X(T t) { }\n" + 
36617
			"	\n" + 
36618
			"	class A {\n" + 
36619
			"		<T> A(T t) { }\n" + 
36620
			"	}\n" + 
36621
			"\n" + 
36622
			"	public static void main(String[] args) {\n" + 
36623
			"		new X(null).new <?> A(null);\n" + 
36624
			"	}\n" + 
36625
			"}"
36626
		},
36627
		"----------\n" + 
36628
		"1. ERROR in X.java (at line 9)\n" + 
36629
		"	new X(null).new <?> A(null);\n" + 
36630
		"	                 ^\n" + 
36631
		"Wildcard is not allowed at this location\n" + 
36632
		"----------\n");
36633
}
36634
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=174724
36635
public void test1105() {
36636
	Map customOptions = this.getCompilerOptions();
36637
	customOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
36638
	this.runNegativeTest(new String[] {
36639
			"X.java",
36640
			"public class X {\n" + 
36641
			"	public static void main(String[] args) {\n" + 
36642
			"		Class foo = Class.<? extends Object>forName(Integer.class.getName());\n" + 
36643
			"	}\n" + 
36644
			"}"
36645
		},
36646
		"----------\n" + 
36647
		"1. ERROR in X.java (at line 3)\n" + 
36648
		"	Class foo = Class.<? extends Object>forName(Integer.class.getName());\n" + 
36649
		"	                   ^^^^^^^^^^^^^^^^\n" + 
36650
		"Wildcard is not allowed at this location\n" + 
36651
		"----------\n",
36652
		null,
36653
		true,
36654
		customOptions);
36655
}
36656
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=174766
36657
// **
36658
public void test1106() {
36659
	this.runNegativeTest(new String[] {
36660
			"X.java",
36661
			"public class X<T> {\n" + 
36662
			"	public class Y extends Exception {\n" +
36663
			"     private static final long serialVersionUID = 1L;\n" + 
36664
			"	}\n" + 
36665
			"}"
36666
		},
36667
		"----------\n" + 
36668
		"1. ERROR in X.java (at line 2)\n" + 
36669
		"	public class Y extends Exception {\n" + 
36670
		"	                       ^^^^^^^^^\n" + 
36671
		"The generic class X<T>.Y may not subclass java.lang.Throwable\n" + 
36672
		"----------\n");
36673
}
36674
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=172913
36675
public void test1107() {
36676
	this.runConformTest(
36677
		new String[] {
36678
			"X.java",
36679
			"import java.util.ArrayList;\n" + 
36680
			"import java.util.Collection;\n" + 
36681
			"import java.util.HashMap;\n" + 
36682
			"import java.util.Iterator;\n" + 
36683
			"import java.util.List;\n" + 
36684
			"\n" + 
36685
			"public class X {\n" + 
36686
			"  private void processLocks(HashMap locksMap, Object key) {\n" + 
36687
			"    for (Iterator iter = locksMap.keySet().iterator(); iter.hasNext();) {\n" + 
36688
			"      Object call = iter.next();\n" + 
36689
			"      List locks = externLocks((Collection) locksMap.get(call), call);\n" + 
36690
			"      // ...\n" + 
36691
			"    }\n" + 
36692
			"  }\n" + 
36693
			"  private List externLocks(Collection locks, Object call) {\n" + 
36694
			"    List result = new ArrayList();\n" + 
36695
			"    // ..\n" + 
36696
			"    return result;\n" + 
36697
			"  }\n" + 
36698
			"}\n",
36699
		},
36700
		"");		
36701
	// ensure only one instance of: checkcast java.util.Collection
36702
	String expectedOutput =
36703
		"  // Method descriptor #15 (Ljava/util/HashMap;Ljava/lang/Object;)V\n" + 
36704
		"  // Stack: 3, Locals: 6\n" + 
36705
		"  private void processLocks(java.util.HashMap locksMap, java.lang.Object key);\n" + 
36706
		"     0  aload_1 [locksMap]\n" + 
36707
		"     1  invokevirtual java.util.HashMap.keySet() : java.util.Set [16]\n" + 
36708
		"     4  invokeinterface java.util.Set.iterator() : java.util.Iterator [22] [nargs: 1]\n" + 
36709
		"     9  astore_3 [iter]\n" + 
36710
		"    10  goto 38\n" + 
36711
		"    13  aload_3 [iter]\n" + 
36712
		"    14  invokeinterface java.util.Iterator.next() : java.lang.Object [28] [nargs: 1]\n" + 
36713
		"    19  astore 4 [call]\n" + 
36714
		"    21  aload_0 [this]\n" + 
36715
		"    22  aload_1 [locksMap]\n" + 
36716
		"    23  aload 4 [call]\n" + 
36717
		"    25  invokevirtual java.util.HashMap.get(java.lang.Object) : java.lang.Object [34]\n" + 
36718
		"    28  checkcast java.util.Collection [38]\n" + 
36719
		"    31  aload 4 [call]\n" + 
36720
		"    33  invokespecial X.externLocks(java.util.Collection, java.lang.Object) : java.util.List [40]\n" + 
36721
		"    36  astore 5\n" + 
36722
		"    38  aload_3 [iter]\n" + 
36723
		"    39  invokeinterface java.util.Iterator.hasNext() : boolean [44] [nargs: 1]\n" + 
36724
		"    44  ifne 13\n" + 
36725
		"    47  return\n" + 
36726
		"      Line numbers:\n" + 
36727
		"        [pc: 0, line: 9]\n" + 
36728
		"        [pc: 13, line: 10]\n" + 
36729
		"        [pc: 21, line: 11]\n" + 
36730
		"        [pc: 38, line: 9]\n" + 
36731
		"        [pc: 47, line: 14]\n" + 
36732
		"      Local variable table:\n" + 
36733
		"        [pc: 0, pc: 48] local: this index: 0 type: X\n" + 
36734
		"        [pc: 0, pc: 48] local: locksMap index: 1 type: java.util.HashMap\n" + 
36735
		"        [pc: 0, pc: 48] local: key index: 2 type: java.lang.Object\n" + 
36736
		"        [pc: 10, pc: 47] local: iter index: 3 type: java.util.Iterator\n" + 
36737
		"        [pc: 21, pc: 38] local: call index: 4 type: java.lang.Object\n";
36738
	
36739
	try {
36740
		File f = new File(OUTPUT_DIR + File.separator + "X.class");
36741
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
36742
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
36743
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
36744
		int index = result.indexOf(expectedOutput);
36745
		if (index == -1 || expectedOutput.length() == 0) {
36746
			System.out.println(Util.displayString(result, 3));
36747
		}
36748
		if (index == -1) {
36749
			assertEquals("Wrong contents", expectedOutput, result);
36750
		}
36751
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
36752
		assertTrue(false);
36753
	} catch (IOException e) {
36754
		assertTrue(false);
36755
	}
36756
}
36757
public void test1108() {
36758
	this.runConformTest(
36759
		new String[] {
36760
			"X.java",
36761
			"interface UnaryFunction <A, R, X extends Throwable> {\n" + 
36762
			"    public R invoke(A o) throws X;\n" + 
36763
			"}\n" + 
36764
			" \n" + 
36765
			"public class X implements UnaryFunction<String,Void,RuntimeException> {\n" + 
36766
			"    public Void invoke(String o) throws RuntimeException {\n" + 
36767
			"        return null;\n" + 
36768
			"    }\n" + 
36769
			"}\n", // =================
36770
		},
36771
		"");		
36772
}
36773
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=176591
36774
//?: cuts assignment context
36775
public void test1109() {
36776
	this.runNegativeTest(
36777
		new String[] {
36778
			"X.java",
36779
			"class X {\n" + 
36780
			"  public Y<String> foo()\n" + 
36781
			"  {\n" + 
36782
			"    return true ? Z.bar() : null;\n" + 
36783
			"  }\n" + 
36784
			"}\n" + 
36785
			"class Y<T> {\n" + 
36786
			"}\n" + 
36787
			"class Z {\n" + 
36788
			"  static <U> Y<U> bar() {\n" + 
36789
			"    return null;\n" + 
36790
			"  }\n" + 
36791
			"}\n",
36792
		},
36793
		"----------\n" + 
36794
		"1. ERROR in X.java (at line 4)\n" + 
36795
		"	return true ? Z.bar() : null;\n" + 
36796
		"	       ^^^^^^^^^^^^^^^^^^^^^\n" + 
36797
		"Type mismatch: cannot convert from Y<Object> to Y<String>\n" + 
36798
		"----------\n");		
36799
}
36800
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=176591
36801
//variant
36802
public void test1110() {
36803
	this.runConformTest(
36804
		new String[] {
36805
			"X.java",
36806
			"class X {\n" + 
36807
			"  public Y<String> foo()\n" + 
36808
			"  {\n" + 
36809
			"    return true ? Z.<String>bar() : null;\n" + 
36810
			"  }\n" + 
36811
			"}\n" + 
36812
			"class Y<T> {\n" + 
36813
			"}\n" + 
36814
			"class Z {\n" + 
36815
			"  static <U> Y<U> bar() {\n" + 
36816
			"    return null;\n" + 
36817
			"  }\n" + 
36818
			"}\n",
36819
		},
36820
		"");		
36821
}
36822
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194
36823
public void test1111() {
36824
	Map settings = getCompilerOptions();
36825
	settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
36826
	this.runConformTest(
36827
		new String[] {
36828
			"X.java",
36829
			"class A<T> {\n" + 
36830
			"        public T foo(Object o) {\n" + 
36831
			"                return (T) o; // should get unchecked warning\n" + 
36832
			"        }\n" + 
36833
			"}\n" + 
36834
			"\n" + 
36835
			"public class X {\n" + 
36836
			"        public static void main(String[] args) {\n" + 
36837
			"                A<X> a = new A<X>();\n" + 
36838
			"                try {\n" + 
36839
			"	                X s = a.foo(new Object());\n" + 
36840
			"                } catch(ClassCastException e) {\n" + 
36841
			"                	System.out.println(\"SUCCESS\");\n" + 
36842
			"                	return;\n" + 
36843
			"                }\n" + 
36844
			"            	System.out.println(\"FAILED\");\n" + 
36845
			"        }\n" + 
36846
			"}\n", // =================
36847
		},
36848
		"SUCCESS",
36849
		null,
36850
		true,
36851
		null,
36852
		settings,
36853
		null);		
36854
}
36855
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation
36856
public void test1112() {
36857
	Map settings = getCompilerOptions();
36858
	settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
36859
	this.runConformTest(
36860
		new String[] {
36861
			"X.java",
36862
			"class A<T> {\n" + 
36863
			"        public T foo;\n" +
36864
			"}\n" + 
36865
			"\n" + 
36866
			"public class X {\n" + 
36867
			"        public static void main(String[] args) {\n" + 
36868
			"                A<X> a = new A<X>();\n" + 
36869
			"				 A ua = a;\n" +
36870
			"				 ua.foo = new Object();\n" +
36871
			"                try {\n" + 
36872
			"	                X s = a.foo;\n" + 
36873
			"                } catch(ClassCastException e) {\n" + 
36874
			"                	System.out.println(\"SUCCESS\");\n" + 
36875
			"                	return;\n" + 
36876
			"                }\n" + 
36877
			"            	System.out.println(\"FAILED\");\n" + 
36878
			"        }\n" + 
36879
			"}\n", // =================
36880
		},
36881
		"SUCCESS",
36882
		null,
36883
		true,
36884
		null,
36885
		settings,
36886
		null);		
36887
}
36888
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation
36889
public void test1113() {
36890
	Map settings = getCompilerOptions();
36891
	settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
36892
	this.runConformTest(
36893
		new String[] {
36894
			"X.java",
36895
			"class A<T> {\n" + 
36896
			"        public T foo;\n" +
36897
			"}\n" + 
36898
			"\n" + 
36899
			"public class X extends A<X>{\n" + 
36900
			"        public static void main(String[] args) {\n" + 
36901
			"			new X().foo();\n" +
36902
			"		 }\n" +
36903
			" 		 public void foo() {\n" +
36904
			"				 A ua = this;\n" +
36905
			"				 ua.foo = new Object();\n" +
36906
			"                try {\n" + 
36907
			"	                X s = foo;\n" + 
36908
			"                } catch(ClassCastException e) {\n" + 
36909
			"                	System.out.println(\"SUCCESS\");\n" + 
36910
			"                	return;\n" + 
36911
			"                }\n" + 
36912
			"            	System.out.println(\"FAILED\");\n" + 
36913
			"        }\n" + 
36914
			"}\n", // =================
36915
		},
36916
		"SUCCESS",
36917
		null,
36918
		true,
36919
		null,
36920
		settings,
36921
		null);		
36922
}
36923
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation
36924
public void test1114() {
36925
	Map settings = getCompilerOptions();
36926
	settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
36927
	this.runConformTest(
36928
		new String[] {
36929
			"X.java",
36930
			"class A<T> {\n" + 
36931
			"        public T foo;\n" +
36932
			"}\n" + 
36933
			"\n" + 
36934
			"public class X extends A<X>{\n" + 
36935
			"        public static void main(String[] args) {\n" + 
36936
			"			new X().foo();\n" +
36937
			"		 }\n" +
36938
			" 		 public void foo() {\n" +
36939
			"				 A ua = this;\n" +
36940
			"				 ua.foo = new Object();\n" +
36941
			"                try {\n" + 
36942
			"	                X s = this.foo;\n" + 
36943
			"                } catch(ClassCastException e) {\n" + 
36944
			"                	System.out.println(\"SUCCESS\");\n" + 
36945
			"                	return;\n" + 
36946
			"                }\n" + 
36947
			"            	System.out.println(\"FAILED\");\n" + 
36948
			"        }\n" + 
36949
			"}\n", // =================
36950
		},
36951
		"SUCCESS",
36952
		null,
36953
		true,
36954
		null,
36955
		settings,
36956
		null);		
36957
}
36958
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation
36959
public void test1115() {
36960
	Map settings = getCompilerOptions();
36961
	settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
36962
	this.runConformTest(
36963
		new String[] {
36964
			"X.java",
36965
			"class A<T> {\n" + 
36966
			"        public T foo;\n" +
36967
			"}\n" + 
36968
			"\n" + 
36969
			"public class X {\n" + 
36970
			"		 static X ROOT;\n" +
36971
			"        public static void main(String[] args) {\n" + 
36972
			"                A<X> a = new A<X>();\n" + 
36973
			"				 A ua = a;\n" +
36974
			"				 ua.foo = new Object();\n" +
36975
			"                try {\n" + 
36976
			"	                X s = a.foo.ROOT;\n" + 
36977
			"                } catch(ClassCastException e) {\n" + 
36978
			"                	System.out.println(\"SUCCESS\");\n" + 
36979
			"                	return;\n" + 
36980
			"                }\n" + 
36981
			"            	System.out.println(\"FAILED\");\n" + 
36982
			"        }\n" + 
36983
			"}\n", // =================
36984
		},
36985
		"SUCCESS",
36986
		null,
36987
		true,
36988
		null,
36989
		settings,
36990
		null);		
36991
}
36992
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation
36993
public void test1116() {
36994
	this.runConformTest(
36995
		new String[] {
36996
			"X.java",
36997
			"import java.io.Serializable;\n" + 
36998
			"\n" + 
36999
			"interface I {\n" + 
37000
			"    int CONST = 1;\n" + 
37001
			"}\n" + 
37002
			"\n" + 
37003
			"class Z<T extends Serializable&I> {\n" + 
37004
			"    T c;\n" + 
37005
			"    Z(T c) {\n" + 
37006
			"        this.c = c;\n" + 
37007
			"    }\n" + 
37008
			"    int foo() {\n" + 
37009
			"        return c.CONST;\n" + 
37010
			"    }\n" + 
37011
			"}\n" + 
37012
			"\n" + 
37013
			"public class X implements Serializable, I {\n" + 
37014
			"    public static void main(String argv[]) {\n" + 
37015
			"        Z<X> z = new Z<X>(new X());\n" + 
37016
			"        Z rawz = z;\n" + 
37017
			"        rawz.c = new Serializable(){};\n" + 
37018
			"        try {\n" + 
37019
			"	        z.foo();\n" + 
37020
			"        } catch(ClassCastException e) {\n" + 
37021
			"        	System.out.println(\"SUCCESS\");\n" + 
37022
			"        }\n" + 
37023
			"    }\n" + 
37024
			"}\n", // =================
37025
		},
37026
		"SUCCESS");		
37027
}
37028
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation
37029
public void test1117() {
37030
	Map options = getCompilerOptions();
37031
	options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
37032
	this.runConformTest(
37033
		new String[] {
37034
			"X.java",
37035
			"interface I<T> {\n" + 
37036
			"	Value<String> CONST = null;\n" + 
37037
			"}\n" + 
37038
			"class Value<V> {\n" + 
37039
			"	String NAME = \"VALUE\";\n" + 
37040
			"}\n" + 
37041
			"class B<V> implements I<V> {\n" + 
37042
			"	B(Value<String> param) {\n" + 
37043
			"		Value<String> v0 = CONST;\n" + 
37044
			"		Value<String> v1 = this.CONST;\n" + 
37045
			"		String s2 = CONST.NAME;\n" + 
37046
			"		Value<String> v3 = I.CONST;\n" + 
37047
			"		Value<String> v4 = B.CONST;\n" + 
37048
			"	}\n" + 
37049
			"}\n" + 
37050
			"public class X {\n" + 
37051
			"	public static void main(String[] args) {\n" + 
37052
			"		try {\n" + 
37053
			"			new B<String>(new Value<String>());\n" + 
37054
			"		} catch(NullPointerException e) {\n" + 
37055
			"			System.out.println(\"SUCCESS\");\n" + 
37056
			"		}\n" + 
37057
			"	}\n" + 
37058
			"}\n", // =================
37059
		}, 
37060
		"SUCCESS",
37061
		null,
37062
		false,
37063
		null,
37064
		options,
37065
		null);
37066
	// check the reference to I.CONST is generated as B.CONST, except for v3 still issuing I.CONST
37067
	String expectedOutput = 
37068
		"  // Method descriptor #8 (LValue;)V\n" + 
37069
		"  // Signature: (LValue<Ljava/lang/String;>;)V\n" + 
37070
		"  // Stack: 1, Locals: 2\n" + 
37071
		"  B(Value param);\n" + 
37072
		"     0  aload_0 [this]\n" + 
37073
		"     1  invokespecial java.lang.Object() [12]\n" + 
37074
		"     4  getstatic B.CONST : Value [15]\n" + 
37075
		"     7  pop\n" + 
37076
		"     8  getstatic B.CONST : Value [15]\n" + 
37077
		"    11  pop\n" + 
37078
		"    12  getstatic B.CONST : Value [15]\n" + 
37079
		"    15  getfield Value.NAME : java.lang.String [19]\n" + 
37080
		"    18  pop\n" + 
37081
		"    19  getstatic I.CONST : Value [25]\n" + 
37082
		"    22  pop\n" + 
37083
		"    23  getstatic B.CONST : Value [15]\n" + 
37084
		"    26  pop\n" + 
37085
		"    27  return\n" + 
37086
		"      Line numbers:\n" + 
37087
		"        [pc: 0, line: 8]\n" + 
37088
		"        [pc: 4, line: 9]\n" + 
37089
		"        [pc: 8, line: 10]\n" + 
37090
		"        [pc: 12, line: 11]\n" + 
37091
		"        [pc: 19, line: 12]\n" + 
37092
		"        [pc: 23, line: 13]\n" + 
37093
		"        [pc: 27, line: 14]\n" + 
37094
		"      Local variable table:\n" + 
37095
		"        [pc: 0, pc: 28] local: this index: 0 type: B\n" + 
37096
		"        [pc: 0, pc: 28] local: param index: 1 type: Value\n" + 
37097
		"      Local variable type table:\n" + 
37098
		"        [pc: 0, pc: 28] local: this index: 0 type: B<V>\n" + 
37099
		"        [pc: 0, pc: 28] local: param index: 1 type: Value<java.lang.String>\n";
37100
37101
	try {
37102
		File f = new File(OUTPUT_DIR + File.separator + "B.class");
37103
		byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
37104
		ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
37105
		String result = disassembler.disassemble(classFileBytes, "\n", ClassFileBytesDisassembler.DETAILED);
37106
		int index = result.indexOf(expectedOutput);
37107
		if (index == -1 || expectedOutput.length() == 0) {
37108
			System.out.println(Util.displayString(result, 3));
37109
		}
37110
		if (index == -1) {
37111
			assertEquals("Wrong contents", expectedOutput, result);
37112
		}
37113
	} catch (org.eclipse.jdt.core.util.ClassFormatException e) {
37114
		assertTrue(false);
37115
	} catch (IOException e) {
37116
		assertTrue(false);
37117
	}			
37118
}
37119
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177715
37120
public void test1118() {
37121
	this.runConformTest(
37122
		new String[] {
37123
			"X.java",
37124
			"import java.util.List;\n" + 
37125
			"\n" + 
37126
			"public class X {\n" + 
37127
			"	X() {\n" + 
37128
			"		Class<? extends List<?>> cls = null;\n" + 
37129
			"		foo(cls);\n" + 
37130
			"	}\n" + 
37131
			"\n" + 
37132
			"	<I, T extends List<I>> T foo(Class<T> pClass) {\n" + 
37133
			"		return null;\n" + 
37134
			"	}\n" + 
37135
			"}\n", // =================
37136
		},
37137
		"");		
37138
}
37139
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=169728
37140
public void test1119() {
37141
	this.runNegativeTest(
37142
		new String[] {
37143
			"X.java",
37144
			"public class X<T extends Comparable<T> & Runnable> {\n" + 
37145
			"	T get() {\n" + 
37146
			"		return null;\n" + 
37147
			"	}\n" + 
37148
			"	public static void main(String[] args) {\n" + 
37149
			"		\n" + 
37150
			"		X<OnlyRunnable> x1 = null; // error\n" + 
37151
			"		X<OnlyComparable> x2 = null; // error\n" + 
37152
			"		X<ComparableRunnable> x3 = null; // ok\n" + 
37153
			"		X<ComparableRunnableThrowable> x4 = null; // ok\n" + 
37154
			"		\n" + 
37155
			"		foo1(x1); // ok\n" + 
37156
			"		foo1(x2); // ok\n" + 
37157
			"		foo1(x3); // ok\n" + 
37158
			"		foo1(x4); // ok\n" + 
37159
			"\n" + 
37160
			"		foo2(x1); // error\n" + 
37161
			"		foo2(x2); // error\n" + 
37162
			"		foo2(x3); // error\n" + 
37163
			"		foo2(x4); // ok\n" + 
37164
			"	}\n" + 
37165
			"	\n" + 
37166
			"	static void foo1(X<?> x) {\n" + 
37167
			"		x.get().run(); // ok\n" + 
37168
			"		x.get().compareTo(null); // ok\n" + 
37169
			"		x.get().compareTo(x.get()); // error\n" + 
37170
			"	}\n" + 
37171
			"	static void foo2(X<? extends Throwable> x) {\n" + 
37172
			"		x.get().run(); // ok\n" + 
37173
			"		x.get().compareTo(null); // ok\n" + 
37174
			"		x.get().compareTo(x.get()); // error\n" + 
37175
			"	}	\n" + 
37176
			"}\n" + 
37177
			"\n" + 
37178
			"abstract class OnlyRunnable implements Runnable {}\n" + 
37179
			"abstract class OnlyComparable implements Comparable<OnlyComparable> {}\n" + 
37180
			"abstract class ComparableRunnable implements Comparable<ComparableRunnable>, Runnable {}\n" + 
37181
			"abstract class ComparableRunnableThrowable extends Throwable implements Comparable<ComparableRunnable>, Runnable {}", // =================		
37182
		},
37183
		"----------\n" + 
37184
		"1. ERROR in X.java (at line 7)\n" + 
37185
		"	X<OnlyRunnable> x1 = null; // error\n" + 
37186
		"	  ^^^^^^^^^^^^\n" + 
37187
		"Bound mismatch: The type OnlyRunnable is not a valid substitute for the bounded parameter <T extends Comparable<T> & Runnable> of the type X<T>\n" + 
37188
		"----------\n" + 
37189
		"2. ERROR in X.java (at line 8)\n" + 
37190
		"	X<OnlyComparable> x2 = null; // error\n" + 
37191
		"	  ^^^^^^^^^^^^^^\n" + 
37192
		"Bound mismatch: The type OnlyComparable is not a valid substitute for the bounded parameter <T extends Comparable<T> & Runnable> of the type X<T>\n" + 
37193
		"----------\n" + 
37194
		"3. ERROR in X.java (at line 10)\n" + 
37195
		"	X<ComparableRunnableThrowable> x4 = null; // ok\n" + 
37196
		"	  ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
37197
		"Bound mismatch: The type ComparableRunnableThrowable is not a valid substitute for the bounded parameter <T extends Comparable<T> & Runnable> of the type X<T>\n" + 
37198
		"----------\n" + 
37199
		"4. ERROR in X.java (at line 17)\n" + 
37200
		"	foo2(x1); // error\n" + 
37201
		"	^^^^\n" + 
37202
		"The method foo2(X<? extends Throwable>) in the type X<T> is not applicable for the arguments (X<OnlyRunnable>)\n" + 
37203
		"----------\n" + 
37204
		"5. ERROR in X.java (at line 18)\n" + 
37205
		"	foo2(x2); // error\n" + 
37206
		"	^^^^\n" + 
37207
		"The method foo2(X<? extends Throwable>) in the type X<T> is not applicable for the arguments (X<OnlyComparable>)\n" + 
37208
		"----------\n" + 
37209
		"6. ERROR in X.java (at line 19)\n" + 
37210
		"	foo2(x3); // error\n" + 
37211
		"	^^^^\n" + 
37212
		"The method foo2(X<? extends Throwable>) in the type X<T> is not applicable for the arguments (X<ComparableRunnable>)\n" + 
37213
		"----------\n" + 
37214
		"7. ERROR in X.java (at line 26)\n" + 
37215
		"	x.get().compareTo(x.get()); // error\n" + 
37216
		"	        ^^^^^^^^^\n" + 
37217
		"The method compareTo(capture#3-of ?) in the type Comparable<capture#3-of ?> is not applicable for the arguments (capture#4-of ?)\n" + 
37218
		"----------\n" + 
37219
		"8. ERROR in X.java (at line 31)\n" + 
37220
		"	x.get().compareTo(x.get()); // error\n" + 
37221
		"	        ^^^^^^^^^\n" + 
37222
		"The method compareTo(capture#7-of ? extends Throwable) in the type Comparable<capture#7-of ? extends Throwable> is not applicable for the arguments (capture#8-of ? extends Throwable)\n" + 
37223
		"----------\n");		
37224
}
37225
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=166963
37226
public void test1120() {
37227
	this.runNegativeTest(
37228
		new String[] {
37229
			"X.java",
37230
			"public class X {\n" + 
37231
			"	public X() {\n" + 
37232
			"		System.out.println();\n" + 
37233
			"		this(zork);\n" + 
37234
			"		Zork.this.this();\n" + 
37235
			"		<Zork>this();\n" + 
37236
			"	}\n" + 
37237
			"}", // =================
37238
		},
37239
		"----------\n" + 
37240
		"1. ERROR in X.java (at line 4)\n" + 
37241
		"	this(zork);\n" + 
37242
		"	^^^^^^^^^^^\n" + 
37243
		"Constructor call must be the first statement in a constructor\n" + 
37244
		"----------\n" + 
37245
		"2. ERROR in X.java (at line 4)\n" + 
37246
		"	this(zork);\n" + 
37247
		"	     ^^^^\n" + 
37248
		"zork cannot be resolved\n" + 
37249
		"----------\n" + 
37250
		"3. ERROR in X.java (at line 5)\n" + 
37251
		"	Zork.this.this();\n" + 
37252
		"	^^^^^^^^^^^^^^^^^\n" + 
37253
		"Constructor call must be the first statement in a constructor\n" + 
37254
		"----------\n" + 
37255
		"4. ERROR in X.java (at line 5)\n" + 
37256
		"	Zork.this.this();\n" + 
37257
		"	^^^^\n" + 
37258
		"Zork cannot be resolved to a type\n" + 
37259
		"----------\n" + 
37260
		"5. ERROR in X.java (at line 6)\n" + 
37261
		"	<Zork>this();\n" + 
37262
		"	 ^^^^\n" + 
37263
		"Zork cannot be resolved to a type\n" + 
37264
		"----------\n" + 
37265
		"6. ERROR in X.java (at line 6)\n" + 
37266
		"	<Zork>this();\n" + 
37267
		"	      ^^^^^^^\n" + 
37268
		"Constructor call must be the first statement in a constructor\n" + 
37269
		"----------\n");
37270
}
37271
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=181270
37272
public void test1121() {
37273
	this.runNegativeTest(
37274
		new String[] {
37275
			"X.java",
37276
			"public class X<T> {\n" + 
37277
			"	void foo() {\r\n" + 
37278
			"		System.out.println(T[].class);\n" + 
37279
			"	}\n" + 
37280
			"}", // =================
37281
		},
37282
		"----------\n" + 
37283
		"1. ERROR in X.java (at line 3)\n" + 
37284
		"	System.out.println(T[].class);\n" + 
37285
		"	                   ^^^^^^^^^\n" + 
37286
		"Illegal class literal for the type parameter T\n" + 
37287
		"----------\n");
37288
}
37289
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=181270
37290
public void test1122() {
37291
	this.runNegativeTest(
37292
		new String[] {
37293
			"X.java",
37294
			"public class X {\n" + 
37295
			"	<T> void foo() {\r\n" + 
37296
			"		System.out.println(T[].class);\n" + 
37297
			"	}\n" + 
37298
			"}", // =================
37299
		},
37300
		"----------\n" + 
37301
		"1. ERROR in X.java (at line 3)\n" + 
37302
		"	System.out.println(T[].class);\n" + 
37303
		"	                   ^^^^^^^^^\n" + 
37304
		"Illegal class literal for the type parameter T\n" + 
37305
		"----------\n");
37306
}
37307
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=181270 - variation
37308
public void test1123() {
37309
	this.runNegativeTest(
37310
		new String[] {
37311
			"X.java",
37312
			"public class X {\n" + 
37313
			"	void foo() {\n" + 
37314
			"		Class<Integer> c1 = int.class;\n" + 
37315
			"		Class<Integer> c2 = Integer.class;\n" + 
37316
			"		Class<Integer[]> c3 = int[].class;\n" + 
37317
			"		Class<int[]> c4 = int[].class;\n" + 
37318
			"		Class<Void> c5 = void.class;\n" + 
37319
			"		Class<void[]> c6 = void[].class;\n" + 
37320
			"	}\n" + 
37321
			"}", // =================
37322
		},
37323
		"----------\n" + 
37324
		"1. ERROR in X.java (at line 5)\n" + 
37325
		"	Class<Integer[]> c3 = int[].class;\n" + 
37326
		"	                      ^^^^^^^^^^^\n" + 
37327
		"Type mismatch: cannot convert from Class<int[]> to Class<Integer[]>\n" + 
37328
		"----------\n" + 
37329
		"2. ERROR in X.java (at line 8)\n" + 
37330
		"	Class<void[]> c6 = void[].class;\n" + 
37331
		"	      ^^^^^^\n" + 
37332
		"void[] is an invalid type\n" + 
37333
		"----------\n" + 
37334
		"3. ERROR in X.java (at line 8)\n" + 
37335
		"	Class<void[]> c6 = void[].class;\n" + 
37336
		"	                   ^^^^^^\n" + 
37337
		"void[] is an invalid type\n" + 
37338
		"----------\n");
37339
}
37340
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=182192
37341
public void test1124() {
37342
	this.runNegativeTest(
37343
		new String[] {
37344
			"X.java",
37345
			"import java.util.HashMap;\n" + 
37346
			"import java.util.Map;\n" + 
37347
			"\n" + 
37348
			"public class X<T> {\n" + 
37349
			"\n" + 
37350
			"	static protected final Map<String, String> myMap = new HashMap<String, String>();\n" + 
37351
			"	private final T theGenericThing;\n" + 
37352
			"\n" + 
37353
			"	private X(T something) {\n" + 
37354
			"		this.theGenericThing = something;\n" + 
37355
			"	}\n" + 
37356
			"\n" + 
37357
			"	public static class InnerClassThatShowsBug extends X {\n" + 
37358
			"		public InnerClassThatShowsBug() {\n" + 
37359
			"			super(null);\n" + 
37360
			"		}\n" + 
37361
			"\n" + 
37362
			"		public void printMap() {\n" + 
37363
			"			for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" + 
37364
			"				System.out.println(entry.getKey() + \" => \" + entry.getValue());\n" + 
37365
			"			}\n" + 
37366
			"		}\n" + 
37367
			"		protected Map<String, String> myMap2() {\n" + 
37368
			"			return myMap;\n" + 
37369
			"		}\n" + 
37370
			"		public void printMap2() {\n" + 
37371
			"			for (Map.Entry<String, String> entry : myMap2().entrySet()) {\n" + 
37372
			"				System.out.println(entry.getKey() + \" => \" + entry.getValue());\n" + 
37373
			"			}\n" + 
37374
			"		}\n" + 
37375
			"	}\n" + 
37376
			"\n" + 
37377
			"	protected Map<String, String> myMap() {\n" + 
37378
			"		return myMap;\n" + 
37379
			"	}\n" + 
37380
			"}", // =================
37381
		},
37382
		"----------\n" + 
37383
		"1. WARNING in X.java (at line 7)\n" + 
37384
		"	private final T theGenericThing;\n" + 
37385
		"	                ^^^^^^^^^^^^^^^\n" + 
37386
		"The field X<T>.theGenericThing is never read locally\n" + 
37387
		"----------\n" + 
37388
		"2. WARNING in X.java (at line 13)\n" + 
37389
		"	public static class InnerClassThatShowsBug extends X {\n" + 
37390
		"	                                                   ^\n" + 
37391
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
37392
		"----------\n" + 
37393
		"3. WARNING in X.java (at line 15)\n" + 
37394
		"	super(null);\n" + 
37395
		"	^^^^^^^^^^^^\n" + 
37396
		"Type safety: The constructor X(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" + 
37397
		"----------\n" + 
37398
		"4. WARNING in X.java (at line 15)\n" + 
37399
		"	super(null);\n" + 
37400
		"	^^^^^^^^^^^^\n" + 
37401
		"Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + 
37402
		"----------\n" + 
37403
		"5. ERROR in X.java (at line 19)\n" + 
37404
		"	for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" + 
37405
		"	                                       ^^^^^^^^^^^^^^^^^^\n" + 
37406
		"Type mismatch: cannot convert from element type Object to Map.Entry<String,String>\n" + 
37407
		"----------\n");
37408
}
37409
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216
37410
public void test1125() {
37411
	this.runNegativeTest(
37412
		new String[] {
37413
			"X.java",
37414
			"class A {\n" + 
37415
			"    class B<T> {\n" + 
37416
			"        T t;\n" + 
37417
			"        T getValue() {\n" + 
37418
			"            return t;\n" + 
37419
			"        }\n" + 
37420
			"    }\n" + 
37421
			"}\n" + 
37422
			"\n" + 
37423
			"class C<T> extends A {\n" + 
37424
			"	Zork z;\n" +
37425
			"}\n" + 
37426
			"\n" + 
37427
			"public class X {\n" + 
37428
			"    static C.B<Double> c = new C().new B<Double>();\n" + 
37429
			"\n" + 
37430
			"    public static void main(String[] args) {\n" + 
37431
			"        C.B<String> temp = new C().new B<String>();\n" + 
37432
			"        String s = temp.getValue();\n" + 
37433
			"        System.out.println(s);\n" + 
37434
			"        foo(bar());\n" + 
37435
			"    }\n" + 
37436
			"\n" + 
37437
			"    static C.B<? extends Number> bar() {\n" + 
37438
			"        return new C().new B<Integer>();\n" + 
37439
			"    }\n" + 
37440
			"\n" + 
37441
			"    static void foo(C.B<?> arg) {\n" + 
37442
			"        Object o = arg.getValue();\n" + 
37443
			"        Double d = c.getValue();\n" + 
37444
			"        System.out.println(o);\n" + 
37445
			"        System.out.println(d);\n" + 
37446
			"    }\n" + 
37447
			"}\n", // =================
37448
		},
37449
		"----------\n" + 
37450
		"1. ERROR in X.java (at line 11)\n" + 
37451
		"	Zork z;\n" + 
37452
		"	^^^^\n" + 
37453
		"Zork cannot be resolved to a type\n" + 
37454
		"----------\n" + 
37455
		"2. WARNING in X.java (at line 15)\n" + 
37456
		"	static C.B<Double> c = new C().new B<Double>();\n" + 
37457
		"	                           ^\n" + 
37458
		"C is a raw type. References to generic type C<T> should be parameterized\n" + 
37459
		"----------\n" + 
37460
		"3. WARNING in X.java (at line 18)\n" + 
37461
		"	C.B<String> temp = new C().new B<String>();\n" + 
37462
		"	                       ^\n" + 
37463
		"C is a raw type. References to generic type C<T> should be parameterized\n" + 
37464
		"----------\n" + 
37465
		"4. WARNING in X.java (at line 25)\n" + 
37466
		"	return new C().new B<Integer>();\n" + 
37467
		"	           ^\n" + 
37468
		"C is a raw type. References to generic type C<T> should be parameterized\n" + 
37469
		"----------\n");
37470
}
37471
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 - variation
37472
public void test1126() {
37473
	this.runConformTest(
37474
		new String[] {
37475
			"X.java",
37476
			"class A {\n" + 
37477
			"    class B<T> {\n" + 
37478
			"        T t;\n" + 
37479
			"        T getValue() {\n" + 
37480
			"            return t;\n" + 
37481
			"        }\n" + 
37482
			"    }\n" + 
37483
			"}\n" + 
37484
			"\n" + 
37485
			"public class X {\n" + 
37486
			"    static A.B<Double> c = new A().new B<Double>();\n" + 
37487
			"\n" + 
37488
			"    public static void main(String[] args) {\n" + 
37489
			"        A.B<String> temp = new A().new B<String>();\n" + 
37490
			"        String s = temp.getValue();\n" + 
37491
			"        System.out.print(s);\n" + 
37492
			"        foo(bar());\n" + 
37493
			"    }\n" + 
37494
			"\n" + 
37495
			"    static A.B<? extends Number> bar() {\n" + 
37496
			"        return new A().new B<Integer>();\n" + 
37497
			"    }\n" + 
37498
			"\n" + 
37499
			"    static void foo(A.B<?> arg) {\n" + 
37500
			"        Object o = arg.getValue();\n" + 
37501
			"        Double d = c.getValue();\n" + 
37502
			"        System.out.print(o);\n" + 
37503
			"        System.out.print(d);\n" + 
37504
			"    }\n" + 
37505
			"}\n", // =================
37506
		},
37507
		"nullnullnull");
37508
}
37509
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 - variation
37510
public void test1127() {
37511
	this.runNegativeTest(
37512
		new String[] {
37513
			"X.java",
37514
			"class A<E> {\n" + 
37515
			"    class B<T> {\n" + 
37516
			"        T t;\n" + 
37517
			"        T getValue() {\n" + 
37518
			"            return t;\n" + 
37519
			"        }\n" + 
37520
			"    }\n" + 
37521
			"}\n" + 
37522
			"\n" + 
37523
			"class C<T> extends A<T> {\n" + 
37524
			"}\n" + 
37525
			"\n" + 
37526
			"public class X {\n" + 
37527
			"    static C.B<Double> c = new C().new B<Double>();\n" + 
37528
			"\n" + 
37529
			"    public static void main(String[] args) {\n" + 
37530
			"        C.B<String> temp = new C().new B<String>();\n" + 
37531
			"        String s = temp.getValue();\n" + 
37532
			"        System.out.println(s);\n" + 
37533
			"        foo(bar());\n" + 
37534
			"    }\n" + 
37535
			"\n" + 
37536
			"    static C.B<? extends Number> bar() {\n" + 
37537
			"        return new C().new B<Integer>();\n" + 
37538
			"    }\n" + 
37539
			"\n" + 
37540
			"    static void foo(C.B<?> arg) {\n" + 
37541
			"        Object o = arg.getValue();\n" + 
37542
			"        Double d = c.getValue();\n" + 
37543
			"        System.out.println(o);\n" + 
37544
			"        System.out.println(d);\n" + 
37545
			"    }\n" + 
37546
			"}\n", // =================
37547
		},
37548
		"----------\n" + 
37549
		"1. ERROR in X.java (at line 14)\n" + 
37550
		"	static C.B<Double> c = new C().new B<Double>();\n" + 
37551
		"	       ^^^\n" + 
37552
		"The member type A.B<Double> must be qualified with a parameterized type, since it is not static\n" + 
37553
		"----------\n" + 
37554
		"2. WARNING in X.java (at line 14)\n" + 
37555
		"	static C.B<Double> c = new C().new B<Double>();\n" + 
37556
		"	                           ^\n" + 
37557
		"C is a raw type. References to generic type C<T> should be parameterized\n" + 
37558
		"----------\n" + 
37559
		"3. ERROR in X.java (at line 14)\n" + 
37560
		"	static C.B<Double> c = new C().new B<Double>();\n" + 
37561
		"	                                   ^\n" + 
37562
		"The member type A.B<Double> must be qualified with a parameterized type, since it is not static\n" + 
37563
		"----------\n" + 
37564
		"4. ERROR in X.java (at line 17)\n" + 
37565
		"	C.B<String> temp = new C().new B<String>();\n" + 
37566
		"	^^^\n" + 
37567
		"The member type A.B<String> must be qualified with a parameterized type, since it is not static\n" + 
37568
		"----------\n" + 
37569
		"5. WARNING in X.java (at line 17)\n" + 
37570
		"	C.B<String> temp = new C().new B<String>();\n" + 
37571
		"	                       ^\n" + 
37572
		"C is a raw type. References to generic type C<T> should be parameterized\n" + 
37573
		"----------\n" + 
37574
		"6. ERROR in X.java (at line 17)\n" + 
37575
		"	C.B<String> temp = new C().new B<String>();\n" + 
37576
		"	                               ^\n" + 
37577
		"The member type A.B<String> must be qualified with a parameterized type, since it is not static\n" + 
37578
		"----------\n" + 
37579
		"7. ERROR in X.java (at line 23)\n" + 
37580
		"	static C.B<? extends Number> bar() {\n" + 
37581
		"	       ^^^\n" + 
37582
		"The member type A.B<? extends Number> must be qualified with a parameterized type, since it is not static\n" + 
37583
		"----------\n" + 
37584
		"8. WARNING in X.java (at line 24)\n" + 
37585
		"	return new C().new B<Integer>();\n" + 
37586
		"	           ^\n" + 
37587
		"C is a raw type. References to generic type C<T> should be parameterized\n" + 
37588
		"----------\n" + 
37589
		"9. ERROR in X.java (at line 24)\n" + 
37590
		"	return new C().new B<Integer>();\n" + 
37591
		"	                   ^\n" + 
37592
		"The member type A.B<Integer> must be qualified with a parameterized type, since it is not static\n" + 
37593
		"----------\n" + 
37594
		"10. ERROR in X.java (at line 27)\n" + 
37595
		"	static void foo(C.B<?> arg) {\n" + 
37596
		"	                ^^^\n" + 
37597
		"The member type A.B<?> must be qualified with a parameterized type, since it is not static\n" + 
37598
		"----------\n");
37599
}
37600
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=183216 - variation
37601
public void test1128() {
37602
	this.runNegativeTest(
37603
		new String[] {
37604
			"X.java",
37605
			"class A<T> {\n" + 
37606
			"	class Member<U> {}\n" + 
37607
			"}\n" + 
37608
			"\n" + 
37609
			"public class X extends A {\n" + 
37610
			"	void foo() {\n" + 
37611
			"		new Member<String>();\n" + 
37612
			"		new X().new Member<String>();\n" + 
37613
			"	}\n" + 
37614
			"}\n", // =================
37615
		},
37616
		"----------\n" + 
37617
		"1. WARNING in X.java (at line 5)\n" + 
37618
		"	public class X extends A {\n" + 
37619
		"	                       ^\n" + 
37620
		"A is a raw type. References to generic type A<T> should be parameterized\n" + 
37621
		"----------\n" + 
37622
		"2. ERROR in X.java (at line 7)\n" + 
37623
		"	new Member<String>();\n" + 
37624
		"	    ^^^^^^\n" + 
37625
		"The member type A.Member<String> must be qualified with a parameterized type, since it is not static\n" + 
37626
		"----------\n" + 
37627
		"3. ERROR in X.java (at line 8)\n" + 
37628
		"	new X().new Member<String>();\n" + 
37629
		"	            ^^^^^^\n" + 
37630
		"The member type A.Member<String> must be qualified with a parameterized type, since it is not static\n" + 
37631
		"----------\n");
37632
}
37633
public void test1129() {
37634
	this.runNegativeTest(
37635
		new String[] {
37636
			"X.java",
37637
			"import java.io.Serializable;\n" + 
37638
			"\n" + 
37639
			"abstract class Arg1 implements Comparable<Arg1>, Serializable {}\n" + 
37640
			"abstract class Arg2 implements Serializable, Comparable<Arg2>  {}\n" + 
37641
			"\n" + 
37642
			"interface IX<T> {}\n" + 
37643
			"\n" + 
37644
			"public class X {\n" + 
37645
			"	void foo1(boolean b, IX<String> arg2) {\n" + 
37646
			"		IX<String> o = b ? null : arg2;\n" + 
37647
			"		IX<String> o2 = b ? arg2 : null;\n" + 
37648
			"	}\n" + 
37649
			"	void foo2(boolean b, IX<String> arg1, IX<? extends Object> arg2) {\n" + 
37650
			"		String s = b ? arg1 : arg2;\n" + 
37651
			"	}\n" + 
37652
			"	void foo3(boolean b, Arg1 arg1, Arg2 arg2) {\n" + 
37653
			"		String s = b ? arg1 : arg2;\n" + 
37654
			"	}\n" + 
37655
			"}  ", // =================
37656
		},
37657
		"----------\n" + 
37658
		"1. ERROR in X.java (at line 14)\n" + 
37659
		"	String s = b ? arg1 : arg2;\n" + 
37660
		"	           ^^^^^^^^^^^^^^^\n" + 
37661
		"Type mismatch: cannot convert from IX<capture#2-of ? extends Object> to String\n" + 
37662
		"----------\n" + 
37663
		"2. ERROR in X.java (at line 17)\n" + 
37664
		"	String s = b ? arg1 : arg2;\n" + 
37665
		"	           ^^^^^^^^^^^^^^^\n" + 
37666
		"Type mismatch: cannot convert from Object&Comparable<?>&Serializable to String\n" + 
37667
		"----------\n");
37668
}
37669
public void test1130() {
37670
	this.runNegativeTest(
37671
		new String[] {
37672
			"X.java",
37673
			"import java.io.Serializable;\n" + 
37674
			"import java.util.List;\n" + 
37675
			"\n" + 
37676
			"interface IX<T extends Comparable<T>&Serializable> {}\n" + 
37677
			"\n" + 
37678
			"public class X<T extends Comparable<T>&Serializable> {\n" + 
37679
			"	void foo4(boolean b, List<? extends T> l1, List<? extends Comparable<T>> l2) {\n" + 
37680
			"		String s = b ? l1.get(0) : l2.get(0);\n" + 
37681
			"	}\n" +
37682
			"}\n", // =================
37683
		},
37684
		"----------\n" + 
37685
		"1. ERROR in X.java (at line 8)\n" + 
37686
		"	String s = b ? l1.get(0) : l2.get(0);\n" + 
37687
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
37688
		"Type mismatch: cannot convert from Comparable<T> to String\n" + 
37689
		"----------\n");
37690
}
37691
public void test1131() {
37692
	this.runNegativeTest(
37693
		new String[] {
37694
			"X.java",
37695
			"import java.io.Serializable;\n" + 
37696
			"import java.util.List;\n" + 
37697
			"\n" + 
37698
			"public class X<T extends Comparable<T>&Serializable> {\n" + 
37699
			"	<V extends T> void foo4(boolean b, List<? extends V> l1, List<? extends Comparable<V>> l2) {\n" + 
37700
			"		String s = b ? l1.get(0) : l2.get(0);\n" + 
37701
			"	}\n" + 
37702
			"} \n", // =================
37703
		},
37704
		"----------\n" + 
37705
		"1. ERROR in X.java (at line 6)\n" + 
37706
		"	String s = b ? l1.get(0) : l2.get(0);\n" + 
37707
		"	           ^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
37708
		"Type mismatch: cannot convert from Comparable<capture#3-of ? extends T> to String\n" + 
37709
		"----------\n");
37710
}
37711
public void test1132() {
37712
	this.runNegativeTest(
37713
		new String[] {
37714
			"X.java",
37715
			"import java.util.*;\n" + 
37716
			"\n" + 
37717
			"public class X<T> {\n" + 
37718
			"\n" + 
37719
			"	public void thisDoesntCompile() {\n" + 
37720
			"		X myThing = new X<Object>();\n" + 
37721
			"		Integer i = myThing.getList().get(0); // Type Mismatch error - Since\n" + 
37722
			"												// myThing is unbounded, return\n" + 
37723
			"												// type List<Integer>\n" + 
37724
			"												// incorrectly becomes unbounded\n" + 
37725
			"	}\n" + 
37726
			"\n" + 
37727
			"	public List<Integer> getList() {\n" + 
37728
			"		ArrayList<Integer> l = new ArrayList<Integer>();\n" + 
37729
			"		l.add(new Integer(0));\n" + 
37730
			"		return l;\n" + 
37731
			"	}\n" + 
37732
			"\n" + 
37733
			"	public void thisMethodCompilesOk() {\n" + 
37734
			"		X<Object> myThing = new X<Object>();\n" + 
37735
			"		Integer i = myThing.getList().get(0);\n" + 
37736
			"	}\n" + 
37737
			"\n" + 
37738
			"	public void thisMethodAlsoCompilesOk() {\n" + 
37739
			"		X myThing = new X<Object>();\n" + 
37740
			"		List<Integer> l = myThing.getList();\n" + 
37741
			"		Integer i = l.get(0);\n" + 
37742
			"	}\n" + 
37743
			"}\n", // =================
37744
		},
37745
		"----------\n" + 
37746
		"1. WARNING in X.java (at line 6)\n" + 
37747
		"	X myThing = new X<Object>();\n" + 
37748
		"	^\n" + 
37749
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
37750
		"----------\n" + 
37751
		"2. ERROR in X.java (at line 7)\n" + 
37752
		"	Integer i = myThing.getList().get(0); // Type Mismatch error - Since\n" + 
37753
		"	            ^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
37754
		"Type mismatch: cannot convert from Object to Integer\n" + 
37755
		"----------\n" + 
37756
		"3. WARNING in X.java (at line 25)\n" + 
37757
		"	X myThing = new X<Object>();\n" + 
37758
		"	^\n" + 
37759
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
37760
		"----------\n" + 
37761
		"4. WARNING in X.java (at line 26)\n" + 
37762
		"	List<Integer> l = myThing.getList();\n" + 
37763
		"	                  ^^^^^^^^^^^^^^^^^\n" + 
37764
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Integer>\n" + 
37765
		"----------\n");
37766
}
37767
public void test1133() {
37768
	this.runNegativeTest(
37769
		new String[] {
37770
			"X.java",
37771
			"import java.util.*;\n" + 
37772
			"\n" + 
37773
			"class Y {\n" + 
37774
			"	List<String> foo() { return null; }\n" + 
37775
			"}\n" + 
37776
			"\n" + 
37777
			"public class X<T> extends Y {\n" + 
37778
			"	List<String> bar() { return null; }\n" + 
37779
			"	\n" + 
37780
			"	void m(X x) {\n" + 
37781
			"		List<Object> l1 = x.foo();\n" + 
37782
			"		List<Object> l2 = x.bar();\n" + 
37783
			"	}\n" + 
37784
			"}\n", // =================
37785
		},
37786
		"----------\n" + 
37787
		"1. WARNING in X.java (at line 10)\n" + 
37788
		"	void m(X x) {\n" + 
37789
		"	       ^\n" + 
37790
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
37791
		"----------\n" + 
37792
		"2. ERROR in X.java (at line 11)\n" + 
37793
		"	List<Object> l1 = x.foo();\n" + 
37794
		"	                  ^^^^^^^\n" + 
37795
		"Type mismatch: cannot convert from List<String> to List<Object>\n" + 
37796
		"----------\n" + 
37797
		"3. WARNING in X.java (at line 12)\n" + 
37798
		"	List<Object> l2 = x.bar();\n" + 
37799
		"	                  ^^^^^^^\n" + 
37800
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
37801
		"----------\n");
37802
}
37803
public void test1134() {
37804
	this.runNegativeTest(
37805
		new String[] {
37806
			"X.java",
37807
			"import java.util.*;\n" + 
37808
			"\n" + 
37809
			"class Y<U> {\n" + 
37810
			"	List<String> foo() { return null; }\n" + 
37811
			"}\n" + 
37812
			"\n" + 
37813
			"public class X<T> extends Y<T> {\n" + 
37814
			"	List<String> bar() { return null; }\n" + 
37815
			"	\n" + 
37816
			"	void m(X x) {\n" + 
37817
			"		List<Object> l1 = x.foo();\n" + 
37818
			"		List<Object> l2 = x.bar();\n" + 
37819
			"		Zork z;\n" + 
37820
			"	}\n" + 
37821
			"}\n", // =================
37822
		},
37823
		"----------\n" + 
37824
		"1. WARNING in X.java (at line 10)\n" + 
37825
		"	void m(X x) {\n" + 
37826
		"	       ^\n" + 
37827
		"X is a raw type. References to generic type X<T> should be parameterized\n" + 
37828
		"----------\n" + 
37829
		"2. WARNING in X.java (at line 11)\n" + 
37830
		"	List<Object> l1 = x.foo();\n" + 
37831
		"	                  ^^^^^^^\n" + 
37832
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
37833
		"----------\n" + 
37834
		"3. WARNING in X.java (at line 12)\n" + 
37835
		"	List<Object> l2 = x.bar();\n" + 
37836
		"	                  ^^^^^^^\n" + 
37837
		"Type safety: The expression of type List needs unchecked conversion to conform to List<Object>\n" + 
37838
		"----------\n" + 
37839
		"4. ERROR in X.java (at line 13)\n" + 
37840
		"	Zork z;\n" + 
37841
		"	^^^^\n" + 
37842
		"Zork cannot be resolved to a type\n" + 
37843
		"----------\n");
37844
}
37845
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422
37846
public void test1135() {
37847
	this.runConformTest(
37848
		new String[] {
37849
			"X.java",
37850
			"class Foo <T>{\n" + 
37851
			"    private T myT;\n" + 
37852
			"\n" + 
37853
			"    public T getT() {\n" + 
37854
			"        return myT;\n" + 
37855
			"    }\n" + 
37856
			"\n" + 
37857
			"    public void setT(T aT) {\n" + 
37858
			"        myT = aT;\n" + 
37859
			"    }\n" + 
37860
			"}\n" + 
37861
			"\n" + 
37862
			"public class X extends Foo<X.Baz> {\n" + 
37863
			"	X.Baz baz;\n" + 
37864
			"    public static void main(String[] args) {\n" + 
37865
			"        X myBar = new X();\n" + 
37866
			"        myBar.setT(new Baz());\n" + 
37867
			"        System.out.println(myBar.getT().toString());\n" + 
37868
			"    }\n" + 
37869
			"\n" + 
37870
			"    private static class Baz {\n" + 
37871
			"        @Override\n" + 
37872
			"        public String toString() {\n" + 
37873
			"            return \"Baz\";\n" + 
37874
			"        }\n" + 
37875
			"    }    \n" + 
37876
			"}\n", // =================
37877
		},
37878
		"Baz");
37879
}
37880
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154029
37881
public void test1136() {
37882
	this.runNegativeTest(
37883
		new String[] {
37884
			"X.java",
37885
			"import java.util.*;\n" + 
37886
			"public class X {\n" + 
37887
			"	public static void main(String[] args) {\n" + 
37888
			"		List<Object>  l1 = Arrays.asList(1, \"X\");\n" + 
37889
			"		\n" + 
37890
			"		B<String> b = null;\n" + 
37891
			"		C<String>c = null;\n" + 
37892
			"		List<Object>  l2 = Arrays.asList(b, c);\n" + 
37893
			"	}\n" + 
37894
			"}\n" + 
37895
			"class A<T> {}\n" + 
37896
			"interface I {}\n" + 
37897
			"class B<T> extends A<T> implements I {}\n" + 
37898
			"class C<T> extends A<T> implements I {}\n", // =================
37899
		},
37900
		"----------\n" + 
37901
		"1. WARNING in X.java (at line 4)\n" + 
37902
		"	List<Object>  l1 = Arrays.asList(1, \"X\");\n" + 
37903
		"	                   ^^^^^^^^^^^^^^^^^^^^^\n" + 
37904
		"Type safety : A generic array of Object&Comparable<?>&Serializable is created for a varargs parameter\n" + 
37905
		"----------\n" + 
37906
		"2. ERROR in X.java (at line 4)\n" + 
37907
		"	List<Object>  l1 = Arrays.asList(1, \"X\");\n" + 
37908
		"	                   ^^^^^^^^^^^^^^^^^^^^^\n" + 
37909
		"Type mismatch: cannot convert from List<Object&Comparable<?>&Serializable> to List<Object>\n" + 
37910
		"----------\n" + 
37911
		"3. WARNING in X.java (at line 8)\n" + 
37912
		"	List<Object>  l2 = Arrays.asList(b, c);\n" + 
37913
		"	                   ^^^^^^^^^^^^^^^^^^^\n" + 
37914
		"Type safety : A generic array of A<String>&I is created for a varargs parameter\n" + 
37915
		"----------\n" + 
37916
		"4. ERROR in X.java (at line 8)\n" + 
37917
		"	List<Object>  l2 = Arrays.asList(b, c);\n" + 
37918
		"	                   ^^^^^^^^^^^^^^^^^^^\n" + 
37919
		"Type mismatch: cannot convert from List<A<String>&I> to List<Object>\n" + 
37920
		"----------\n");
37921
}
37922
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154267
37923
public void test1137() {
37924
	this.runNegativeTest(
37925
		new String[] {
37926
			"X.java",
37927
			"import java.awt.Container;\n" + 
37928
			"import java.util.Collection;\n" + 
37929
			"\n" + 
37930
			"abstract class Kollection<T extends Container> implements Collection<T> {}\n" + 
37931
			"abstract class Kontainer extends Container {}\n" + 
37932
			"\n" + 
37933
			"public class X {\n" + 
37934
			"	private <T extends Container> Collection<T> foo() {\n" + 
37935
			"		return null;\n" + 
37936
			"	}\n" + 
37937
			"	private <T extends Container> Kollection<T> bar() {\n" + 
37938
			"		return null;\n" + 
37939
			"	}\n" + 
37940
			"\n" + 
37941
			"	private void showProblem() {\n" + 
37942
			"		Collection<?> result = foo();\n" + 
37943
			"		Collection<? extends Container> result1 = foo();\n" + 
37944
			"		\n" + 
37945
			"		Collection<?> result2 = (Collection<Container>)foo();\n" + 
37946
			"		String result3 = foo();\n" + 
37947
			"		String result4 = (String) foo();		\n" + 
37948
			"\n" + 
37949
			"		Kollection<?> result5 = bar();\n" + 
37950
			"		Kollection<? extends Kontainer> result6 = bar();\n" + 
37951
			"	}\n" + 
37952
			"}\n", // =================
37953
		},
37954
		"----------\n" + 
37955
		"1. WARNING in X.java (at line 19)\n" + 
37956
		"	Collection<?> result2 = (Collection<Container>)foo();\n" + 
37957
		"	                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
37958
		"Unnecessary cast from Collection<Container> to Collection<Container>\n" + 
37959
		"----------\n" + 
37960
		"2. ERROR in X.java (at line 20)\n" + 
37961
		"	String result3 = foo();\n" + 
37962
		"	                 ^^^^^\n" + 
37963
		"Type mismatch: cannot convert from Collection<Container> to String\n" + 
37964
		"----------\n" + 
37965
		"3. ERROR in X.java (at line 21)\n" + 
37966
		"	String result4 = (String) foo();		\n" + 
37967
		"	                 ^^^^^^^^^^^^^^\n" + 
37968
		"Cannot cast from Collection<Container> to String\n" + 
37969
		"----------\n");
37970
}
37971
public void test1138() {
37972
	// binary prerequisite
37973
	this.runConformTest(
37974
		new String[] {
37975
			"p/E.java",
37976
			"package p;\n" + 
37977
			"public enum E {\n" + 
37978
			"}\n", // =================
37979
		},
37980
		"");
37981
	this.runConformTest(
37982
			new String[] {
37983
				"X.java",
37984
				"import static p.E.*;\n" + 
37985
				"public class X implements java.io.Serializable {\n" + 
37986
				"}\n", // =================
37987
			},
37988
			"",
37989
			null, // use default class-path
37990
			false, // do not flush previous output dir content
37991
			null); // no special vm args		);
37992
}
37993
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=186833
37994
public void test1139() {
37995
	this.runNegativeTest(
37996
		new String[] {
37997
			"p/X.java",
37998
			"package p;\n" + 
37999
			"import p.X.Super;\n" + 
38000
			"import static p.Top.*;\n" + 
38001
			"\n" + 
38002
			"class Top<T> {\n" + 
38003
			"	static class A<U> {}\n" + 
38004
			"}\n" + 
38005
			"\n" + 
38006
			"public class X extends Super<A<X>> {\n" + 
38007
			"	static class Super<T> extends Top<T>{\n" + 
38008
			"	}\n" + 
38009
			"}", // =================
38010
		},
38011
		"----------\n" + 
38012
		"1. ERROR in p\\X.java (at line 9)\r\n" + 
38013
		"	public class X extends Super<A<X>> {\r\n" + 
38014
		"	                       ^^^^^\n" + 
38015
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" + 
38016
		"----------\n"
38017
	);
38018
}
38019
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=186788
38020
public void test1140() {
38021
	this.runNegativeTest(
38022
		new String[] {
38023
			"p/X.java",
38024
			"package p;\n" + 
38025
			"import static p.X.Super;\n" + 
38026
			"import static p.Top.*;\n" + 
38027
			"\n" + 
38028
			"class Top<T> {\n" + 
38029
			"        static class A<U> {}\n" + 
38030
			"}\n" + 
38031
			"\n" + 
38032
			"public class X extends Super<A<X>> {\n" + 
38033
			"        class Super<T> extends Top<T>{\n" + 
38034
			"        }\n" + 
38035
			"}", // =================
38036
		},
38037
		"----------\n" + 
38038
		"1. ERROR in p\\X.java (at line 2)\r\n" + 
38039
		"	import static p.X.Super;\r\n" + 
38040
		"	              ^^^^^^^^^\n" + 
38041
		"The import p.X.Super cannot be resolved\n" + 
38042
		"----------\n" + 
38043
		"2. ERROR in p\\X.java (at line 9)\r\n" + 
38044
		"	public class X extends Super<A<X>> {\r\n" + 
38045
		"	                       ^^^^^\n" + 
38046
		"Super cannot be resolved to a type\n" + 
38047
		"----------\n");
38048
}
38049
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=186833 - variation
38050
public void test1141() {
38051
	this.runNegativeTest(
38052
		new String[] {
38053
			"p/X.java",
38054
			"package p;\n" + 
38055
			"import static p.Top.*;\n" + 
38056
			"\n" + 
38057
			"class Top<T> {\n" + 
38058
			"	static class A<U> {}\n" + 
38059
			"}\n" + 
38060
			"\n" + 
38061
			"public class X extends p.X.Super<A<X>> {\n" + 
38062
			"	static class Super<T> extends Top<T>{\n" + 
38063
			"	}\n" + 
38064
			"}", // =================
38065
		},
38066
		"----------\n" + 
38067
		"1. ERROR in p\\X.java (at line 8)\r\n" + 
38068
		"	public class X extends p.X.Super<A<X>> {\r\n" + 
38069
		"	                       ^^^^^^^^^\n" + 
38070
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" + 
38071
		"----------\n");
38072
}
38073
}

Return to bug 189456