Skip to content

Force Java Compilation returns error #1929

Closed
eclipse-jdtls/eclipse.jdt.ls
#1763

Description

@baladreams
Environment
  • Operating System: MacOS
  • JDK version: OpenJDK 11.0.7
  • Visual Studio Code version: 1.55
  • Java extension version: 0.79.1
Steps To Reproduce
  1. Import a Java project (for example https://github.com/jitpack/gradle-simple )
  2. Preform Java: Force Java Compilation (Incremental or Full)
Current Result

Error window showing operation failed
image

Expected Result

Java source is compiled

Additional Informations

enabling java.trace.server verbose logging shows this error

Trace - 9:01:59 PM] Sending request 'java/buildWorkspace - (33)'.
Params: [
    true
]


[Trace - 9:01:59 PM] Received response 'java/buildWorkspace - (33)' in 1ms. Request failed: Message could not be parsed. (-32700).
Error data: {
    "message": "java.lang.IllegalStateException: Expected a boolean but was BEGIN_ARRAY at line 1 column 67 path $.params"
}

Dev console does not have any detailed errors

image

This error seems have started occurring only recently.

Activity

  1. CarlPer commented on May 6, 2021

    @CarlPer

    I have the same issue, and I can not have autobuild set to true since it fails my maven builds

  2. fbricon commented on May 6, 2021

    @fbricon
    Collaborator

    I can reproduce the issue too. Independent of the build system (Gradle, Maven).

    My gut feeling tells me this is caused by a change in either the LSP4J dependency on the server side, or, most likely, caused by the new vscode-languageclient 7.0.0 dependency in vscode-java

  3. testforstephen commented on May 6, 2021

    @testforstephen
    Collaborator

    yes, looks like a breaking change in language client 7.0.0.

    It adopts the Parameter Structures concept of jsonrpc, which requires the parameter of requests and notifications MUST be an array or an object.

    If you're sending a request with a primitive type parameter such as boolean, then language client will automatically convert it as an array to the language server. That's why the server reports incompatible parameter type. See JSON_RPC implementation.

    Fix:
    We have to change the eclipse.jdt.ls code and make the parameter of buildWorkspace request to be Either<Boolean, boolean[]> instead of boolean. This can make it compatible with both old language client and new language client.

  4. fbricon commented on May 6, 2021

    @fbricon
    Collaborator

    @testforstephen should we open a ticket with lsp4j? Could this be an issue in other places

  5. rubensa commented on May 6, 2021

    @rubensa

    Same error here. This is the relevant part from Remote Extension Host log:

    [2021-05-06 14:35:31.260] [exthost] [error] Error: Message could not be parsed.
    	at /home/user/.vscode-server/extensions/redhat.java-0.79.1/dist/extension.js:2:851523
    	at /home/user/.vscode-server/extensions/redhat.java-0.79.1/dist/extension.js:2:851817
    	at Immediate.<anonymous> (/home/user/.vscode-server/extensions/redhat.java-0.79.1/dist/extension.js:2:852182)
    	at processImmediate (internal/timers.js:461:21) java.workspace.compile
    
  6. added this to the Early May 2021 milestone on May 6, 2021
  7. testforstephen commented on May 7, 2021

    @testforstephen
    Collaborator

    @testforstephen should we open a ticket with lsp4j? Could this be an issue in other places

    @fbricon, I opened an issue to ask lsp4j jsonrpc to destructure the wrapped byPosition array parameter. See eclipse-lsp4j/lsp4j#553.

  8. rubensa commented on May 11, 2021

    @rubensa

    @fbricon When can we expect this to be fixed? Is a new version of vscode-java needed or should we check for an update of anything else?

  9. snjeza commented on May 11, 2021

    @snjeza
    Collaborator
  10. rubensa commented on May 11, 2021

    @rubensa

    @snjeza Just downloaded java-0.79.2-208.vsix and is working as expected.

    Now that I know a new vscode-java version needs to be published, I'll wait to tell my colleges to update (we all had to revert to version 0.77.0 to find a currently released full working version)

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions