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

Provide support for Java 21 #3314

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented Sep 20, 2023

@blaumeise20
Copy link

This might be a stupid comment, but please add support for this soon! I really need it for work and it blocks me otherwise. I already tried using the test extension linked in this PR, but sadly I am getting TONS of "Unbound classpath container" errors.

@snjeza
Copy link
Contributor Author

snjeza commented Oct 9, 2023

@blaumeise20 You can try VS Code Java 1.24.6

@blaumeise20
Copy link

I did actually try your extension but it for some reason didn't work. I even deleted the entire old extension manually in the .vscode folder and installed the one you linked, but without success. It stays at JavaSE-17 for me, even though I explicitly set the default to JavaSE-21 in the settings.

@snjeza
Copy link
Contributor Author

snjeza commented Oct 10, 2023

@blaumeise20 Could you try VS Code 1.24.7?
Could you attach a project example?

@cypher256
Copy link

@snjeza
The package.json for 1.24.7 does not contain "JavaSE-21", is this correct?

    "version": "1.24.7",
    ---
						"properties": {
							"name": {
								"type": "string",
								"enum": [
									"J2SE-1.5",
									"JavaSE-1.6",
									"JavaSE-1.7",
									"JavaSE-1.8",
									"JavaSE-9",
									"JavaSE-10",
									"JavaSE-11",
									"JavaSE-12",
									"JavaSE-13",
									"JavaSE-14",
									"JavaSE-15",
									"JavaSE-16",
									"JavaSE-17",
									"JavaSE-18",
									"JavaSE-19",
									"JavaSE-20"
								],

@blaumeise20
Copy link

I just figured out the same, yeah.

@blaumeise20
Copy link

I tried the new version now and it is still stuck at
Bildschirmfoto 2023-10-11 um 09 00 54
I still get all the same errors. Project links resolve correctly and I get hover information and everything, but it can't resolve any of the standard library items like Object or String.
Bildschirmfoto 2023-10-11 um 09 03 06
And in the very top I get the weirdest error:
Bildschirmfoto 2023-10-11 um 09 03 36

@snjeza
Copy link
Contributor Author

snjeza commented Oct 11, 2023

@blaumeise20 @cypher256 Could you please try VS Code 1.25.1 ?

@aghasemi
Copy link

@blaumeise20 @cypher256 Could you please try VS Code 1.25.1 ?

Hello. This worked for me (on Code Server). Many thanks. However, the STR object used in String templates is still missing, it seems.

@snjeza
Copy link
Contributor Author

snjeza commented Oct 11, 2023

However, the STR object used in String templates is still missing, it seems.

@aghasemi You may want to take a look at eclipse-jdtls/eclipse.jdt.ls#2863 (comment)

@cypher256
Copy link

Java 21 worked correctly on 1.25.1. Excellent!

@blaumeise20
Copy link

I tried it with the version you provided and it still doesn't work correctly.

I can't provide an example because it is a 15-year-old company project with thousands of files, but I can show you a part of the .classpath file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="src_gen"/>
    ...
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-21">
        <attributes>
            <attribute name="module" value="true"/>
        </attributes>
    </classpathentry>
    ...
</classpath>

@blaumeise20
Copy link

It turned out I just had to change jdk-21 to JavaSE-21 and everything worked...

@slymon99
Copy link

Getting errors with 1.25.1 on tons of imports as well as on certain interface implementations (The type xyz must implement the inherited abstract method blah). Standard (but very large) gradle project that works on Java 17.

Screenshot 2023-10-12 at 1 50 22 PM

LSP log has errors that look like

!ENTRY org.eclipse.jdt.ls.core 4 2 2023-10-12 13:48:39.495
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
!STACK 0
org.eclipse.buildship.core.internal.GradlePluginsRuntimeException: Model not available for algo
	at org.eclipse.buildship.core.internal.workspace.GradleClasspathContainerRuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(GradleClasspathContainerRuntimeClasspathEntryResolver.java:82)
	at org.eclipse.buildship.core.internal.workspace.GradleClasspathContainerRuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(GradleClasspathContainerRuntimeClasspathEntryResolver.java:58)
	at org.eclipse.jdt.internal.launching.RuntimeClasspathEntryResolver.resolveRuntimeClasspathEntry(RuntimeClasspathEntryResolver.java:49)
	at org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspathEntry(JavaRuntime.java:1261)
	at org.eclipse.buildship.core.internal.launch.GradleClasspathProvider.resolveClasspath(GradleClasspathProvider.java:101)
	at org.eclipse.jdt.internal.launching.RuntimeClasspathProvider.resolveClasspath(RuntimeClasspathProvider.java:68)
	at org.eclipse.jdt.launching.JavaRuntime.resolveRuntimeClasspath(JavaRuntime.java:1663)
	at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.getClasspathAndModulepath(AbstractJavaLaunchConfigurationDelegate.java:464)
	at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand$1.run(ProjectCommand.java:176)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2453)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2478)
	at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand.getClasspathsFromJavaProject(ProjectCommand.java:173)
	at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand.getClasspaths(ProjectCommand.java:153)
	at org.eclipse.jdt.ls.core.internal.JDTDelegateCommandHandler.executeCommand(JDTDelegateCommandHandler.java:95)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:614)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

@snjeza
Copy link
Contributor Author

snjeza commented Oct 12, 2023

@slymon99 Could you try to update to the 8.4 version of gradle? See https://docs.gradle.org/current/userguide/compatibility.html

@slymon99
Copy link

I am on gradle 8.4 already

$ ../gradlew -version

------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------

Build time:   2023-10-04 20:52:13 UTC
Revision:     e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f

Kotlin:       1.9.10
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          21 (Amazon.com Inc. 21+35-LTS)
OS:           Linux 6.2.0-1012-aws amd64

@snjeza
Copy link
Contributor Author

snjeza commented Oct 12, 2023

Could you attach a project example?

@cypher256
Copy link

Note: vscode-gradle feat(jdk): Support JDK21
microsoft/vscode-gradle#1419

@snjeza
Copy link
Contributor Author

snjeza commented Oct 13, 2023

I am on gradle 8.4 already

This is an upstream buildship issue. buildship doesn't support JDK 21/gradle 8.4

@slymon99
Copy link

I am on gradle 8.4 already

This is an upstream buildship issue. buildship doesn't support JDK 21/gradle 8.4

Created an issue upstream eclipse/buildship#1271. Not sure if this blocks this release, is gradle support implicitly part of the LSP?

@snjeza
Copy link
Contributor Author

snjeza commented Oct 13, 2023

Not sure if this blocks this release

No, it doesn't block this PR. Only Gradle projects that use JDK 21/Gradle 8.4 will not work.

Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
@rgrunber rgrunber merged commit 31f7f3f into redhat-developer:master Nov 1, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide support for Java 21
6 participants