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'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 aworkspace/diagnostic
request.The reason is that
WorkspaceDocumentDiagnosticReportTypeAdapter
was (erroneously) specified as@ResponseJsonAdapter
for theWorkspaceService.diagnostic
method, which actually returns aWorkspaceDiagnosticReport
rather than aWorkspaceDocumentDiagnosticReport
. 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 parsingworkspace/diagnostic
response.I'm preparing a PR to fix this.