altoo-ag/akka-kryo-serialization

Scala 3 enum serialization is broken

nvollmar opened this issue · 0 comments

The field serializer tries to create a new instance of a Scala 3 enum (which does not and should not work):

An exception or error caused a run to abort: failed to access class io.altoo.akka.serialization.kryo.serializer.scala.EnumSerializationTest$$anon$2 from class io.altoo.akka.serialization.kryo.serializer.scala.EnumSerializationTest$$anon$2ConstructorAccess (io.altoo.akka.serialization.kryo.serializer.scala.EnumSerializationTest$$anon$2 is in unnamed module of loader 'app'; io.altoo.akka.serialization.kryo.serializer.scala.EnumSerializationTest$$anon$2ConstructorAccess is in unnamed module of loader com.esotericsoftware.reflectasm.AccessClassLoader @6fd83fc1)

Similar to Scala objects and enumerations, we need a dedicated serializer to handle Scala 3 enums correctly.