Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1147e5ac1d1893cf96d465791abdb64fe9531821 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
/*******************************************************************************
 * Copyright (c) 2006, 2010 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

import java.util.Map;
import junit.framework.Test;

public class SuperTypeTest extends AbstractRegressionTest {

	public SuperTypeTest(String name) {
		super(name);
	}
	// Static initializer to specify tests subset using TESTS_* static variables
	// All specified tests which does not belong to the class are skipped...
	static {
//		TESTS_NAMES = new String[] { "test000" };
//		TESTS_NUMBERS = new int[] { 42, 43, 44 };
//		TESTS_RANGE = new int[] { 11, -1 };
	}

	public static Test suite() {
		return buildAllCompliancesTestSuite(testClass());
	}

	public static Class testClass() {
		return SuperTypeTest.class;
	}

	/**
	 * http://bugs.eclipse.org/bugs/show_bug.cgi?id=136106
	 */
	public void test001() {
		this.runConformTest(
			new String[] {
				/* org.eclipse.curiosity.A */
				"org/eclipse/curiosity/A.java",
				"package org.eclipse.curiosity;\n" +
				"public abstract class A implements InterfaceA {\n" +
				"	private void e() {\n" +
				"	}\n" +
				"	public void f() {\n" +
				"		this.e();\n" +
				"	}\n" +
				"}",
				/* org.eclipse.curiosity.InterfaceA */
				"org/eclipse/curiosity/InterfaceA.java",
				"package org.eclipse.curiosity;\n" +
				"public interface InterfaceA extends InterfaceBase {}\n",
				"org/eclipse/curiosity/InterfaceBase.java",
				/* org.eclipse.curiosity.InterfaceBase */
				"package org.eclipse.curiosity;\n" +
				"public interface InterfaceBase {\n" +
				"    public void a();\n" +
				"    public void b();\n" +
				"    public void c();\n" +
				"    public void d();\n" +
				"}"
			}
		);
	}
// was Compliance_1_x#test001
public void test002() {
	String[] sources = new String[] {
		"p1/Test.java",
		"package p1; \n"+
		"public class Test { \n"+
		"	public static void main(String[] arguments) { \n"+
		"		new Test().foo(); \n"+
		"	} \n"+
		"	class M { \n"+
		"	} \n"+
		"	void foo(){ \n"+
		"		class Y extends Secondary { \n"+
		"			M m; \n"+
		"		}; \n"+
		"		System.out.println(\"SUCCESS\");	\n" +
		"	} \n"+
		"} \n" +
		"class Secondary { \n" +
		"	class M {} \n" +
		"} \n"
	};
	if (this.complianceLevel == ClassFileConstants.JDK1_3) {
		runNegativeTest(
			sources,
			"----------\n" +
			"1. ERROR in p1\\Test.java (at line 10)\n" +
			"	M m; \n" +
			"	^\n" +
			"The type M is defined in an inherited type and an enclosing scope\n" +
			"----------\n");
	} else {
		runConformTest(
			sources,
			"SUCCESS");
	}
}

// was Compliance_1_x#test002
public void test003() {
	String[] sources = new String[] {
		"p1/Test.java",
		"package p1; \n"+
		"public class Test { \n"+
		"	public static void main(String[] arguments) { \n"+
		"		new Test().foo(); \n"+
		"	} \n"+
		"	String bar() { \n"+
		"		return \"FAILED\";	\n" +
		"	} \n"+
		"	void foo(){ \n"+
		"		class Y extends Secondary { \n"+
		"			String z = bar();	\n" +
		"		}; \n"+
		"		System.out.println(new Y().z);	\n" +
		"	} \n"+
		"} \n" +
		"class Secondary { \n" +
		"	String bar(){ return \"SUCCESS\"; } \n" +
		"} \n"
	};
	if (this.complianceLevel == ClassFileConstants.JDK1_3) {
		runNegativeTest(
			sources,
			"----------\n" +
			"1. ERROR in p1\\Test.java (at line 11)\n" +
			"	String z = bar();	\n" +
			"	           ^^^\n" +
			"The method bar is defined in an inherited type and an enclosing scope\n" +
			"----------\n");
	} else {
		runConformTest(
			sources,
			"SUCCESS");
	}
}

