Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-12-11 19:33:06 +0000
committerStephan Herrmann2010-12-11 19:33:06 +0000
commit1cd57131803081138a2298ded9b03083276a57f1 (patch)
treea3b16bea83ce6eee189e9751fbc5781d436e7e3d /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java
parentd3c1c6ad12f31d9be2d2d6869a3e39bb23cf8a04 (diff)
downloadorg.eclipse.objectteams-1cd57131803081138a2298ded9b03083276a57f1.tar.gz
org.eclipse.objectteams-1cd57131803081138a2298ded9b03083276a57f1.tar.xz
org.eclipse.objectteams-1cd57131803081138a2298ded9b03083276a57f1.zip
update jdt.core and tests to v_B28.
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java')
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java124
1 files changed, 123 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java
index c53e2dc91..eff8a90b8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java
@@ -33,7 +33,7 @@ public class EnumTest extends AbstractComparableTest {
// All specified tests which does not belong to the class are skipped...
static {
// TESTS_NAMES = new String[] { "test000" };
-// TESTS_NUMBERS = new int[] { 181 };
+// TESTS_NUMBERS = new int[] { 182 };
// TESTS_RANGE = new int[] { 21, 50 };
}
public static Test suite() {
@@ -6542,4 +6542,126 @@ public void test181() {
},
"SUCCESS");
}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=328519
+public void test182() throws Exception {
+ Map customOptions = getCompilerOptions();
+ customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR);
+ customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String argv[]) {\n" +
+ " foo();\n" +
+ " }\n" +
+ " public static void foo() {\n" +
+ " int n = 0;\n" +
+ " for (E e : E.values()) {\n" +
+ " if (e.val() == E.VALUES[n++] ) {\n" +
+ " System.out.print(e.val());\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}",
+ "E.java",
+ "enum E {\n" +
+ " a1(1), a2(2);\n" +
+ " static int[] VALUES = { 1, 2 };\n" +
+ " private int value;\n" +
+ " E(int v) {\n" +
+ " this.value = v;\n" +
+ " }\n" +
+ " public int val() {\n" +
+ " return this.value;\n" +
+ " }\n" +
+ "}"
+ },
+ "12",
+ null/*classLibraries*/,
+ true/*shouldFlushOutputDirectory*/,
+ null,
+ customOptions,
+ null);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=328519
+public void test183() throws Exception {
+ Map customOptions = getCompilerOptions();
+ customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR);
+ customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String argv[]) {\n" +
+ " }\n" +
+ " static {\n" +
+ " int n = 0;\n" +
+ " for (E e : E.values()) {\n" +
+ " if (e.val() == E.VALUES[n++] ) {\n" +
+ " System.out.print(e.val());\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}",
+ "E.java",
+ "enum E {\n" +
+ " a1(1), a2(2);\n" +
+ " static int[] VALUES = { 1, 2 };\n" +
+ " private int value;\n" +
+ " E(int v) {\n" +
+ " this.value = v;\n" +
+ " }\n" +
+ " public int val() {\n" +
+ " return this.value;\n" +
+ " }\n" +
+ "}"
+ },
+ "12",
+ null/*classLibraries*/,
+ true/*shouldFlushOutputDirectory*/,
+ null,
+ customOptions,
+ null);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=328519
+public void test184() throws Exception {
+ Map customOptions = getCompilerOptions();
+ customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR);
+ customOptions.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT);
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String argv[]) {\n" +
+ " new X();\n" +
+ " }\n" +
+ " X() {\n" +
+ " int n = 0;\n" +
+ " for (E e : E.values()) {\n" +
+ " if (e.val() == E.VALUES[n++] ) {\n" +
+ " System.out.print(e.val());\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}",
+ "E.java",
+ "enum E {\n" +
+ " a1(1), a2(2);\n" +
+ " static int[] VALUES = { 1, 2 };\n" +
+ " private int value;\n" +
+ " E(int v) {\n" +
+ " this.value = v;\n" +
+ " }\n" +
+ " public int val() {\n" +
+ " return this.value;\n" +
+ " }\n" +
+ "}"
+ },
+ "12",
+ null/*classLibraries*/,
+ true/*shouldFlushOutputDirectory*/,
+ null,
+ customOptions,
+ null);
+}
}

Back to the top