Search code examples
javascalaserializationioserializable

What is the difference between scala @Serializable and Java Serializable?


the manner of action of scala @Serializable is different from Java Serializable?

I mean the way to serialize objects or both use the same standard serialization?


Solution

  • Well Scala compiles to JVM byte code, so the only difference comes from how Scala implements this conversion. Scala converts the annotation to the interface during type checking which can lead to some subtle problems see here.

    Afaik @Serializable is deprecated anyhow - compared to other annotations (volatile annotation instead of a specifier) in scala I don't see much advantages anyhow.. doesn't make the code much clearer or simpler.