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

Request textDocument/inlayHint failed #1359

Closed
Ki10V01T opened this issue Sep 29, 2024 · 4 comments
Closed

Request textDocument/inlayHint failed #1359

Ki10V01T opened this issue Sep 29, 2024 · 4 comments
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode type: bug

Comments

@Ki10V01T
Copy link

Version of Spring Boot Tools is v1.57.0

Hello, colleagues.
I recently ran into a problem. Your extension displays a message in the lower right corner of the vscode window about the problems that are occurring. Changing any settings has no effect.

Nothing needs to be done to reproduce the problem. Just write code.

Below is a stack trace about the problem that has occurred.

Activating 'vscode-spring-boot' extension
"spring-boot.ls.java.home" setting not specified or empty value
Found java executable: /home/dimidrol/.vscode/extensions/redhat.java-1.35.0-linux-x64/jre/17.0.12-linux-x86_64/bin/java
isJavaEightOrHigher => true
Redirecting server logs to /dev/null
Disabling server log output. No more output will be sent after this.
[Error - 4:00:50 PM] Request textDocument/inlayHint failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "org.springframework.ide.vscode.commons.languageserver.util.InlayHintHandler.handle(org.springframework.ide.vscode.commons.util.text.TextDocument, org.eclipse.lsp4j.Range, org.eclipse.lsp4j.jsonrpc.CancelChecker)" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "org.springframework.ide.vscode.commons.languageserver.util.InlayHintHandler.handle(org.springframework.ide.vscode.commons.util.text.TextDocument, org.eclipse.lsp4j.Range, org.eclipse.lsp4j.jsonrpc.CancelChecker)" is null
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$5.lambda$handle$2(CompositeLanguageServerComponents.java:184)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$5.handle(CompositeLanguageServerComponents.java:185)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$inlayHint$19(SimpleTextDocumentService.java:587)
	... 5 more

[Error - 4:00:52 PM] Request textDocument/inlayHint failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "org.springframework.ide.vscode.commons.languageserver.util.InlayHintHandler.handle(org.springframework.ide.vscode.commons.util.text.TextDocument, org.eclipse.lsp4j.Range, org.eclipse.lsp4j.jsonrpc.CancelChecker)" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because the return value of "org.springframework.ide.vscode.commons.languageserver.util.InlayHintHandler.handle(org.springframework.ide.vscode.commons.util.text.TextDocument, org.eclipse.lsp4j.Range, org.eclipse.lsp4j.jsonrpc.CancelChecker)" is null
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$5.lambda$handle$2(CompositeLanguageServerComponents.java:184)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.springframework.ide.vscode.commons.languageserver.composable.CompositeLanguageServerComponents$5.handle(CompositeLanguageServerComponents.java:185)
	at org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService.lambda$inlayHint$19(SimpleTextDocumentService.java:587)
	... 5 more

@BoykoAlex
Copy link
Contributor

BoykoAlex commented Sep 29, 2024

Hopefully fixed with 88d357f. There should be a snapshot build available within an hour form now on this page: https://cdn.spring.io/spring-tools/snapshot/STS4/nightly-distributions.html (VSIXs on the bottom). Otherwise pre-release on Tuesday morning will be available.

@BoykoAlex BoykoAlex self-assigned this Sep 29, 2024
@BoykoAlex BoykoAlex added this to the 4.26.0.RELEASE milestone Sep 29, 2024
@Ki10V01T
Copy link
Author

Thank you for your prompt response!) In that case, I will wait for the next update.
It's just that this particular problem has been haunting for the last two versions

@martinlippert martinlippert added for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode and removed status: waiting-for-triage labels Sep 30, 2024
@OrlandPy
Copy link

OrlandPy commented Oct 16, 2024

Just in case it helps someone...

I was having the same problem with my spring-boot extension in vs code. I fixed it adding the next config in my vscode's settings.json file
"spring-boot.ls.java.home": "${env:JAVA_HOME}\\bin\\java.exe"

image

I used my JAVA_HOME env, because sometimes I need to work with legacys projects with a diferent java version and I did not want to edit this configuration every time. Only the env var and I am ready to go

@martinlippert
Copy link
Member

@OrlandPy The preference spring-boot.ls.java.home is unrelated to the Java runtime and version that you use for your projects. It is the JVM that is used to run the language server process behind the scenes and it has to be a JDK 21 or newer. The language server will not work properly if you specify "random" JDKs that you use for your projects, so please configure this preference to point to a specific JDK 21 - in case you need this preference at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode type: bug
Projects
None yet
Development

No branches or pull requests

4 participants