Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java22
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java13
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java39
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java8
7 files changed, 90 insertions, 9 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
index 8699a67c45..4bf58d9e27 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
@@ -207,6 +207,28 @@ public static TestSuite getTestSuite(boolean addComplianceDiagnoseTest) {
TestCase.RUN_ONLY_ID = null;
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_12), tests_12));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_13) != 0) {
+ ArrayList tests_13 = (ArrayList)testClasses.clone();
+ tests_13.addAll(TEST_CLASSES_1_5);
+ tests_13.add(ParserTest1_7.class);
+ tests_13.add(LambdaExpressionSyntaxTest.class);
+ tests_13.add(ReferenceExpressionSyntaxTest.class);
+ tests_13.add(TypeAnnotationSyntaxTest.class);
+ tests_13.add(CompletionParserTest18.class);
+ tests_13.add(SelectionParserTest18.class);
+ tests_13.add(SelectionParserTest9.class);
+ tests_13.add(SelectionParserTest10.class);
+ tests_13.add(SelectionParserTest12.class);
+ tests_13.add(ModuleDeclarationSyntaxTest.class);
+ tests_13.add(JEP286ReservedWordTest.class);
+ // Reset forgotten subsets tests
+ TestCase.TESTS_PREFIX = null;
+ TestCase.TESTS_NAMES = null;
+ TestCase.TESTS_NUMBERS= null;
+ TestCase.TESTS_RANGE = null;
+ TestCase.RUN_ONLY_ID = null;
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_12), tests_13));
+ }
return all;
}
public static Test suite() {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index bf92df0f21..1f482530fc 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -302,6 +302,8 @@ static class JavacCompiler {
return JavaCore.VERSION_11;
} else if(rawVersion.startsWith("12")) {
return JavaCore.VERSION_12;
+ } else if(rawVersion.startsWith("13")) {
+ return JavaCore.VERSION_13;
} else {
throw new RuntimeException("unknown javac version: " + rawVersion);
}
@@ -423,6 +425,17 @@ static class JavacCompiler {
return 0200;
}
}
+ if (version == JavaCore.VERSION_13) {
+ if ("13".equals(rawVersion)) {
+ return 0000;
+ }
+ if ("13.0.1".equals(rawVersion)) {
+ return 0100;
+ }
+ if ("13.0.2".equals(rawVersion)) {
+ return 0200;
+ }
+ }
throw new RuntimeException("unknown raw javac version: " + rawVersion);
}
// returns 0L if everything went fine; else the lower word contains the
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
index ace9a6a75a..8ccba0f655 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
@@ -44,6 +44,7 @@ public class AbstractCompilerTest extends TestCase {
public static final int F_10 = 0x80;
public static final int F_11 = 0x100;
public static final int F_12 = 0x200;
+ public static final int F_13 = 0x400;
public static final boolean RUN_JAVAC = CompilerOptions.ENABLED.equals(System.getProperty("run.javac"));
private static final int UNINITIALIZED = -1;
@@ -55,6 +56,7 @@ public class AbstractCompilerTest extends TestCase {
protected static boolean isJRE9Plus = false; // Stop gap, so tests need not be run at 9, but some tests can be adjusted for JRE 9
protected static boolean isJRE11Plus = false;
protected static boolean isJRE12Plus = false;
+ protected static boolean isJRE13Plus = false;
protected static boolean reflectNestedClassUseDollar;
/**
@@ -102,6 +104,9 @@ public class AbstractCompilerTest extends TestCase {
if ((complianceLevels & AbstractCompilerTest.F_12) != 0) {
suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_12)));
}
+ if ((complianceLevels & AbstractCompilerTest.F_13) != 0) {
+ suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_13)));
+ }
}
/**
@@ -147,6 +152,9 @@ public class AbstractCompilerTest extends TestCase {
if ((complianceLevels & AbstractCompilerTest.F_12) != 0) {
suite.addTest(buildComplianceTestSuite(testClasses, setupClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_12)));
}
+ if ((complianceLevels & AbstractCompilerTest.F_13) != 0) {
+ suite.addTest(buildComplianceTestSuite(testClasses, setupClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_13)));
+ }
return suite;
}
@@ -156,6 +164,7 @@ public class AbstractCompilerTest extends TestCase {
isJRE9Plus = !isJRELevel(lessthan9);
isJRE11Plus = isJRELevel(F_11);
isJRE12Plus = isJRELevel(F_12);
+ isJRE13Plus = isJRELevel(F_13);
}
/**
@@ -306,6 +315,14 @@ public class AbstractCompilerTest extends TestCase {
suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_12)));
}
}
+ int level_13 = complianceLevels & AbstractCompilerTest.F_13;
+ if (level_13 != 0) {
+ if (level_13 < minimalCompliance) {
+ System.err.println("Cannot run "+evaluationTestClass.getName()+" at compliance 13!");
+ } else {
+ suite.addTest(buildUniqueComplianceTestSuite(evaluationTestClass, ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_13)));
+ }
+ }
return suite;
}
@@ -364,6 +381,9 @@ public class AbstractCompilerTest extends TestCase {
*/
public static long highestComplianceLevels() {
int complianceLevels = AbstractCompilerTest.getPossibleComplianceLevels();
+ if ((complianceLevels & AbstractCompilerTest.F_13) != 0) {
+ return ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_13);
+ }
if ((complianceLevels & AbstractCompilerTest.F_12) != 0) {
return ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_12);
}
@@ -420,7 +440,8 @@ public class AbstractCompilerTest extends TestCase {
public static int getPossibleComplianceLevels() {
if (possibleComplianceLevels == UNINITIALIZED) {
String specVersion = System.getProperty("java.specification.version");
- isJRE12Plus = CompilerOptions.VERSION_12.equals(specVersion);
+ isJRE13Plus = CompilerOptions.VERSION_13.equals(specVersion);
+ isJRE12Plus = isJRE13Plus || CompilerOptions.VERSION_12.equals(specVersion);
isJRE11Plus = isJRE12Plus || CompilerOptions.VERSION_11.equals(specVersion);
isJRE9Plus = isJRE11Plus || CompilerOptions.VERSION_9.equals(specVersion)
|| CompilerOptions.VERSION_10.equals(specVersion);
@@ -449,6 +470,8 @@ public class AbstractCompilerTest extends TestCase {
possibleComplianceLevels |= F_11;
} else if (CompilerOptions.VERSION_12.equals(compliance)) {
possibleComplianceLevels |= F_12;
+ } else if (CompilerOptions.VERSION_13.equals(compliance)) {
+ possibleComplianceLevels |= F_13;
} else {
System.out.println("Ignoring invalid compliance (" + compliance + ")");
System.out.print("Use one of ");
@@ -462,7 +485,8 @@ public class AbstractCompilerTest extends TestCase {
System.out.print(CompilerOptions.VERSION_9 + ", ");
System.out.print(CompilerOptions.VERSION_10 + ", ");
System.out.print(CompilerOptions.VERSION_11 + ", ");
- System.out.println(CompilerOptions.VERSION_12);
+ System.out.print(CompilerOptions.VERSION_12 + ", ");
+ System.out.println(CompilerOptions.VERSION_13);
}
}
if (possibleComplianceLevels == 0) {
@@ -512,6 +536,10 @@ public class AbstractCompilerTest extends TestCase {
if (canRun12) {
possibleComplianceLevels |= F_12;
}
+ boolean canRun13 = canRun11 && !CompilerOptions.VERSION_12.equals(specVersion);
+ if (canRun13) {
+ possibleComplianceLevels |= F_13;
+ }
} else if ("1.0".equals(specVersion)
|| CompilerOptions.VERSION_1_1.equals(specVersion)
|| CompilerOptions.VERSION_1_2.equals(specVersion)
@@ -534,6 +562,9 @@ public class AbstractCompilerTest extends TestCase {
possibleComplianceLevels |= F_11;
if (!CompilerOptions.VERSION_11.equals(specVersion)) {
possibleComplianceLevels |= F_12;
+ if (!CompilerOptions.VERSION_12.equals(specVersion)) {
+ possibleComplianceLevels |= F_13;
+ }
}
}
}
@@ -709,7 +740,7 @@ public class AbstractCompilerTest extends TestCase {
}
protected static String getVersionString(long compliance) {
- String version = "version 11 : 55.0";
+ String version = "version 13 : 55.0";
if (compliance < ClassFileConstants.JDK9) return "version 1.8 : 52.0";
if (compliance == ClassFileConstants.JDK9) return "version 9 : 53.0";
if (compliance == ClassFileConstants.JDK10) return "version 10 : 54.0";
@@ -718,7 +749,7 @@ public class AbstractCompilerTest extends TestCase {
int major = Integer.parseInt(ver) + ClassFileConstants.MAJOR_VERSION_0;
return "version " + ver + " : " + major + ".0";
}
- if (compliance >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_11)) return version; // keep this stmt for search for next bump up
+ if (compliance >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_13)) return version; // keep this stmt for search for next bump up
return version;
}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
index 7a08126d5b..044578d438 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
@@ -31,6 +31,8 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.zip.ZipFile;
+import javax.lang.model.SourceVersion;
+
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
@@ -168,9 +170,13 @@ public class FileSystem implements IModuleAwareNameEnvironment, SuffixConstants
/** Tasks resulting from --add-reads or --add-exports command line options. */
Map<String,UpdatesByKind> moduleUpdates = new HashMap<>();
- static final boolean isJRE12Plus;
+ static boolean isJRE12Plus = false;
static {
- isJRE12Plus = CompilerOptions.VERSION_12.equals(System.getProperty("java.specification.version")); //$NON-NLS-1$
+ try {
+ isJRE12Plus = SourceVersion.valueOf("RELEASE_12") != null; //$NON-NLS-1$
+ } catch(IllegalArgumentException iae) {
+ // fall back to default
+ }
}
/*
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
index 6ab938c1e0..dde2308286 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
@@ -129,9 +129,10 @@ public interface ClassFileConstants {
int MAJOR_VERSION_10 = 54;
int MAJOR_VERSION_11 = 55;
int MAJOR_VERSION_12 = 56;
+ int MAJOR_VERSION_13 = 57;
int MAJOR_VERSION_0 = 44;
- int MAJOR_LATEST_VERSION = MAJOR_VERSION_12;
+ int MAJOR_LATEST_VERSION = MAJOR_VERSION_13;
int MINOR_VERSION_0 = 0;
int MINOR_VERSION_1 = 1;
@@ -154,6 +155,7 @@ public interface ClassFileConstants {
long JDK10 = ((long)ClassFileConstants.MAJOR_VERSION_10 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK11 = ((long)ClassFileConstants.MAJOR_VERSION_11 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK12 = ((long)ClassFileConstants.MAJOR_VERSION_12 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK13 = ((long)ClassFileConstants.MAJOR_VERSION_13 << 16) + ClassFileConstants.MINOR_VERSION_0;
public static long getLatestJDKLevel() {
return ((long)ClassFileConstants.MAJOR_LATEST_VERSION << 16) + ClassFileConstants.MINOR_VERSION_0;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index 5fda6a7089..aa08920585 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -229,6 +229,7 @@ public class CompilerOptions {
public static final String VERSION_10 = "10"; //$NON-NLS-1$
public static final String VERSION_11 = "11"; //$NON-NLS-1$
public static final String VERSION_12 = "12"; //$NON-NLS-1$
+ public static final String VERSION_13 = "13"; //$NON-NLS-1$
/*
* Note: Whenever a new version is added, make sure getLatestVersion()
* is updated with it.
@@ -597,7 +598,7 @@ public class CompilerOptions {
* Return the latest Java language version supported by the Eclipse compiler
*/
public static String getLatestVersion() {
- return VERSION_12;
+ return VERSION_13;
}
/**
* Return the most specific option key controlling this irritant. Note that in some case, some irritant is controlled by
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index eccd28957d..c790166067 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -3059,12 +3059,18 @@ public final class JavaCore extends Plugin {
public static final String VERSION_12 = "12"; //$NON-NLS-1$
/**
* Configurable option value: {@value}.
+ * @since 3.18 BETA_JAVA12
+ * @category OptionValue
+ */
+ public static final String VERSION_13 = "13"; //$NON-NLS-1$
+ /**
+ * Configurable option value: {@value}.
* @since 3.4
* @category OptionValue
*/
public static final String VERSION_CLDC_1_1 = "cldc1.1"; //$NON-NLS-1$
private static List<String> allVersions = Arrays.asList(VERSION_CLDC_1_1, VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5,
- VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12);
+ VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13);
/**
* Returns all {@link JavaCore}{@code #VERSION_*} levels in the order of their

Back to the top