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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java (+39 lines)
Lines 424-427 Link Here
424
		}
424
		}
425
		super.tearDown();
425
		super.tearDown();
426
	}
426
	}
427
	
428
	protected void executeClass(
429
			String sourceFile, 
430
			String expectedSuccessOutputString, 
431
			String[] classLib,
432
			boolean shouldFlushOutputDirectory, 
433
			String[] vmArguments, 
434
			Map customOptions,
435
			ICompilerRequestor clientRequestor) {
436
437
		// Compute class name by removing ".java" and replacing slashes with dots
438
		String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.');
439
		if (className.endsWith(PACKAGE_INFO_NAME)) return;
440
441
		if (vmArguments != null) {
442
			if (this.verifier != null) {
443
				this.verifier.shutDown();
444
			}
445
			this.verifier = new TestVerifier(false);
446
			this.createdVerifier = true;
447
		}
448
		boolean passed = 
449
			this.verifier.verifyClassFiles(
450
				sourceFile, 
451
				className, 
452
				expectedSuccessOutputString,
453
				this.classpaths, 
454
				null, 
455
				vmArguments);
456
		assertTrue(this.verifier.failureReason, // computed by verifyClassFiles(...) action
457
				passed);
458
		if (vmArguments != null) {
459
			if (this.verifier != null) {
460
				this.verifier.shutDown();
461
			}
462
			this.verifier = new TestVerifier(false);
463
			this.createdVerifier = true;
464
		}
465
	}
427
}
466
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-4 / +95 lines)
Lines 33-39 Link Here
33
	// All specified tests which does not belong to the class are skipped...
33
	// All specified tests which does not belong to the class are skipped...
34
	static {
34
	static {
35
//		TESTS_NAMES = new String[] { "test000" };
35
//		TESTS_NAMES = new String[] { "test000" };
36
//		TESTS_NUMBERS = new int[] { 106 };
36
//		TESTS_NUMBERS = new int[] { 105 };
37
//		TESTS_RANGE = new int[] { 21, 50 };
37
//		TESTS_RANGE = new int[] { 21, 50 };
38
	}
38
	}
39
	public static Test suite() {
39
	public static Test suite() {
Lines 1554-1561 Link Here
1554
	
1554
	
1555
	// TODO (philippe) check one cannot redefine Enum incorrectly
1555
	// TODO (philippe) check one cannot redefine Enum incorrectly
1556
	
1556
	
1557
	// TODO (philippe) check binary compatibility (removing referenced enum constants in switch)
1558
	
1559
	// TODO (philippe) check enum syntax recovery
1557
	// TODO (philippe) check enum syntax recovery
1560
	/**
1558
	/**
1561
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78914 - variation
1559
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78914 - variation
Lines 3235-3239 Link Here
3235
				"}  \n",
3233
				"}  \n",
3236
            },
3234
            },
3237
            "ENUM1");
3235
            "ENUM1");
3238
    }    
3236
    }
3237
    
3238
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88395
3239
	public void test105() {
3240
		this.runConformTest(
3241
				new String[] {
3242
					"pack/X.java",
3243
					"package pack;\n" +
3244
					"import static pack.Color.*;\n" +
3245
					"public class X {\n" +
3246
					"    public static void main(String[] args) {\n" +
3247
					"        Color c = BLACK;\n" +
3248
					"        switch(c) {\n" +
3249
					"        case BLACK:\n" +
3250
					"            System.out.print(\"Black\");\n" +
3251
					"            break;\n" +
3252
					"        case WHITE:\n" +
3253
					"            System.out.print(\"White\");\n" +
3254
					"            break;\n" +
3255
					"        }\n" +
3256
					"    }\n" +
3257
					"}",
3258
					"pack/Color.java",
3259
					"package pack;\n" + 
3260
					"enum Color {WHITE, BLACK}"
3261
				},
3262
				"Black"
3263
			);
3264
		
3265
		this.runConformTest(
3266
			new String[] {
3267
				"pack/Color.java",
3268
				"package pack;\n" + 
3269
				"enum Color {BLACK, WHITE}"
3270
			},
3271
			"",
3272
			null,
3273
			false,
3274
			null
3275
		);
3276
		
3277
		this.executeClass(
3278
			"pack/X.java",
3279
			"Black",
3280
			null,
3281
			false,
3282
			null,
3283
			null,
3284
			null);	
3285
	}
3286
	
3287
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88395
3288
	public void test106() {
3289
		this.runConformTest(
3290
				new String[] {
3291
					"pack/X.java",
3292
					"package pack;\n" +
3293
					"import static pack.Color.*;\n" +
3294
					"public class X {\n" +
3295
					"    public static void main(String[] args) {\n" +
3296
					"        Color c = BLACK;\n" +
3297
					"        switch(c) {\n" +
3298
					"        }\n" +
3299
					"		 System.out.print(\"SUCCESS\");\n" +
3300
					"    }\n" +
3301
					"}",
3302
					"pack/Color.java",
3303
					"package pack;\n" + 
3304
					"enum Color {WHITE, BLACK}"
3305
				},
3306
				"SUCCESS"
3307
			);
3308
		
3309
		this.runConformTest(
3310
			new String[] {
3311
				"pack/Color.java",
3312
				"package pack;\n" + 
3313
				"enum Color {BLACK, WHITE}"
3314
			},
3315
			"",
3316
			null,
3317
			false,
3318
			null
3319
		);
3320
		
3321
		this.executeClass(
3322
			"pack/X.java",
3323
			"SUCCESS",
3324
			null,
3325
			false,
3326
			null,
3327
			null,
3328
			null);	
3329
	}
3239
}
3330
}

Return to bug 88395