Skip to content

Request textDocument/inlayHint failed #1359

Closed

Description

@Ki10V01T

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

Activity

  1. BoykoAlex commented on Sep 29, 2024

    @BoykoAlex
    Contributor

    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.

  2. self-assigned this
    on Sep 29, 2024
  3. added this to the 4.26.0.RELEASE milestone on Sep 29, 2024
  4. Ki10V01T commented on Sep 29, 2024

    @Ki10V01T
    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

  5. added
    for: eclipse
    for: vscode
    and removed on Sep 30, 2024
  6. OrlandPy commented on Oct 16, 2024

    @OrlandPy

    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

  7. martinlippert commented on Oct 16, 2024

    @martinlippert
    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

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions