Skip to content

Commit

Permalink
Bump minimum required Java Execution Environment from 17 to 21.
Browse files Browse the repository at this point in the history
- Bump bundles to JavaSE-21
- Set default JVM for tests to JavaSE-21

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Jan 8, 2025
1 parent 86e3011 commit e312f88
Show file tree
Hide file tree
Showing 26 changed files with 41 additions and 40 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Features
Requirements
------------

The language server requires a runtime environment of **Java 17** (at a minimum) to run. This should either be set in the `JAVA_HOME` environment variable, or on the user's path.
The language server requires a runtime environment of **Java 21** (at a minimum) to run. This should either be set in the `JAVA_HOME` environment variable, or on the user's path.

Installation
------------
Expand All @@ -52,7 +52,7 @@ There are several options to install eclipse.jdt.ls:
- Download and extract a milestone build from [http://download.eclipse.org/jdtls/milestones/](http://download.eclipse.org/jdtls/milestones/?d)
- Download and extract a snapshot build from [http://download.eclipse.org/jdtls/snapshots/](http://download.eclipse.org/jdtls/snapshots/?d)
- Under some Linux distributions you can use the package manager. Search the package repositories for `jdtls` or `eclipse.jdt.ls`.
- Build it from source. Clone the repository via `git clone` and build the project via `JAVA_HOME=/path/to/java/17 ./mvnw clean verify`. Optionally append `-DskipTests=true` to by-pass the tests. This command builds the server into the `./org.eclipse.jdt.ls.product/target/repository` folder.
- Build it from source. Clone the repository via `git clone` and build the project via `JAVA_HOME=/path/to/java/21 ./mvnw clean verify`. Optionally append `-DskipTests=true` to by-pass the tests. This command builds the server into the `./org.eclipse.jdt.ls.product/target/repository` folder.

Some editors or editor extensions bundle eclipse.jdt.ls or contain logic to install it. If that is the case, you only need to install the editor extension. For example for Visual Studio Code you can install the [Extension Pack for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack) and it will take care of the rest.

Expand Down
2 changes: 1 addition & 1 deletion launch/jdt.ls.remote.server.launch
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.import.generatesMetadataFilesAtProjectRoot=false"/>
Expand Down
2 changes: 1 addition & 1 deletion launch/jdt.ls.socket-stream.launch
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.import.generatesMetadataFilesAtProjectRoot=false"/>
Expand Down
2 changes: 1 addition & 1 deletion launch/jdt.ls.socket-stream.syntaxserver.launch
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.import.generatesMetadataFilesAtProjectRoot=false"/>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.core/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/jsoup-1.14.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/remark-1.2.0.jar"/>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.jdt.ls.core;singleton:=true
Bundle-Version: 1.44.0.qualifier
Bundle-Activator: org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.filesystem/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.filesystem/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.filesystem;bundle-version="1.9.500",
org.eclipse.core.resources;bundle-version="3.18.100",
org.eclipse.jdt.core;bundle-version="3.32.0"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Automatic-Module-Name: org.eclipse.jdt.ls.application
Bundle-ActivationPolicy: lazy
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.logback.appender/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.logback.appender/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Bundle-SymbolicName: org.eclipse.jdt.ls.logback.appender;singleton:=true
Bundle-Version: 1.44.0.qualifier
Fragment-Host: ch.qos.logback.classic
Automatic-Module-Name: org.eclipse.jdt.ls.logback.appender
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.25.0"
Bundle-Vendor: %Bundle-Vendor
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.tests.syntaxserver/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/">
<attributes>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.tests.syntaxserver/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.jdt.ls.tests.syntaxserver;singleton:=true
Bundle-Version: 1.44.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Import-Package: org.osgi.framework;version="1.3.0"
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.tests/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/">
<attributes>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.jdt.ls.tests;singleton:=true
Bundle-Version: 1.44.0.qualifier
Export-Package: org.eclipse.jdt.ls.core.internal;x-friends:="org.eclipse.jdt.ls.tests.syntaxserver"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-RequiredExecutionEnvironment: JavaSE-21
Import-Package: org.osgi.framework;version="1.3.0"
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Expand Down
Empty file.
Binary file removed org.eclipse.jdt.ls.tests/fakejdk2/17a/jrt-fs.jar
Binary file not shown.
Binary file not shown.
8 changes: 0 additions & 8 deletions org.eclipse.jdt.ls.tests/fakejdk2/17a/release

This file was deleted.

Binary file added org.eclipse.jdt.ls.tests/fakejdk2/21a/jrt-fs.jar
Binary file not shown.
9 changes: 9 additions & 0 deletions org.eclipse.jdt.ls.tests/fakejdk2/21a/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
IMPLEMENTOR="Oracle Corporation"
JAVA_RUNTIME_VERSION="21.0.5+9-LTS-239"
JAVA_VERSION="21.0.5"
JAVA_VERSION_DATE="2024-10-15"
LIBC="gnu"
MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.jvmstat jdk.attach jdk.charsets jdk.internal.opt jdk.zipfs jdk.compiler jdk.crypto.ec jdk.crypto.cryptoki jdk.dynalink jdk.internal.ed jdk.editpad jdk.hotspot.agent jdk.httpserver jdk.incubator.vector jdk.internal.le jdk.internal.vm.ci jdk.internal.vm.compiler jdk.internal.vm.compiler.management jdk.jartool jdk.javadoc jdk.jcmd jdk.management jdk.management.agent jdk.jconsole jdk.jdeps jdk.jdwp.agent jdk.jdi jdk.jfr jdk.jlink jdk.jpackage jdk.jshell jdk.jsobject jdk.jstatd jdk.localedata jdk.management.jfr jdk.naming.dns jdk.naming.rmi jdk.net jdk.nio.mapmode jdk.random jdk.sctp jdk.security.auth jdk.security.jgss jdk.unsupported jdk.unsupported.desktop jdk.xml.dom"
OS_ARCH="x86_64"
OS_NAME="Linux"
SOURCE=".:git:b3611976eb3b open:git:f3048f772e06"
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
@RunWith(MockitoJUnitRunner.class)
public class JVMConfiguratorTest extends AbstractInvisibleProjectBasedTest {

private static final String ENVIRONMENT_NAME = "JavaSE-17";
private static final String ENVIRONMENT_NAME = "JavaSE-21";
private IVMInstall originalVm;
private JavaClientConnection javaClient;
@Mock
Expand All @@ -82,9 +82,9 @@ public void setup() throws Exception {
@After
public void cleanUp() throws Exception {
super.cleanUp();
TestVMType.setTestJREAsDefault("17");
TestVMType.setTestJREAsDefault("21");
IVMInstall defaultJRE = JavaRuntime.getDefaultVMInstall();
IExecutionEnvironment environment = JVMConfigurator.getExecutionEnvironment("JavaSE-17");
IExecutionEnvironment environment = JVMConfigurator.getExecutionEnvironment("JavaSE-21");
if (environment != null) {
environment.setDefaultVM(defaultJRE);
}
Expand All @@ -106,7 +106,7 @@ public void testJVM() throws Exception {
try {
Preferences prefs = new Preferences();
Bundle bundle = Platform.getBundle(JavaLanguageServerTestPlugin.PLUGIN_ID);
URL url = FileLocator.toFileURL(bundle.getEntry("/fakejdk2/17a"));
URL url = FileLocator.toFileURL(bundle.getEntry("/fakejdk2/21a"));
File file = URIUtil.toFile(URIUtil.toURI(url));
String path = file.getAbsolutePath();
String javadoc = "file:///javadoc";
Expand All @@ -131,7 +131,7 @@ public void testJVM() throws Exception {
assertNotNull(vm);
assertTrue(vm instanceof IVMInstall2);
String version = ((IVMInstall2) vm).getJavaVersion();
assertTrue(version.startsWith(JavaCore.VERSION_17));
assertTrue(version.startsWith(JavaCore.VERSION_21));
StandardVMType svt = (StandardVMType) vm.getVMInstallType();
LibraryLocation[] libs = vm.getLibraryLocations();
assertNotNull(libs);
Expand All @@ -157,7 +157,7 @@ public void testJVM() throws Exception {
@Test
public void testInvalidJavadoc() throws Exception {
Bundle bundle = Platform.getBundle(JavaLanguageServerTestPlugin.PLUGIN_ID);
URL url = FileLocator.toFileURL(bundle.getEntry("/fakejdk2/17a"));
URL url = FileLocator.toFileURL(bundle.getEntry("/fakejdk2/21a"));
File file = URIUtil.toFile(URIUtil.toURI(url));
String path = file.getAbsolutePath();
String javadoc = new File(file, "doc").getAbsolutePath();
Expand All @@ -178,8 +178,8 @@ public void testPreviewFeatureSettings() throws Exception {
IProject invisibleProject = copyAndImportFolder("singlefile/java13", "foo/bar/Foo.java");
IJavaProject randomProject = JavaCore.create(invisibleProject);

assertComplianceAndPreviewSupport(defaultProject, "17", false);
assertComplianceAndPreviewSupport(randomProject, "17", false);
assertComplianceAndPreviewSupport(defaultProject, "21", false);
assertComplianceAndPreviewSupport(randomProject, "21", false);

String latest = JavaCore.latestSupportedJavaVersion();
TestVMType.setTestJREAsDefault(latest);
Expand All @@ -192,10 +192,10 @@ public void testPreviewFeatureSettings() throws Exception {
assertComplianceAndPreviewSupport(defaultProject, "12", false);
assertComplianceAndPreviewSupport(randomProject, "12", false);

TestVMType.setTestJREAsDefault("17");
TestVMType.setTestJREAsDefault("21");

assertComplianceAndPreviewSupport(defaultProject, "17", false);
assertComplianceAndPreviewSupport(randomProject, "17", false);
assertComplianceAndPreviewSupport(defaultProject, "21", false);
assertComplianceAndPreviewSupport(randomProject, "21", false);

} finally {
JavaRuntime.removeVMInstallChangedListener(jvmConfigurator);
Expand Down Expand Up @@ -232,7 +232,7 @@ public void testInvalidRuntime() throws Exception {
when(clientPreferences.isActionableRuntimeNotificationSupport()).thenReturn(false);

Preferences prefs = new Preferences();
File file = new File("fakejdk2", "17a" + File.separator + "bin");
File file = new File("fakejdk2", "21a" + File.separator + "bin");
String path = file.getAbsolutePath();
Set<RuntimeEnvironment> runtimes = new HashSet<>();
RuntimeEnvironment runtime = new RuntimeEnvironment();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void start(BundleContext context) throws Exception {
} catch (BundleException e) {
logException(e.getMessage(), e);
}
TestVMType.setTestJREAsDefault("17");
TestVMType.setTestJREAsDefault("21");
JavaCore.initializeAfterLoad(new NullProgressMonitor());
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription description = workspace.getDescription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void setTestJREAsDefault(String vmId) throws CoreException {
IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(VMTYPE_ID);
IVMInstall testVMInstall = vmInstallType.findVMInstall(vmId);
if (!testVMInstall.equals(JavaRuntime.getDefaultVMInstall())) {
// set the 17 test JRE as the new default JRE
// set the 21 test JRE as the new default JRE
JavaRuntime.setDefaultVMInstall(testVMInstall, new NullProgressMonitor());
Hashtable<String, String> options = JavaCore.getOptions();
JavaCore.setComplianceOptions(vmId, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class JavaFXTest extends AbstractProjectsManagerBasedTest {

private static final String JAVA_SE_8 = "JavaSE-1.8";
private static final String JAVA_SE_17 = "JavaSE-17";
private static final String JAVA_SE_21 = "JavaSE-21";

/**
* Test requires Java 8 in toolchains.xml
Expand Down Expand Up @@ -84,7 +84,7 @@ public void testJavaFX() throws Exception {
assertTrue("Unexpected errors:\n " + errorsStr, errorsStr.contains("javafx cannot be resolved"));
} finally {
JavaRuntime.setDefaultVMInstall(defaultJRE, monitor, true);
IExecutionEnvironment environment = JVMConfigurator.getExecutionEnvironment(JAVA_SE_17);
IExecutionEnvironment environment = JVMConfigurator.getExecutionEnvironment(JAVA_SE_21);
if (environment != null) {
environment.setDefaultVM(defaultJRE);
}
Expand All @@ -96,7 +96,7 @@ public void testJavaFX() throws Exception {
@After
public void cleanUp() throws Exception {
super.cleanUp();
TestVMType.setTestJREAsDefault("17");
TestVMType.setTestJREAsDefault("21");
// Copied from org.eclipse.jdt.core.tests.model.ClasspathInitializerTests.tearDown()
// Cleanup caches
JavaModelManager manager = JavaModelManager.getJavaModelManager();
Expand Down

0 comments on commit e312f88

Please sign in to comment.