mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 09:17:43 +03:00
HOTFIX: avoid breaking code that is created with "daml codegen" from older SDK but links against more recent java-bindings (#17648)
We provide a default implementation of `jsonEncoder` for `codegen.DefinedDataType`. This will fail if called, but older codegen will presumably not want to call `toJson` because it was not previously provided. This is to unbreak the `canton` repo. See https://app.circleci.com/pipelines/github/DACH-NY/canton/59000/workflows/58a9cfae-4e75-4062-b9c4-dbbf9544dc46/jobs/1576433/parallel-runs/0/steps/0-117
This commit is contained in:
parent
f72b9459bc
commit
b4b55a3a7b
@ -28,7 +28,16 @@ public interface DefinedDataType<T> {
|
||||
/** Produce the encoded form. */
|
||||
Value toValue();
|
||||
|
||||
JsonLfEncoder jsonEncoder();
|
||||
// To avoid breaking code generated by old code-generators that link against updated java-bindings
|
||||
// we provide a default implementation. Calling toJson will fail but old code-gen won't use it.
|
||||
// TODO(raphael-speyer-da): Remove this once we can expect users of codegen to have caught up.
|
||||
default JsonLfEncoder jsonEncoder() {
|
||||
throw new UnsupportedOperationException(
|
||||
"no jsonEncoder implementation was provided for "
|
||||
+ this.getClass()
|
||||
+ ". Does the SDK version you are using for codegen match your version of the"
|
||||
+ " java-bindings library?");
|
||||
}
|
||||
|
||||
default String toJson() {
|
||||
var w = new StringWriter();
|
||||
|
Loading…
Reference in New Issue
Block a user