i need to validate the parameter of my value class (below) . But i get an error
this statement is not allowed in value class
at compile time , is there a way around this ? Thanks.
case class Size(val size: Long) extends AnyVal {
if (size < 0) throw new IllegalArgumentException; // error
def +(s: Size): Size =Size(size + s.size)
}