// was Compliance_1_x#test003
public void test004() {
	String[] sources = new String[] {
		"p1/Test.java",
		"package p1; \n"+
		"public class Test { \n"+
		"	public static void main(String[] arguments) { \n"+
		"		new Test().foo(); \n"+
		"	} \n"+
		"	String bar = \"FAILED\";"+
		"	void foo(){ \n"+
		"		class Y extends Secondary { \n"+
		"			String z = bar; \n"+
		"		}; \n"+
		"		System.out.println(new Y().z);	\n" +
		"	} \n"+
		"} \n" +
		"class Secondary { \n" +
		"	String bar = \"SUCCESS\"; \n" +
		"} \n"
	};
	if (this.complianceLevel == ClassFileConstants.JDK1_3) {
		runNegativeTest(
			sources,
			"----------\n" +
			"1. ERROR in p1\\Test.java (at line 8)\n" +
			"	String z = bar; \n" +
			"	           ^^^\n" +
			"The field bar is defined in an inherited type and an enclosing scope \n" +
			"----------\n");
	} else {
		runConformTest(
			sources,
			"SUCCESS");
	}
}

// was Compliance_1_x#test004
public void test005() {
	this.runConformTest(
		new String[] {
			"p1/Test.java",
			"package p1; \n"+
			"public class Test { \n"+
			"	public static void main(String[] arguments) { \n"+
			"		new Test().foo(); \n"+
			"	} \n"+
			"	String bar() { \n"+
			"		return \"SUCCESS\";	\n" +
			"	} \n"+
			"	void foo(){ \n"+
			"		class Y extends Secondary { \n"+
			"			String z = bar();	\n" +
			"		}; \n"+
			"		System.out.println(new Y().z);	\n" +
			"	} \n"+
			"} \n" +
			"class Secondary { \n" +
			"	private String bar(){ return \"FAILED\"; } \n" +
			"} \n"
		},
		"SUCCESS");
}

// was Compliance_1_x#test005
public void test006() {
	this.runConformTest(
		new String[] {
			"p1/Test.java",
			"package p1; \n"+
			"public class Test { \n"+
			"	public static void main(String[] arguments) { \n"+
			"		new Test().foo(); \n"+
			"	} \n"+
			"	String bar = \"SUCCESS\";"+
			"	void foo(){ \n"+
			"		class Y extends Secondary { \n"+
			"			String z = bar; \n"+
			"		}; \n"+
			"		System.out.println(new Y().z);	\n" +
			"	} \n"+
			"} \n" +
			"class Secondary { \n" +
			"	private String bar = \"FAILED\"; \n" +
			"} \n"
		},
		"SUCCESS");
}

