Skip to content

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

@pisv

Description

@pisv

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions