Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21] Add Execution Environment for JavaSE-21 #236

Merged
merged 2 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
*******************************************************************************/
Expand Down Expand Up @@ -234,6 +238,8 @@ public static String getCompilerCompliance(IVMInstall2 vMInstall) {
String version = vMInstall.getJavaVersion();
if (version == null) {
return null;
} else if (version.startsWith(JavaCore.VERSION_21)) {
return JavaCore.VERSION_21;
} else if (version.startsWith(JavaCore.VERSION_20)) {
return JavaCore.VERSION_20;
} else if (version.startsWith(JavaCore.VERSION_19)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
* Michael Allman - Bug 211648, Bug 156343 - Standard VM not supported on MacOS
Expand Down Expand Up @@ -846,7 +850,9 @@ public URL getDefaultJavadocLocation(File installLocation) {
*/
public static URL getDefaultJavadocLocation(String version) {
try {
if (version.startsWith(JavaCore.VERSION_20)) {
if (version.startsWith(JavaCore.VERSION_21)) {
return new URL("https://docs.oracle.com/en/java/javase/20/docs/api/"); //$NON-NLS-1$
} else if (version.startsWith(JavaCore.VERSION_20)) {
return new URL("https://docs.oracle.com/en/java/javase/20/docs/api/"); //$NON-NLS-1$
} else if (version.startsWith(JavaCore.VERSION_19)) {
return new URL("https://docs.oracle.com/en/java/javase/19/docs/api/"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -196,7 +200,9 @@ public synchronized Analyzer[] getAnalyzers() {

private String getExecutionEnvironmentCompliance(IExecutionEnvironment executionEnvironment) {
String desc = executionEnvironment.getId();
if (desc.indexOf(JavaCore.VERSION_20) != -1) {
if (desc.indexOf(JavaCore.VERSION_21) != -1) {
return JavaCore.VERSION_21;
} else if (desc.indexOf(JavaCore.VERSION_20) != -1) {
return JavaCore.VERSION_20;
} else if (desc.indexOf(JavaCore.VERSION_19) != -1) {
return JavaCore.VERSION_19;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
* 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
*
Expand Down Expand Up @@ -40,6 +45,7 @@ public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyz

// XXX: Note that this string is not yet standardized by OSGi, see http://wiki.osgi.org/wiki/Execution_Environment

private static final String JavaSE_21 = "JavaSE-21"; //$NON-NLS-1$
private static final String JavaSE_20 = "JavaSE-20"; //$NON-NLS-1$
private static final String JavaSE_19 = "JavaSE-19"; //$NON-NLS-1$
private static final String JavaSE_18 = "JavaSE-18"; //$NON-NLS-1$
Expand Down Expand Up @@ -93,7 +99,7 @@ public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyz
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_20 });
mappings.put(JavaSE_10_Plus, new String[] { JavaSE_21 });
mappings.put(JavaSE_11, new String[] { JavaSE_10 });
mappings.put(JavaSE_12, new String[] { JavaSE_11 });
mappings.put(JavaSE_13, new String[] { JavaSE_12 });
Expand All @@ -104,6 +110,7 @@ public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyz
mappings.put(JavaSE_18, new String[] { JavaSE_17 });
jarthana marked this conversation as resolved.
Show resolved Hide resolved
mappings.put(JavaSE_19, new String[] { JavaSE_18 });
mappings.put(JavaSE_20, new String[] { JavaSE_19 });
mappings.put(JavaSE_21, new String[] { JavaSE_20 });
}
@Override
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
Expand All @@ -129,7 +136,9 @@ public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor)
types = getTypes(CDC_FOUNDATION_1_1);
}
} else {
if (javaVersion.startsWith("20")) { //$NON-NLS-1$
if (javaVersion.startsWith("21")) { //$NON-NLS-1$
types = getTypes(JavaSE_21);
} else if (javaVersion.startsWith("20")) { //$NON-NLS-1$
types = getTypes(JavaSE_20);
} else if (javaVersion.startsWith("19")) { //$NON-NLS-1$
types = getTypes(JavaSE_19);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
* Frits Jalvingh - Contribution for Bug 459831 - [launching] Support attaching
Expand Down Expand Up @@ -3362,8 +3366,11 @@ private static void updateCompliance(IVMInstall vm) {
} else if (javaVersion.startsWith(JavaCore.VERSION_20)
&& (javaVersion.length() == JavaCore.VERSION_20.length() || javaVersion.charAt(JavaCore.VERSION_20.length()) == '.')) {
compliance = JavaCore.VERSION_20;
} else if (javaVersion.startsWith(JavaCore.VERSION_21)
&& (javaVersion.length() == JavaCore.VERSION_21.length() || javaVersion.charAt(JavaCore.VERSION_21.length()) == '.')) {
compliance = JavaCore.VERSION_21;
} else {
compliance = JavaCore.VERSION_20; // use latest by default
compliance = JavaCore.VERSION_21; // use latest by default
}

Hashtable<String, String> options= JavaCore.getOptions();
Expand Down
5 changes: 5 additions & 0 deletions org.eclipse.jdt.launching/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
###############################################################################
Expand Down Expand Up @@ -82,6 +86,7 @@ environment.description.21 = Java Platform, Standard Edition 17
environment.description.22 = Java Platform, Standard Edition 18
environment.description.23 = Java Platform, Standard Edition 19
environment.description.24 = Java Platform, Standard Edition 20
environment.description.25 = Java Platform, Standard Edition 21

classpathVariableInitializer.deprecated = Use the JRE System Library instead

Expand Down
11 changes: 10 additions & 1 deletion org.eclipse.jdt.launching/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
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
-->
Expand Down Expand Up @@ -378,6 +382,11 @@
id="JavaSE-20"
compliance="20">
</environment>
<environment
description="%environment.description.25"
id="JavaSE-21"
compliance="21">
</environment>
<analyzer
class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"
id="org.eclipse.jdt.launching.eeAnalyzer"/>
Expand Down