Skip to content

Commit

Permalink
[23] Add Execution Environment for JavaSE-23 eclipse-jdt#419
Browse files Browse the repository at this point in the history
  • Loading branch information
jarthana committed Apr 3, 2024
1 parent 98ce5c4 commit 155617c
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 6 deletions.
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_23)) {
return JavaCore.VERSION_23;
} else if (version.startsWith(JavaCore.VERSION_22)) {
return JavaCore.VERSION_22;
} else if (version.startsWith(JavaCore.VERSION_21)) {
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 @@ -845,8 +849,10 @@ public URL getDefaultJavadocLocation(File installLocation) {
*/
public static URL getDefaultJavadocLocation(String version) {
try {
if (version.startsWith(JavaCore.VERSION_22)) {
// To modify to version 22 after the release
if (version.startsWith(JavaCore.VERSION_23)) {
// To modify to version 23 after the release
return new URL("https://docs.oracle.com/en/java/javase/22/docs/api/"); //$NON-NLS-1$
} else if (version.startsWith(JavaCore.VERSION_22)) {
return new URL("https://docs.oracle.com/en/java/javase/22/docs/api/"); //$NON-NLS-1$
} else if (version.startsWith(JavaCore.VERSION_21)) {
return new URL("https://docs.oracle.com/en/java/javase/21/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_22) != -1) {
if (desc.indexOf(JavaCore.VERSION_23) != -1) {
return JavaCore.VERSION_23;
} else if (desc.indexOf(JavaCore.VERSION_22) != -1) {
return JavaCore.VERSION_22;
} else if (desc.indexOf(JavaCore.VERSION_21) != -1) {
return JavaCore.VERSION_21;
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 @@ -41,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_23 = "JavaSE-23"; //$NON-NLS-1$
private static final String JavaSE_22 = "JavaSE-22"; //$NON-NLS-1$
private static final String JavaSE_21 = "JavaSE-21"; //$NON-NLS-1$
private static final String JavaSE_20 = "JavaSE-20"; //$NON-NLS-1$
Expand Down Expand Up @@ -96,7 +101,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_22 });
mappings.put(JavaSE_10_Plus, new String[] { JavaSE_23 });
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 @@ -109,6 +114,7 @@ public class ExecutionEnvironmentAnalyzer implements IExecutionEnvironmentAnalyz
mappings.put(JavaSE_20, new String[] { JavaSE_19 });
mappings.put(JavaSE_21, new String[] { JavaSE_20 });
mappings.put(JavaSE_22, new String[] { JavaSE_21 });
mappings.put(JavaSE_23, new String[] { JavaSE_22 });
}
@Override
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException {
Expand All @@ -134,7 +140,9 @@ public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor)
types = getTypes(CDC_FOUNDATION_1_1);
}
} else {
if (javaVersion.startsWith("22")) { //$NON-NLS-1$
if (javaVersion.startsWith("23")) { //$NON-NLS-1$
types = getTypes(JavaSE_23);
} else if (javaVersion.startsWith("22")) { //$NON-NLS-1$
types = getTypes(JavaSE_22);
} else if (javaVersion.startsWith("21")) { //$NON-NLS-1$
types = getTypes(JavaSE_21);
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 @@ -3373,6 +3377,9 @@ private static void updateCompliance(IVMInstall vm) {
} else if (javaVersion.startsWith(JavaCore.VERSION_22)
&& (javaVersion.length() == JavaCore.VERSION_22.length() || javaVersion.charAt(JavaCore.VERSION_22.length()) == '.')) {
compliance = JavaCore.VERSION_22;
} else if (javaVersion.startsWith(JavaCore.VERSION_23)
&& (javaVersion.length() == JavaCore.VERSION_23.length() || javaVersion.charAt(JavaCore.VERSION_23.length()) == '.')) {
compliance = JavaCore.VERSION_23;
} else {
compliance = JavaCore.VERSION_22; // use latest by default
}
Expand Down
7 changes: 6 additions & 1 deletion org.eclipse.jdt.launching/plugin.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2000, 202 IBM Corporation and others.
# Copyright (c) 2000, 2024 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -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 @@ -84,6 +88,7 @@ environment.description.23 = Java Platform, Standard Edition 19
environment.description.24 = Java Platform, Standard Edition 20
environment.description.25 = Java Platform, Standard Edition 21
environment.description.26 = Java Platform, Standard Edition 22
environment.description.27 = Java Platform, Standard Edition 23

classpathVariableInitializer.deprecated = Use the JRE System Library instead

Expand Down
10 changes: 10 additions & 0 deletions org.eclipse.jdt.launching/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
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 @@ -388,6 +393,11 @@
id="JavaSE-22"
compliance="22">
</environment>
<environment
description="%environment.description.27"
id="JavaSE-23"
compliance="23">
</environment>
<analyzer
class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer"
id="org.eclipse.jdt.launching.eeAnalyzer"/>
Expand Down

0 comments on commit 155617c

Please sign in to comment.