Merge remote-tracking branch 'origin/master' into BETA_JAVA9
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 fd11dd8..af27523 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
@@ -423,6 +423,18 @@
 			// Add all endorsed libraries - they are first, as they replace
 			allLibs = new ArrayList<LibraryLocation>(gatherAllLibraries(libInfo.getEndorsedDirs()));
 			
+			if (libInfo.getBootpath().length == 0) {
+				// TODO: Bug 489207: Temporary workaround for Jigsaw-previews that don't declare a bootpath.
+				// JDT Core currently requires a non-empty library path, so let's give it jrt-fs.jar as a stand-in for now.
+				// Code referencing org.eclipse.jdt.internal.compiler.util.JimageUtil.JRT_FS_JAR looks for this file.
+				LibraryLocation libraryLocation = new LibraryLocation(
+						new Path(installLocation.getAbsolutePath()).append("jrt-fs.jar"), //$NON-NLS-1$
+							Path.EMPTY, 
+							getDefaultPackageRootPath(), 
+							getDefaultJavadocLocation(installLocation));
+				allLibs.add(libraryLocation);
+			}
+			
 			// next is the boot path libraries
 			String[] bootpath = libInfo.getBootpath();
 			List<LibraryLocation> boot = new ArrayList<LibraryLocation>(bootpath.length);
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java
index 26f9738..0a34e83 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironment.java
@@ -5,6 +5,10 @@
  *  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
  *******************************************************************************/
@@ -451,6 +455,7 @@
 				if (is != null) {
 					Properties profile = new Properties();
 					profile.load(is);
+					fixJavaSE19SourceTargetLevels(profile);
 					return profile;
 				}
 			} catch (IOException e) {
@@ -459,6 +464,14 @@
 		return null;
 	}
 
+	private void fixJavaSE19SourceTargetLevels(Properties profile) {
+		if (!ExecutionEnvironmentAnalyzer.JavaSE_1_9.equals(getId())) {
+			return;
+		}
+		profile.setProperty(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); // TODO: at the moment, there's no new Java language feature
+		profile.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8); // TODO: at the moment, runtime doesn't support a new class file version
+	}
+
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.launching.environments.IExecutionEnvironment#getSubEnvironments()
 	 */
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 f815314..3decaa6 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
@@ -1,10 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2016 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
  *******************************************************************************/
@@ -18,10 +22,8 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
-
 import org.eclipse.jdt.internal.launching.EEVMInstall;
 import org.eclipse.jdt.internal.launching.EEVMType;
-
 import org.eclipse.jdt.launching.IVMInstall;
 import org.eclipse.jdt.launching.IVMInstall2;
 import org.eclipse.jdt.launching.IVMInstall3;
@@ -38,6 +40,7 @@
 public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyzerDelegate {
 	
 	// XXX: Note that this string is not yet standardized by OSGi, see http://wiki.osgi.org/wiki/Execution_Environment
+	static final String JavaSE_1_9 = "JavaSE-9"; //$NON-NLS-1$
 	private static final String JavaSE_1_8 = "JavaSE-1.8"; //$NON-NLS-1$
 
 	private static final String JavaSE_1_7 = "JavaSE-1.7"; //$NON-NLS-1$
@@ -76,6 +79,7 @@
 		mappings.put(JavaSE_1_6, new String[] {J2SE_1_5});
 		mappings.put(JavaSE_1_7, new String[] {JavaSE_1_6});
 		mappings.put(JavaSE_1_8, new String[] { JavaSE_1_7 });
+		mappings.put(JavaSE_1_9, new String[] { JavaSE_1_8 });
 	}
 	@Override
 	public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
@@ -101,7 +105,9 @@
 					types = getTypes(CDC_FOUNDATION_1_1);
 				}
 			} else {
-				if (javaVersion.startsWith("1.8")) { //$NON-NLS-1$
+				if (javaVersion.startsWith("9")) { //$NON-NLS-1$
+					types = getTypes(JavaSE_1_9);
+				} else if (javaVersion.startsWith("1.8")) { //$NON-NLS-1$
 					types = getTypes(JavaSE_1_8);
 				} else if (javaVersion.startsWith("1.7")) { //$NON-NLS-1$
 					types = getTypes(JavaSE_1_7);
diff --git a/org.eclipse.jdt.launching/plugin.properties b/org.eclipse.jdt.launching/plugin.properties
index 5d024d7..792acb3 100644
--- a/org.eclipse.jdt.launching/plugin.properties
+++ b/org.eclipse.jdt.launching/plugin.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2014 IBM Corporation and others.
+# Copyright (c) 2000, 2016 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
@@ -58,6 +58,7 @@
 environment.description.9 = Java Platform, Standard Edition 6.0
 environment.description.11 = Java Platform, Standard Edition 7.0
 environment.description.12 = Java Platform, Standard Edition 8.0
+environment.description.13 = Java Platform, Standard Edition 9
 
 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 81d9bb0..a16e355 100644
--- a/org.eclipse.jdt.launching/plugin.xml
+++ b/org.eclipse.jdt.launching/plugin.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.0"?>
 <!--
-     Copyright (c) 2005, 2014 IBM Corporation and others.
+     Copyright (c) 2005, 2016 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
@@ -292,6 +292,11 @@
             description="%environment.description.12"
             id="JavaSE-1.8"
             ruleParticipant="org.eclipse.jdt.internal.launching.environments.DefaultAccessRuleParticipant">
+      </environment>
+      <environment
+            description="%environment.description.13"
+            id="JavaSE-9"
+            ruleParticipant="org.eclipse.jdt.internal.launching.environments.DefaultAccessRuleParticipant">
       </environment>            
       <analyzer
             class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"