You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Betting on Scala 2.13/3 compatibility, I tried to use scalapb-json4s_2.13 0.11.0 against classes compiled with Scala 3 from code generated by ScalaPB 0.11.3, and got the following errors
NoSuchFieldException
Caused by: java.lang.NoSuchFieldException: MODULE$
at java.lang.Class.getField(Class.java:1999)
at scalapb.json4s.FormatRegistry.companionForClass(JsonFormat.scala:52)
at scalapb.json4s.FormatRegistry.registerMessageFormatter(JsonFormat.scala:63)
at scalapb.json4s.FormatRegistry.registerWriter(JsonFormat.scala:86)
at scalapb.json4s.JsonFormat$.<clinit>(JsonFormat.scala:711)
Looking at the classpath with sbt, it's unclear which binary version of scalapb-runtime is used (dependencyTree shows both but fullClasspath shows only 2.13?), but I assume the problem comes from the WKT classes included in scalapb-runtime_3, as we can see that the returned type inferred for companion() is different:
--- Timestamp_2_13.class.javap+++ Timestamp_3.class.javap- public com.google.protobuf.timestamp.Timestamp$ companion();+ public scalapb.GeneratedMessageCompanion<?> companion();
IncompatibleClassChangeError
java.lang.IncompatibleClassChangeError: Class scalapb.descriptors.PEnum$ does not implement the requested interface scala.Function1
at scala.Option.fold(Option.scala:263)
at scalapb.json4s.Parser.parseSingleValue(JsonFormat.scala:684)
at scalapb.json4s.Parser.$anonfun$fromJsonToPMessage$2(JsonFormat.scala:580)
at scala.collection.immutable.List.map(List.scala:246)
at scalapb.json4s.Parser.parseValue$1(JsonFormat.scala:580)
at scalapb.json4s.Parser.$anonfun$fromJsonToPMessage$3(JsonFormat.scala:602)
at scala.collection.immutable.List.foreach(List.scala:333)
at scalapb.json4s.Parser.fromJsonToPMessage(JsonFormat.scala:598)
at scalapb.json4s.Parser.fromJson(JsonFormat.scala:530)
at scalapb.json4s.Parser.fromJson(JsonFormat.scala:523)
at scalapb.json4s.Parser.fromJsonString(JsonFormat.scala:517)
at scalapb.json4s.JsonFormat$.fromJsonString(JsonFormat.scala:843)
Synthetic bytecode emitted for case classes has changed. For example, for case class Foo(a: Int)
--- Foo$_2_13.class.javap+++ Foo$_3.class.javap-public final class Foo$ extends scala.runtime.AbstractFunction1<java.lang.Object, Foo> implements java.io.Serializable {+public final class Foo$ implements scala.deriving.Mirror$Product,java.io.Serializable {
public static final Foo$ MODULE$;
public static {};
- public final java.lang.String toString();
public Foo apply(int);
- public scala.Option<java.lang.Object> unapply(Foo);- public java.lang.Object apply(java.lang.Object);+ public Foo unapply(Foo);+ public java.lang.String toString();+ public Foo fromProduct(scala.Product);+ public java.lang.Object fromProduct(scala.Product);
}
The text was updated successfully, but these errors were encountered:
@bjaglin Is there additional work needed to resolve this issue?
Not to my knowledge. Thanks for the ping, I just spent some time finishing up scalapb/scalapb-validate#123 which was the original driver for this, and it's green 👍
Betting on Scala 2.13/3 compatibility, I tried to use scalapb-json4s_2.13 0.11.0 against classes compiled with Scala 3 from code generated by ScalaPB 0.11.3, and got the following errors
NoSuchFieldException
Looking at the classpath with sbt, it's unclear which binary version of scalapb-runtime is used (
dependencyTree
shows both butfullClasspath
shows only 2.13?), but I assume the problem comes from the WKT classes included in scalapb-runtime_3, as we can see that the returned type inferred forcompanion()
is different:IncompatibleClassChangeError
Synthetic bytecode emitted for case classes has changed. For example, for
case class Foo(a: Int)
The text was updated successfully, but these errors were encountered: