Skip to content

JsonParseException: Ambiguous Either type when reading response to workspace/diagnostic #682

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

Closed
pisv opened this issue Nov 16, 2022 · 0 comments · Fixed by #683
Closed
Assignees
Labels
Milestone

Comments

@pisv
Copy link
Contributor

pisv commented Nov 16, 2022

I've just found this bug, which was supposed to be fixed as part of #668, but unfortunately it was not. JsonParseException: Ambiguous Either type: token BEGIN_OBJECT matches both alternatives is still thrown when reading a response to a workspace/diagnostic request.

The reason is that WorkspaceDocumentDiagnosticReportTypeAdapter was (erroneously) specified as @ResponseJsonAdapter for the WorkspaceService.diagnostic method, which actually returns a WorkspaceDiagnosticReport rather than a WorkspaceDocumentDiagnosticReport. I guess that this was unfortunate misreading caused by similarity in type names, since the wrong expected type was also used in the unit tests for parsing workspace/diagnostic response.

I'm preparing a PR to fix this.

@pisv pisv self-assigned this Nov 16, 2022
@pisv pisv added this to the 0.19.0 milestone Nov 16, 2022
@pisv pisv added the bug label Nov 16, 2022
pisv added a commit to pisv/lsp4j that referenced this issue Nov 16, 2022
pisv added a commit to pisv/lsp4j that referenced this issue Nov 16, 2022
@jonahgraham jonahgraham mentioned this issue Nov 16, 2022
35 tasks
@pisv pisv closed this as completed in #683 Nov 17, 2022
pisv added a commit that referenced this issue Nov 17, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fixes #682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant