Bug 569453 - [16][test] tests to be checked and run at 16
Change-Id: I0d23f48247183aacfc06e5779bf6fc6a8e6954f7
Signed-off-by: Manoj Palat <manpalat@in.ibm.com>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
index 2abc30b..95c16a8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
@@ -52,6 +52,9 @@
return buildAllCompliancesTestSuite(testClass());
}
+private boolean checkSwitchAllowedLevel() {
+ return this.complianceLevel >= ClassFileConstants.JDK14;
+}
public void test001() {
this.runNegativeTest(new String[] {
"X.java", // =================
@@ -2905,9 +2908,9 @@
"----------\n");
}
public void testBug548318_001() {
- if (!checkPreviewAllowed())
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 11)\n" +
@@ -2950,16 +2953,13 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
public void testBug548318_002() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
@@ -3002,18 +3002,15 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/*
* k is definitely assigned - no errors on that front.
*/
public void testBug548318_003() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 23)\n" +
@@ -3057,15 +3054,12 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
public void testBug548318_004() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 7)\n" +
@@ -3124,15 +3118,12 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
public void testBug548318_005() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 11)\n" +
@@ -3185,8 +3176,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3197,11 +3187,9 @@
* expression e in the switch block that may exit the switch expression, V is definitely assigned after e when false.
*/
public void testBug548318_006() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 22)\n" +
@@ -3244,8 +3232,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3258,11 +3245,9 @@
* statement and V is definitely unassigned after e when false.
*/
public void testBug548318_007() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 18)\n" +
@@ -3310,8 +3295,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3319,11 +3303,8 @@
* V is [un]assigned before the selector expression iff V is [un]assigned before the switch statement.
*/
public void testBug548318_008() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 22)\n" +
@@ -3366,8 +3347,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3375,11 +3355,9 @@
* V is [un]assigned before the selector expression iff V is [un]assigned before the switch statement.
*/
public void testBug548318_009() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
@@ -3427,8 +3405,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3437,11 +3414,9 @@
* iff V is [un]assigned after the selector expression.
*/
public void testBug548318_010() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 22)\n" +
@@ -3484,8 +3459,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3494,11 +3468,9 @@
* iff V is [un]assigned after the selector expression.
*/
public void testBug548318_011() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 6)\n" +
@@ -3546,8 +3518,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3557,11 +3528,9 @@
* and V is [un]assigned after the preceding statement
*/
public void testBug548318_012() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 22)\n" +
@@ -3604,8 +3573,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3615,11 +3583,9 @@
* and V is [un]assigned after the preceding statement"
*/
public void testBug548318_012b() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 15)\n" +
@@ -3664,8 +3630,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3675,11 +3640,9 @@
* and V is [un]assigned after the preceding statement" needs to be checked
*/
public void testBug548318_013() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 9)\n" +
@@ -3727,8 +3690,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3747,11 +3709,9 @@
* It is a switch labeled throw statement.
*/
public void testBug548318_014() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 23)\n" +
@@ -3799,8 +3759,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3821,11 +3780,9 @@
* It is a switch labeled throw statement.
*/
public void testBug548318_015() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 17)\n" +
@@ -3876,8 +3833,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3886,11 +3842,9 @@
* block iff V is [un]assigned after the selector expression.
*/
public void testBug548318_016() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 14)\n" +
@@ -3929,8 +3883,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.7 , Suppose that the switch expression has result expressions e1, …, en, all of
@@ -3940,11 +3893,9 @@
* block iff V is [un]assigned after the selector expression.
*/
public void testBug548318_017() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 6)\n" +
@@ -3993,8 +3944,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, V is [un]assigned after a switch expression (15.28) iff all of the following are true:
@@ -4003,11 +3953,9 @@
* expression, block, or throw statement of the switch labeled rule.
*/
public void testBug548318_018() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 20)\n" +
@@ -4048,8 +3996,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, V is [un]assigned after a switch expression (15.28) iff all of the following are true:
@@ -4058,11 +4005,9 @@
* expression, block, or throw statement of the switch labeled rule.
*/
public void testBug548318_019() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 15)\n" +
@@ -4107,8 +4052,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4116,11 +4060,9 @@
* V is [un]assigned before the selector expression iff V is [un]assigned before the switch statement.
*/
public void testBug548318_020() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 19)\n" +
@@ -4160,8 +4102,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4169,11 +4110,9 @@
* V is [un]assigned before the selector expression iff V is [un]assigned before the switch statement.
*/
public void testBug548318_021() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
@@ -4218,8 +4157,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4231,11 +4169,9 @@
* V is [un]assigned after the last block statement of the preceding switch labeled statement group.
*/
public void testBug548318_022() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 19)\n" +
@@ -4275,8 +4211,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4288,11 +4223,9 @@
* V is [un]assigned after the last block statement of the preceding switch labeled statement group.
*/
public void testBug548318_023() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 6)\n" +
@@ -4337,8 +4270,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4350,11 +4282,9 @@
* V is [un]assigned after the last block statement of the preceding switch labeled statement group.
*/
public void testBug548318_024() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 9)\n" +
@@ -4399,8 +4329,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, V is [un]assigned after a switch expression (15.28) iff all of the following are true:
@@ -4409,11 +4338,9 @@
* expression, block, or throw statement of the switch labeled rule.
*/
public void testBug548318_025() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 20)\n" +
@@ -4459,8 +4386,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, V is [un]assigned after a switch expression (15.28) iff all of the following are true:
@@ -4469,11 +4395,9 @@
* expression, block, or throw statement of the switch labeled rule.
*/
public void testBug548318_026() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 16)\n" +
@@ -4524,8 +4448,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4534,11 +4457,9 @@
* switch expression iff V is [un]assigned after the selector expression of the switch expression.
*/
public void testBug548318_027() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 20)\n" +
@@ -4584,8 +4505,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.1.8, Suppose that the switch expression has result expressions e1, …, en, not all of
@@ -4594,11 +4514,9 @@
* switch expression iff V is [un]assigned after the selector expression of the switch expression.
*/
public void testBug548318_028() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 7)\n" +
@@ -4649,8 +4567,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.2.9, [tests the second rule - assigned]
@@ -4664,11 +4581,9 @@
* followed by }, then V is [un]assigned after the selector expression
*/
public void testBug548318_029() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 24)\n" +
@@ -4718,8 +4633,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
/**
* From JLS 13 16.2.9, [tests the second rule - unassigned]
@@ -4733,11 +4647,9 @@
* followed by }, then V is [un]assigned after the selector expression
*/
public void testBug548318_030() {
- if (!checkPreviewAllowed())
-
-
+ if (!checkSwitchAllowedLevel())
return;
- Map<String, String> defaultOptions = setPresetPreviewOptions();
+ setPresetPreviewOptions();
String expectedProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 20)\n" +
@@ -4792,8 +4704,7 @@
testFiles,
expectedProblemLog,
null,
- true,
- defaultOptions);
+ true);
}
public static Class testClass() {
return FlowAnalysisTest.class;
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index ab165d8..c9c0b99 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
@@ -197,14 +201,19 @@
since_14.add(JavadocTestForRecord.class);
since_14.add(BatchCompilerTest_14.class);
- // add 14 specific test here (check duplicates)
+ // add 15 specific test here (check duplicates)
ArrayList since_15 = new ArrayList();
since_15.add(SealedTypes15Tests.class);
since_15.add(ClassFileReaderTest_15.class);
since_15.add(JavadocTest_15.class);
since_15.add(LocalStaticsTest_15.class);
since_15.add(Unicode13Test.class);
- // Build final test suite
+
+ // add 16 specific test here (check duplicates)
+ ArrayList since_16 = new ArrayList();
+ since_16.add(LocalEnumTest.class);
+
+ // Build final test suite
TestSuite all = new TestSuite(TestAll.class.getName());
all.addTest(new TestSuite(StandAloneASTParserTest.class));
int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
@@ -363,6 +372,24 @@
TestCase.resetForgottenFilters(tests_15);
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_15), tests_15));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_16) != 0) {
+ ArrayList tests_16 = (ArrayList)standardTests.clone();
+ tests_16.addAll(since_1_4);
+ tests_16.addAll(since_1_5);
+ tests_16.addAll(since_1_6);
+ tests_16.addAll(since_1_7);
+ tests_16.addAll(since_1_8);
+ tests_16.addAll(since_9);
+ tests_16.addAll(since_10);
+ tests_16.addAll(since_11);
+ tests_16.addAll(since_12);
+ tests_16.addAll(since_13);
+ tests_16.addAll(since_14);
+ tests_16.addAll(since_15);
+ tests_16.addAll(since_16);
+ TestCase.resetForgottenFilters(tests_16);
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_16), tests_16));
+ }
all.addTest(new TestSuite(Jsr14Test.class));
return all;
}