Clone this wiki locally
This page discusses a not yet available feature!
Scala allows case classes that generate boilerplate code such as
Methods from case-classes are completely removed.
case class Foo(a: Int)(b: String)
Foo and the companion class
Foo$ has synthetic methods
public boolean Foo.equals(java.lang.Object) public java.lang.String Foo.toString() public int Foo.hashCode() public Foo Foo.copy(int,java.lang.String) public java.lang.String Foo.productPrefix() public int Foo.productArity() public java.lang.Object Foo.productElement(int) public scala.collection.Iterator Foo.productIterator() public boolean Foo.canEqual(java.lang.Object) public int Foo.copy$default$1() public final java.lang.String Foo$.toString() private java.lang.Object Foo$.readResolve() public Foo Foo$.apply(int,java.lang.String) public scala.Option Foo$.unapply(Foo)
These can be recognized by the fact that they are emitted on a single line, which is the same as the one of the constructors. The auto-generated methods that have the same line number as a constructor can be removed using the SCALAC.MIXIN filter. The other auto-generated methods will be either "curried()" or "tupled()" (neither of which is emitted with a source line number) or will follow the pattern "(\w|$)+$default$\d+". Currently the filter in use in the jacoco-scala-maven-plugin (https://github.com/timezra/jacoco-scala-maven-plugin) can be used as a reference.