Bug 531333 - [18.3][batch][compiler] compliance version not recognized
in internal.batch.Main
Change-Id: I7185fff34ffe94f378e9284f3c0dbe762405a9e4
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 3d1fa6c..9dc19cd 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
@@ -239,6 +239,8 @@
this.version = JavaCore.VERSION_1_8;
} else if(rawVersion.startsWith("9")) {
this.version = JavaCore.VERSION_9;
+ } else if(rawVersion.startsWith("10")) {
+ this.version = JavaCore.VERSION_10;
} else {
throw new RuntimeException("unknown javac version: " + rawVersion);
}
@@ -332,6 +334,9 @@
if (version == JavaCore.VERSION_9) {
return 0000; // We are still in EA
}
+ if (version == JavaCore.VERSION_10) {
+ return 0000; // We are still in EA
+ }
throw new RuntimeException("unknown raw javac version: " + rawVersion);
}
// returns 0L if everything went fine; else the lower word contains the
@@ -1064,6 +1069,8 @@
buffer.append("\" -1.8 " + processAnnot);
} else if (this.complianceLevel == ClassFileConstants.JDK9) {
buffer.append("\" -9 " + processAnnot);
+ } else if (this.complianceLevel == ClassFileConstants.JDK10) {
+ buffer.append("\" -10 " + processAnnot);
}
buffer
.append(" -preserveAllLocals -proceedOnError -nowarn -g -classpath \"")
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
index 9a9a5ac..94c52a2 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
@@ -1859,6 +1859,12 @@
options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_9);
options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_9);
javaProject.setOptions(options);
+ } else if ("10".equals(compliance)) {
+ Map options = new HashMap();
+ options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_10);
+ options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_10);
+ options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_10);
+ javaProject.setOptions(options);
}
result[0] = javaProject;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java
index f8e2834..a3fad98 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaConventionTests.java
@@ -96,6 +96,7 @@
CompilerOptions.VERSION_1_7,
CompilerOptions.VERSION_1_8,
CompilerOptions.VERSION_9,
+ CompilerOptions.VERSION_10,
};
/*
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index 7918c62..0850d6a 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1741,6 +1741,8 @@
return ClassFileConstants.JDK1_8 >= minimalSupportedVersion;
case ClassFileConstants.MAJOR_VERSION_9: // 9
return ClassFileConstants.JDK9 >= minimalSupportedVersion;
+ case ClassFileConstants.MAJOR_VERSION_10: // 9
+ return ClassFileConstants.JDK10 >= minimalSupportedVersion;
}
// unknown version
return false;
@@ -2167,6 +2169,16 @@
mode = DEFAULT;
continue;
}
+ if (currentArg.equals("-1.10") || currentArg.equals("-10") || currentArg.equals("-10.0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (didSpecifyCompliance) {
+ throw new IllegalArgumentException(
+ this.bind("configure.duplicateCompliance", currentArg)); //$NON-NLS-1$
+ }
+ didSpecifyCompliance = true;
+ this.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_10);
+ mode = DEFAULT;
+ continue;
+ }
if (currentArg.equals("-d")) { //$NON-NLS-1$
if (this.destinationPath != null) {
StringBuffer errorMessage = new StringBuffer();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 7f1cd5d..10b4886 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -1,10 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * 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
* Theodora Yeung (tyeung@bea.com) - ensure that JarPackageFragmentRoot make it into cache
@@ -413,7 +417,7 @@
public static class CompilationParticipants {
- private final static int MAX_SOURCE_LEVEL = 9; // 1.1 to 1.8 and 9
+ private final static int MAX_SOURCE_LEVEL = 10 ; // 1.1 to 1.8 and 9, 10
/*
* The registered compilation participants (a table from int (source level) to Object[])
@@ -563,6 +567,8 @@
return 7;
case ClassFileConstants.MAJOR_VERSION_9:
return 8;
+ case ClassFileConstants.MAJOR_VERSION_10:
+ return 9;
default:
// all other cases including ClassFileConstants.MAJOR_VERSION_1_1
return 0;