// was Compliance_1_x#test006
public void test007() {
	this.runNegativeTest(
		new String[] {
			"p1/Test.java",
			"package p1; \n"+
			"public class Test { \n"+
			"	public static void main(String[] arguments) { \n"+
			"		new Test().foo(); \n"+
			"	} \n"+
			"	String bar() { \n"+
			"		return \"FAILED\";	\n" +
			"	} \n"+
			"	void foo(){ \n"+
			"		class Y extends Secondary { \n"+
			"			String z = bar();	\n" +
			"		}; \n"+
			"		System.out.println(new Y().z);	\n" +
			"	} \n"+
			"} \n" +
			"class Secondary { \n" +
			"	String bar(int i){ return \"SUCCESS\"; } \n" +
			"} \n"
		},
		"----------\n" +
		"1. ERROR in p1\\Test.java (at line 11)\n" +
		"	String z = bar();	\n" +
		"	           ^^^\n" +
		"The method bar(int) in the type Secondary is not applicable for the arguments ()\n" +
		"----------\n"
	);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918
// default is silent
public void test008() {
	this.runConformTest(
		new String[] {
			"X.java",
			"public class X implements I {}\n" +
			"class Y extends X implements I, J {}" +
			"interface I {}\n" +
			"interface J {}\n"
		},
		""
	);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918
// raising an error
public void test009() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"public class X implements I {}\n" +
			"class Y extends X implements I, J {}\n" +
			"interface I {}\n" +
			"interface J {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + /* expected compiler log */
		"1. ERROR in X.java (at line 2)\n" +
		"	class Y extends X implements I, J {}\n" +
		"	                             ^\n" +
		"Redundant superinterface I for the type Y, already defined by X\n" +
		"----------\n",
		// javac options
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918
// raising an error - deeper hierarchy
public void test010() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface, CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"public class X implements I {}\n" +
			"class Y extends X {}\n" +
			"class Z extends Y implements J, I {}\n" +
			"interface I {}\n" +
			"interface J {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + /* expected compiler log */
		"1. ERROR in X.java (at line 3)\n" +
		"	class Z extends Y implements J, I {}\n" +
		"	                                ^\n" +
		"Redundant superinterface I for the type Z, already defined by X\n" +
		"----------\n",
		// javac options
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918
// no error - deeper hierarchy
public void test011() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	this.runConformTest(
		new String[] {
			"X.java",
			"public class X implements I {}\n" +
			"class Y extends X {}\n" +
			"class Z extends Y implements J {}" +
			"interface I {}\n" +
			"interface J {}\n"
		},
		"",
		null /* no extra class libraries */,
		true /* flush output directory */,
		null /* no vm arguments */,
		customOptions,
		null /* no custom requestor*/);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=77918
// error - extending interfaces
public void test012() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"public class X implements J {}\n" +
			"class Y extends X implements I {}\n" +
			"interface I {}\n" +
			"interface J extends I {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + /* expected compiler log */
		"1. ERROR in X.java (at line 2)\n" +
		"	class Y extends X implements I {}\n" +
		"	                             ^\n" +
		"Redundant superinterface I for the type Y, already defined by J\n" +
		"----------\n",
		// javac options
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=288749
public void test013() {
	if (this.complianceLevel < ClassFileConstants.JDK1_5) return;
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"import java.util.*;\n" +
			"interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" +
			"interface Y<E> extends Collection<E>, List<E> {}\n" +
			"interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" +
			"abstract class Z implements List<Object>, Collection<Object> {}\n" +
			"abstract class ZZ implements Collection<Object>, List<Object> {}"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + 
		"1. ERROR in X.java (at line 2)\n" + 
		"	interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" + 
		"	                                ^^^^^^^^^^\n" + 
		"Redundant superinterface Collection<E> for the type X<E>, already defined by List<E>\n" + 
		"----------\n" + 
		"2. ERROR in X.java (at line 2)\n" + 
		"	interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" + 
		"	                                               ^^^^^^^^\n" + 
		"Redundant superinterface Iterable<E> for the type X<E>, already defined by List<E>\n" + 
		"----------\n" + 
		"3. ERROR in X.java (at line 3)\n" + 
		"	interface Y<E> extends Collection<E>, List<E> {}\n" + 
		"	                       ^^^^^^^^^^\n" + 
		"Redundant superinterface Collection<E> for the type Y<E>, already defined by List<E>\n" + 
		"----------\n" + 
		"4. ERROR in X.java (at line 4)\n" + 
		"	interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" + 
		"	                         ^^^^^^^^\n" + 
		"Redundant superinterface Iterable<E> for the type XXX<E>, already defined by List<E>\n" + 
		"----------\n" + 
		"5. ERROR in X.java (at line 4)\n" + 
		"	interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" + 
		"	                                               ^^^^^^^^^^\n" + 
		"Redundant superinterface Collection<E> for the type XXX<E>, already defined by List<E>\n" + 
		"----------\n" + 
		"6. ERROR in X.java (at line 5)\n" + 
		"	abstract class Z implements List<Object>, Collection<Object> {}\n" + 
		"	                                          ^^^^^^^^^^\n" + 
		"Redundant superinterface Collection<Object> for the type Z, already defined by List<Object>\n" + 
		"----------\n" + 
		"7. ERROR in X.java (at line 6)\n" + 
		"	abstract class ZZ implements Collection<Object>, List<Object> {}\n" + 
		"	                             ^^^^^^^^^^\n" + 
		"Redundant superinterface Collection<Object> for the type ZZ, already defined by List<Object>\n" + 
		"----------\n",
		JavacTestOptions.SKIP);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=288749
public void test014() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"public class X implements I, J {}",
			"I.java",
			"public interface I {}",
			"J.java",
			"public interface J extends I {}"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + 
		"1. ERROR in X.java (at line 1)\n" + 
		"	public class X implements I, J {}\n" + 
		"	                          ^\n" + 
		"Redundant superinterface I for the type X, already defined by J\n" + 
		"----------\n",
		JavacTestOptions.SKIP);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320911 (as is)
public void test015() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"interface IVerticalRulerColumn {}\n" +
			"interface IVerticalRulerInfo {}\n" +
			"interface IVerticalRulerInfoExtension {}\n" +
			"interface IChangeRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfoExtension {}\n" +
			"interface IRevisionRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" +
			"public final class X implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension, IChangeRulerColumn, IRevisionRulerColumn {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + 
		"1. ERROR in X.java (at line 6)\n" + 
		"	public final class X implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension, IChangeRulerColumn, IRevisionRulerColumn {}\n" + 
		"	                                ^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerColumn for the type X, already defined by IChangeRulerColumn\n" + 
		"----------\n" + 
		"2. ERROR in X.java (at line 6)\n" + 
		"	public final class X implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension, IChangeRulerColumn, IRevisionRulerColumn {}\n" + 
		"	                                                      ^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfo for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n" + 
		"3. ERROR in X.java (at line 6)\n" + 
		"	public final class X implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension, IChangeRulerColumn, IRevisionRulerColumn {}\n" + 
		"	                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfoExtension for the type X, already defined by IChangeRulerColumn\n" + 
		"----------\n",
		JavacTestOptions.SKIP);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320911 (variation)
