Bug 568060 - [16] Add Execution Environment for JavaSE-16

Change-Id: I69c0982732d4898a29c36704404652eb9ebf2c81
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java
index 1ecbd6b..72844b5 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/EECompilationParticipant.java
@@ -7,6 +7,9 @@
  * https://www.eclipse.org/legal/epl-2.0/
  *
  * 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
@@ -232,6 +235,8 @@
 		String version = vMInstall.getJavaVersion();
 		if (version == null) {
 			return null;
+		} else if (version.startsWith(JavaCore.VERSION_16)) {
+			return JavaCore.VERSION_16;
 		} else if (version.startsWith(JavaCore.VERSION_15)) {
 			return JavaCore.VERSION_15;
 		} else if (version.startsWith(JavaCore.VERSION_14)) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
index 0aac5ee..ab8994f 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMType.java
@@ -7,6 +7,10 @@
  * https://www.eclipse.org/legal/epl-2.0/
  *
  * 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
  *     Michael Allman - Bug 211648, Bug 156343 - Standard VM not supported on MacOS
@@ -845,7 +849,10 @@
 	 */
 	public static URL getDefaultJavadocLocation(String version) {
 		try {
-			if (version.startsWith(JavaCore.VERSION_15)) {
+			if (version.startsWith(JavaCore.VERSION_16)) {
+				// TODO: Needs an update after Java 16 release
+				return new URL("https://docs.oracle.com/en/java/javase/15/docs/api/"); //$NON-NLS-1$
+			} else if (version.startsWith(JavaCore.VERSION_15)) {
 				return new URL("https://docs.oracle.com/en/java/javase/15/docs/api/"); //$NON-NLS-1$
 			} else if (version.startsWith(JavaCore.VERSION_14)) {
 				return new URL("https://docs.oracle.com/en/java/javase/14/docs/api/"); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java
index a00de54..3f6e8de 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/EnvironmentsManager.java
@@ -7,6 +7,9 @@
  *  https://www.eclipse.org/legal/epl-2.0/
  *
  *  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
@@ -196,7 +199,9 @@
 
 	private String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
 		String desc = executionEnvironment.getId();
-		if (desc.indexOf(JavaCore.VERSION_15) != -1) {
+		if (desc.indexOf(JavaCore.VERSION_16) != -1) {
+			return JavaCore.VERSION_16;
+		} else if (desc.indexOf(JavaCore.VERSION_15) != -1) {
 			return JavaCore.VERSION_15;
 		} else if (desc.indexOf(JavaCore.VERSION_14) != -1) {
 			return JavaCore.VERSION_14;
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
index 5bd502e..db58fd3 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java
@@ -7,6 +7,9 @@
  * https://www.eclipse.org/legal/epl-2.0/
  *
  * 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
@@ -41,6 +44,7 @@
 
 	// XXX: Note that this string is not yet standardized by OSGi, see http://wiki.osgi.org/wiki/Execution_Environment
 
+	private static final String JavaSE_16 = "JavaSE-16"; //$NON-NLS-1$
 	private static final String JavaSE_15 = "JavaSE-15"; //$NON-NLS-1$
 	private static final String JavaSE_14 = "JavaSE-14"; //$NON-NLS-1$
 	private static final String JavaSE_13 = "JavaSE-13"; //$NON-NLS-1$
@@ -89,12 +93,13 @@
 		mappings.put(JavaSE_1_8, new String[] { JavaSE_1_7 });
 		mappings.put(JavaSE_9, new String[] { JavaSE_1_8 });
 		mappings.put(JavaSE_10, new String[] { JavaSE_9 });
-		mappings.put(JavaSE_10_Plus, new String[] { JavaSE_15 });
+		mappings.put(JavaSE_10_Plus, new String[] { JavaSE_16 });
 		mappings.put(JavaSE_11, new String[] { JavaSE_10 });
 		mappings.put(JavaSE_12, new String[] { JavaSE_11 });
 		mappings.put(JavaSE_13, new String[] { JavaSE_12 });
 		mappings.put(JavaSE_14, new String[] { JavaSE_13 });
 		mappings.put(JavaSE_15, new String[] { JavaSE_14 });
+		mappings.put(JavaSE_16, new String[] { JavaSE_15 });
 	}
 	@Override
 	public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
@@ -120,7 +125,9 @@
 					types = getTypes(CDC_FOUNDATION_1_1);
 				}
 			} else {
-				if (javaVersion.startsWith("15")) { //$NON-NLS-1$
+				if (javaVersion.startsWith("16")) { //$NON-NLS-1$
+					types = getTypes(JavaSE_16);
+				} else if (javaVersion.startsWith("15")) { //$NON-NLS-1$
 					types = getTypes(JavaSE_15);
 				} else if (javaVersion.startsWith("14")) { //$NON-NLS-1$
 					types = getTypes(JavaSE_14);
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
index 1e67439..a9d632d 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaRuntime.java
@@ -7,6 +7,9 @@
  * https://www.eclipse.org/legal/epl-2.0/
  *
  * 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
@@ -3344,8 +3347,11 @@
 				} else if (javaVersion.startsWith(JavaCore.VERSION_15)
 						&& (javaVersion.length() == JavaCore.VERSION_15.length() || javaVersion.charAt(JavaCore.VERSION_15.length()) == '.')) {
 					compliance = JavaCore.VERSION_15;
+				} else if (javaVersion.startsWith(JavaCore.VERSION_16)
+						&& (javaVersion.length() == JavaCore.VERSION_16.length() || javaVersion.charAt(JavaCore.VERSION_16.length()) == '.')) {
+					compliance = JavaCore.VERSION_16;
 				} else {
-					compliance = JavaCore.VERSION_15; // use latest by default
+					compliance = JavaCore.VERSION_16; // use latest by default
 				}
 
             	Hashtable<String, String> options= JavaCore.getOptions();
diff --git a/org.eclipse.jdt.launching/plugin.properties b/org.eclipse.jdt.launching/plugin.properties
index ec8aa5b..294869a 100644
--- a/org.eclipse.jdt.launching/plugin.properties
+++ b/org.eclipse.jdt.launching/plugin.properties
@@ -7,7 +7,10 @@
 # https://www.eclipse.org/legal/epl-2.0/
 # 
 # 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
 ###############################################################################
@@ -77,6 +80,7 @@
 environment.description.17 = Java Platform, Standard Edition 13
 environment.description.18 = Java Platform, Standard Edition 14
 environment.description.19 = Java Platform, Standard Edition 15
+environment.description.20 = Java Platform, Standard Edition 16
 
 classpathVariableInitializer.deprecated = Use the JRE System Library instead
 
diff --git a/org.eclipse.jdt.launching/plugin.xml b/org.eclipse.jdt.launching/plugin.xml
index 9997cfb..ad6aff0 100644
--- a/org.eclipse.jdt.launching/plugin.xml
+++ b/org.eclipse.jdt.launching/plugin.xml
@@ -8,8 +8,11 @@
      which accompanies this distribution, and is available at
      https://www.eclipse.org/legal/epl-2.0/
 
- 	SPDX-License-Identifier: EPL-2.0
- 
+ 	 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
  -->
@@ -352,6 +355,11 @@
             description="%environment.description.19"
             id="JavaSE-15"
             compliance="15">
+      </environment>
+      <environment
+            description="%environment.description.20"
+            id="JavaSE-16"
+            compliance="16">
       </environment>         
       <analyzer
             class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"