It seems like if a case class has both enums and options, I cannot instantiate it from Java.
Consider the following in Scala:
object WeekDay extends Enumeration {
type WeekDay = Value
val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
}
case class EnumOption(e: WeekDay.Value, s: Option[String])
case class EnumOnly (e: WeekDay.Value, s: String)
case class OptionOnly(e: Int, s: Option[String])
And the following in Java to use them:
scala.Enumeration.Value monday = WeekDay.Mon();
EnumOption a = new EnumOption(monday, Option.apply("12"));
EnumOnly b = new EnumOnly(monday, "12");
OptionOnly c = new OptionOnly(12, Option.apply("12"));
I get an error (at least Eclipse shows me an error) on instantiating a
but b
and c
work just fine! Any idea how I can instantiate EnumOption
in Java???