Merge remote-tracking branch 'origin/master' into BETA_JAVA_12
Change-Id: Ibf50d6bdc251efb9404f80eabfb1bdac6a289452
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 f993432..abb9da4 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
@@ -6,6 +6,10 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/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.
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -205,6 +209,8 @@
String version = vMInstall.getJavaVersion();
if (version == null) {
return null;
+ } else if (version.startsWith(JavaCore.VERSION_12)) {
+ return JavaCore.VERSION_12;
} else if (version.startsWith(JavaCore.VERSION_11)) {
return JavaCore.VERSION_11;
} else if (version.startsWith(JavaCore.VERSION_10)) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java
index 5e02129..ad3b50b 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMDebugger.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -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
* Alex Smirnoff - Bug 289916
@@ -231,6 +235,11 @@
arguments.add(convertClassPath(cp));
}
+ // https://openjdk.java.net/jeps/12
+ if (config.isPreviewEnabled()) {
+ arguments.add("--enable-preview"); //$NON-NLS-1$
+ }
+
String dependencies = config.getOverrideDependencies();
if (dependencies != null && dependencies.length() > 0) {
String[] parseArguments = DebugPlugin.parseArguments(dependencies);
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
index ee8f9e7..6c9603e 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/StandardVMRunner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -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
*******************************************************************************/
@@ -442,6 +446,11 @@
arguments.add(convertClassPath(cp));
}
+ // https://openjdk.java.net/jeps/12
+ if (config.isPreviewEnabled()) {
+ arguments.add("--enable-preview"); //$NON-NLS-1$
+ }
+
String dependencies = config.getOverrideDependencies();
if (dependencies != null && dependencies.length() > 0) {
String[] parseArguments = DebugPlugin.parseArguments(dependencies);
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 ea5d9ef..25f6407 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
@@ -6,6 +6,10 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/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.
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -844,7 +848,10 @@
*/
public static URL getDefaultJavadocLocation(String version) {
try {
- if (version.startsWith(JavaCore.VERSION_11)) {
+ if (version.startsWith(JavaCore.VERSION_12)) {
+ // No URL yet for 12
+ return new URL("https://docs.oracle.com/en/java/javase/11/docs/api/"); //$NON-NLS-1$
+ } else if (version.startsWith(JavaCore.VERSION_11)) {
return new URL("https://docs.oracle.com/en/java/javase/11/docs/api/"); //$NON-NLS-1$
} else if (version.startsWith(JavaCore.VERSION_10)) {
return new URL("https://docs.oracle.com/javase/10/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 61cc15c..feaeefd 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
@@ -6,6 +6,10 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/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.
+ *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -196,7 +200,9 @@
private String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
String desc = executionEnvironment.getId();
- if (desc.indexOf(JavaCore.VERSION_11) != -1) {
+ if (desc.indexOf(JavaCore.VERSION_12) != -1) {
+ return JavaCore.VERSION_12;
+ } else if (desc.indexOf(JavaCore.VERSION_11) != -1) {
return JavaCore.VERSION_11;
} else if (desc.indexOf(JavaCore.VERSION_10) != -1) {
return JavaCore.VERSION_10;
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 3e9ff14..17cfb66 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2018 IBM Corporation and others.
+ * Copyright (c) 2005, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -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
*******************************************************************************/
@@ -461,16 +465,21 @@
return null;
}
} else {
- if (getCompliance() == null) {
+ String compliance = getCompliance();
+ if (compliance == null) {
return null;
}
- profile.setProperty(JavaCore.COMPILER_COMPLIANCE, getCompliance());
- profile.setProperty(JavaCore.COMPILER_SOURCE, getCompliance());
- profile.setProperty(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, getCompliance());
- profile.setProperty("org.eclipse.jdt.core.compiler.problem.assertIdentifier", "error"); //$NON-NLS-1$ //$NON-NLS-2$
- profile.setProperty("org.eclipse.jdt.core.compiler.problem.enumIdentifier", "error"); //$NON-NLS-1$ //$NON-NLS-2$
- profile.setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, calculateVMExecutionEnvs(new Version(getCompliance())));
+ profile.setProperty(JavaCore.COMPILER_COMPLIANCE, compliance);
+ profile.setProperty(JavaCore.COMPILER_SOURCE, compliance);
+ profile.setProperty(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, compliance);
+ profile.setProperty(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
+ profile.setProperty(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
+ profile.setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, calculateVMExecutionEnvs(new Version(compliance)));
profile.setProperty(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED);
+ if (JavaCore.compareJavaVersions(compliance, JavaCore.VERSION_10) > 0) {
+ profile.setProperty(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.DISABLED);
+ profile.setProperty(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.WARNING);
+ }
}
return profile;
@@ -558,4 +567,9 @@
private String getCompliance() {
return fElement.getAttribute("compliance"); //$NON-NLS-1$
}
+
+ @Override
+ public String toString() {
+ return this.fElement.getAttribute("id"); //$NON-NLS-1$
+ }
}
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 2dada27..744fee9 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
@@ -41,6 +41,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_12 = "JavaSE-12"; //$NON-NLS-1$
private static final String JavaSE_11 = "JavaSE-11"; //$NON-NLS-1$
private static final String JavaSE_10_Plus = "JavaSE-10+"; //$NON-NLS-1$
private static final String JavaSE_10 = "JavaSE-10"; //$NON-NLS-1$
@@ -87,6 +88,7 @@
mappings.put(JavaSE_10, new String[] { JavaSE_9 });
mappings.put(JavaSE_10_Plus, new String[] { JavaSE_11 });
mappings.put(JavaSE_11, new String[] { JavaSE_10 });
+ mappings.put(JavaSE_12, new String[] { JavaSE_11 });
}
@Override
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
@@ -112,7 +114,9 @@
types = getTypes(CDC_FOUNDATION_1_1);
}
} else {
- if (javaVersion.startsWith("11")) { //$NON-NLS-1$
+ if (javaVersion.startsWith("12")) { //$NON-NLS-1$
+ types = getTypes(JavaSE_12);
+ } else if (javaVersion.startsWith("11")) { //$NON-NLS-1$
types = getTypes(JavaSE_11);
} else if (javaVersion.startsWith("10")) { //$NON-NLS-1$
types = getTypes(JavaSE_10);
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java
index af4763f..022ee00 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/AbstractJavaLaunchConfigurationDelegate.java
@@ -1206,4 +1206,22 @@
return true;
}
+ /**
+ * Supports Preview Features for launching.
+ *
+ * @since 3.13
+ */
+ protected boolean supportsPreviewFeatures(ILaunchConfiguration configuration) {
+ try {
+ IJavaProject javaProject = getJavaProject(configuration);
+ String id = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ if (JavaCore.ENABLED.equals(id)) {
+ return true;
+ }
+ } catch (CoreException e) {
+ // Not a java project
+ }
+ return false;
+ }
+
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java
index aff1441..b2e296f 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/JavaLaunchDelegate.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
*******************************************************************************/
@@ -97,6 +101,7 @@
runConfig.setVMArguments(execArgs.getVMArgumentsArray());
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+ runConfig.setPreviewEnabled(supportsPreviewFeatures(configuration));
if (supportsModule()) {
// current module name, if so
try {
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 9d4a144..1b637af 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
@@ -3300,8 +3300,11 @@
} else if (javaVersion.startsWith(JavaCore.VERSION_11)
&& (javaVersion.length() == JavaCore.VERSION_11.length() || javaVersion.charAt(JavaCore.VERSION_11.length()) == '.')) {
compliance = JavaCore.VERSION_11;
+ } else if (javaVersion.startsWith(JavaCore.VERSION_12)
+ && (javaVersion.length() == JavaCore.VERSION_12.length() || javaVersion.charAt(JavaCore.VERSION_12.length()) == '.')) {
+ compliance = JavaCore.VERSION_12;
} else {
- compliance = JavaCore.VERSION_11; // use latest by default
+ compliance = JavaCore.VERSION_12; // use latest by default
}
Hashtable<String, String> options= JavaCore.getOptions();
@@ -3314,6 +3317,10 @@
equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, options, bundleDefaults) &&
equals(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, options, bundleDefaults) &&
equals(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, options, bundleDefaults);
+ if (JavaCore.compareJavaVersions(compliance, JavaCore.VERSION_10) > 0) {
+ isDefault = isDefault && equals(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, options, bundleDefaults)
+ && equals(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, options, bundleDefaults);
+ }
// only update the compliance settings if they are default settings, otherwise the
// settings have already been modified by a tool or user
if (isDefault) {
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java
index 7ec9695..064e3cf 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/VMRunnerConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -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
*******************************************************************************/
@@ -38,6 +42,7 @@
private String fModuleDescription;
private String fWorkingDirectory;
private String fOverrideDependencies;
+ private Boolean fPreviewEnabled = false;
private Map<String, Object> fVMSpecificAttributesMap;
private boolean fResume = true;
@@ -315,7 +320,7 @@
/**
* Gets the fOverrideDependencies.
- *
+ *
* @return the fOverrideDependencies
* @since 3.10
*/
@@ -325,7 +330,7 @@
/**
* Sets the fOverrideDependencies.
- *
+ *
* @param fOverrideDependencies
* the fOverrideDependencies to set
* @since 3.10
@@ -334,4 +339,25 @@
this.fOverrideDependencies = fOverrideDependencies;
}
+ /**
+ * Gets the fPreviewEnabled.
+ *
+ * @return the fPreviewEnabled
+ * @since 3.13
+ */
+ public boolean isPreviewEnabled() {
+ return fPreviewEnabled;
+ }
+
+ /**
+ * Sets the fPreviewEnabled.
+ *
+ * @param fPreviewEnabled
+ * the fPreviewEnabled to set
+ * @since 3.13
+ */
+ public void setPreviewEnabled(boolean fPreviewEnabled) {
+ this.fPreviewEnabled = fPreviewEnabled;
+ }
+
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/CompatibleEnvironment.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/CompatibleEnvironment.java
index e016a55..38c61d8 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/CompatibleEnvironment.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/environments/CompatibleEnvironment.java
@@ -70,4 +70,9 @@
public boolean isStrictlyCompatbile() {
return fIsStrictlyCompatible;
}
+
+ @Override
+ public String toString() {
+ return this.fEnvironment.toString();
+ }
}
diff --git a/org.eclipse.jdt.launching/plugin.properties b/org.eclipse.jdt.launching/plugin.properties
index 4446de0..8a75940 100644
--- a/org.eclipse.jdt.launching/plugin.properties
+++ b/org.eclipse.jdt.launching/plugin.properties
@@ -7,7 +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
###############################################################################
@@ -73,6 +75,7 @@
environment.description.13 = Java Platform, Standard Edition 9
environment.description.14 = Java Platform, Standard Edition 10
environment.description.15 = Java Platform, Standard Edition 11
+environment.description.16 = Java Platform, Standard Edition 12
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 1d41359..2c0e841 100644
--- a/org.eclipse.jdt.launching/plugin.xml
+++ b/org.eclipse.jdt.launching/plugin.xml
@@ -10,6 +10,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
-->
@@ -331,7 +335,12 @@
description="%environment.description.15"
id="JavaSE-11"
compliance="11">
- </environment>
+ </environment>
+ <environment
+ description="%environment.description.16"
+ id="JavaSE-12"
+ compliance="12">
+ </environment>
<analyzer
class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"
id="org.eclipse.jdt.launching.eeAnalyzer"/>