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

Force Java Compilation returns error #1929

Closed
baladreams opened this issue May 6, 2021 · 9 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#1763
Closed

Force Java Compilation returns error #1929

baladreams opened this issue May 6, 2021 · 9 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#1763
Assignees
Milestone

Comments

@baladreams
Copy link

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.

@CarlPer
Copy link

CarlPer commented May 6, 2021

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

@fbricon
Copy link
Collaborator

fbricon commented May 6, 2021

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

@testforstephen
Copy link
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.

@fbricon
Copy link
Collaborator

fbricon commented May 6, 2021

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

@rubensa
Copy link

rubensa commented May 6, 2021

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

@testforstephen
Copy link
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.

@rubensa
Copy link

rubensa commented May 11, 2021

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

@snjeza
Copy link
Contributor

snjeza commented May 11, 2021

@rubensa You can try Continuous Integration build. See Contributing

@rubensa
Copy link

rubensa commented May 11, 2021

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants