I read that a good practice for enum is scala is as follow.
I deliberately extends the class with Serializable for Spark.
sealed abstract class MyEnum(val nature: String) extends Serializable
case object A extends MyEnum("a")
case object B extends MyEnum("b")
The problem is that i want that the enum should be extensible by others, thus i have to remove the sealed keyword to enable this functionality
abstract class MyEnum(val nature: String) extends Serializable
case object A extends MyEnum("a")
case object B extends MyEnum("b")
On another file
import enumpackage.MyEnum
case object C extends MyEnum("c")
Knowing this issue with Java enum on Spark, i was wondering how is generate the hashCode from object that extends class that are sealed or not.
Is it safe to avoid sealed keyword for my purpose or do i have to keep it, why ? If i have to keep it, is there any solution to my extensibility problem.