You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want a case class where the access to its constructors (including companion.apply) is private, or to not have the synthetic constructor created.
caseclassFooprivate(x: Int)
objectFoo {
// apply not publicdefmake(x: Int):Option[Foo] =???// public constructor
}
Adding or overriding Foo.apply causes "error: method apply is defined twice".
The only workaround I could find is to not use a case class; use a regular class, and define your own val, apply, unapply, toString, canEqual, equals, hashCode; seems unfortunate.
The text was updated successfully, but these errors were encountered:
I want a case class where the access to its constructors (including companion.apply) is private, or to not have the synthetic constructor created.
Adding or overriding Foo.apply causes "
error: method apply is defined twice
".The only workaround I could find is to not use a case class; use a regular class, and define your own
val
,apply
,unapply
,toString
,canEqual
,equals
,hashCode
; seems unfortunate.The text was updated successfully, but these errors were encountered: