Got error during writing entity tests: Java serilialization of $colon$colon

Hi everyone, I got an error during writing my lagom entity test.

Vector(Java serialization is used for class scala.collection.immutable.$colon$colon) was not empty

What is $colon$colon means?

Hi @saltik,

scala.collection.immutable.$colon$colon refers to scala’s::which is actually the type of a non-empty List. If you are new to scala (or programming in Java) I suggest you had a look atListit's two subclasses:Nil(the empty list) and::` (the non-empty list).

It looks like you are running a Persistent Entity test and the call to outcome.issues reports a serialization issue because a Java serialiser was detected. I suspect the type of your command, your reply, one of the events or the state of the persistent entity is List[T]. We generally suggest avoiding the use of general purpose collections as types for Command, reply types, Event and State. There are few reasons and picking a serialiser is one of them: if you had List[T] and List[Q] and wanted to use JSON for T and protobuf for Q at runtime we wouldn’t know which serializer to pick because of erasures. At runtime, all the code sees is List. If, instead, you model everything (eg.: case class MyListOfT(ts:List[T]) then it’s clear what you want.

Hope this helps,

Thanks @ignasi35, I accidentally used Seq[MyObject] for ReplyType. Errors resolved.