Index: src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java,v retrieving revision 1.48 diff -u -r1.48 AbstractRegressionTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java 17 May 2005 15:38:20 -0000 1.48 +++ src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java 20 May 2005 19:04:10 -0000 @@ -424,4 +424,43 @@ } super.tearDown(); } + + protected void executeClass( + String sourceFile, + String expectedSuccessOutputString, + String[] classLib, + boolean shouldFlushOutputDirectory, + String[] vmArguments, + Map customOptions, + ICompilerRequestor clientRequestor) { + + // Compute class name by removing ".java" and replacing slashes with dots + String className = sourceFile.substring(0, sourceFile.length() - 5).replace('/', '.').replace('\\', '.'); + if (className.endsWith(PACKAGE_INFO_NAME)) return; + + if (vmArguments != null) { + if (this.verifier != null) { + this.verifier.shutDown(); + } + this.verifier = new TestVerifier(false); + this.createdVerifier = true; + } + boolean passed = + this.verifier.verifyClassFiles( + sourceFile, + className, + expectedSuccessOutputString, + this.classpaths, + null, + vmArguments); + assertTrue(this.verifier.failureReason, // computed by verifyClassFiles(...) action + passed); + if (vmArguments != null) { + if (this.verifier != null) { + this.verifier.shutDown(); + } + this.verifier = new TestVerifier(false); + this.createdVerifier = true; + } + } } Index: src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java,v retrieving revision 1.72 diff -u -r1.72 EnumTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 20 May 2005 11:44:05 -0000 1.72 +++ src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java 20 May 2005 19:04:10 -0000 @@ -33,7 +33,7 @@ // All specified tests which does not belong to the class are skipped... static { // TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 106 }; +// TESTS_NUMBERS = new int[] { 105 }; // TESTS_RANGE = new int[] { 21, 50 }; } public static Test suite() { @@ -1554,8 +1554,6 @@ // TODO (philippe) check one cannot redefine Enum incorrectly - // TODO (philippe) check binary compatibility (removing referenced enum constants in switch) - // TODO (philippe) check enum syntax recovery /** * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78914 - variation @@ -3235,5 +3233,98 @@ "} \n", }, "ENUM1"); - } + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88395 + public void test105() { + this.runConformTest( + new String[] { + "pack/X.java", + "package pack;\n" + + "import static pack.Color.*;\n" + + "public class X {\n" + + " public static void main(String[] args) {\n" + + " Color c = BLACK;\n" + + " switch(c) {\n" + + " case BLACK:\n" + + " System.out.print(\"Black\");\n" + + " break;\n" + + " case WHITE:\n" + + " System.out.print(\"White\");\n" + + " break;\n" + + " }\n" + + " }\n" + + "}", + "pack/Color.java", + "package pack;\n" + + "enum Color {WHITE, BLACK}" + }, + "Black" + ); + + this.runConformTest( + new String[] { + "pack/Color.java", + "package pack;\n" + + "enum Color {BLACK, WHITE}" + }, + "", + null, + false, + null + ); + + this.executeClass( + "pack/X.java", + "Black", + null, + false, + null, + null, + null); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88395 + public void test106() { + this.runConformTest( + new String[] { + "pack/X.java", + "package pack;\n" + + "import static pack.Color.*;\n" + + "public class X {\n" + + " public static void main(String[] args) {\n" + + " Color c = BLACK;\n" + + " switch(c) {\n" + + " }\n" + + " System.out.print(\"SUCCESS\");\n" + + " }\n" + + "}", + "pack/Color.java", + "package pack;\n" + + "enum Color {WHITE, BLACK}" + }, + "SUCCESS" + ); + + this.runConformTest( + new String[] { + "pack/Color.java", + "package pack;\n" + + "enum Color {BLACK, WHITE}" + }, + "", + null, + false, + null + ); + + this.executeClass( + "pack/X.java", + "SUCCESS", + null, + false, + null, + null, + null); + } }