public void test016() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"interface IVerticalRulerColumn {}\n" +
			"interface IVerticalRulerInfo {}\n" +
			"interface IVerticalRulerInfoExtension {}\n" +
			"interface IChangeRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfoExtension {}\n" +
			"interface IRevisionRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" +
			"class Z implements IChangeRulerColumn {}\n" +
			"class Y extends Z implements IRevisionRulerColumn {}\n" +
			"public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + 
		"1. ERROR in X.java (at line 8)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                          ^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerColumn for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n" + 
		"2. ERROR in X.java (at line 8)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                                                ^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfo for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n" + 
		"3. ERROR in X.java (at line 8)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfoExtension for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n",
		JavacTestOptions.SKIP);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320911 (variation)
public void test017() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"interface IVerticalRulerColumn {}\n" +
			"interface IVerticalRulerInfo {}\n" +
			"interface IVerticalRulerInfoExtension {}\n" +
			"interface IChangeRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfoExtension {}\n" +
			"interface IRevisionRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" +
			"class Z implements IRevisionRulerColumn{}\n" +
			"class C extends Z {}\n" +
			"class B extends C implements IChangeRulerColumn {}\n" +
			"class H extends B {}\n" +
			"class Y extends H  {}\n" +
			"public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + 
		"1. ERROR in X.java (at line 11)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                          ^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerColumn for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n" + 
		"2. ERROR in X.java (at line 11)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                                                ^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfo for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n" + 
		"3. ERROR in X.java (at line 11)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfoExtension for the type X, already defined by IRevisionRulerColumn\n" + 
		"----------\n",
		JavacTestOptions.SKIP);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=320911 (variation)
public void test018() {
	Map customOptions = getCompilerOptions();
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
	runNegativeTest(
		// test directory preparation
		true /* flush output directory */,
		new String[] { /* test files */
			"X.java",
			"interface IVerticalRulerColumn {}\n" +
			"interface IVerticalRulerInfo {}\n" +
			"interface IVerticalRulerInfoExtension {}\n" +
			"interface IChangeRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfoExtension {}\n" +
			"interface IRevisionRulerColumn extends IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" +
			"class Z implements IVerticalRulerInfoExtension {}\n" +
			"class C extends Z {}\n" +
			"class B extends C implements IChangeRulerColumn {}\n" +
			"class H extends B implements IVerticalRulerInfo {}\n" +
			"class Y extends H  implements IVerticalRulerColumn {}\n" +
			"public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n"
		},
		// compiler options
		null /* no class libraries */,
		customOptions /* custom options */,
		// compiler results
		"----------\n" + 
		"1. ERROR in X.java (at line 10)\n" + 
		"	class Y extends H  implements IVerticalRulerColumn {}\n" + 
		"	                              ^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerColumn for the type Y, already defined by IChangeRulerColumn\n" + 
		"----------\n" + 
		"2. ERROR in X.java (at line 11)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                          ^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerColumn for the type X, already defined by Y\n" + 
		"----------\n" + 
		"3. ERROR in X.java (at line 11)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                                                ^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfo for the type X, already defined by H\n" + 
		"----------\n" + 
		"4. ERROR in X.java (at line 11)\n" + 
		"	public final class X extends Y implements IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension {}\n" + 
		"	                                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
		"Redundant superinterface IVerticalRulerInfoExtension for the type X, already defined by Z\n" + 
		"----------\n",
		JavacTestOptions.SKIP);
}
}

Back to the top