Open mkeskells opened 6 years ago
This is a bit of a corner case because of the accessor created for the non-public case class parameter.
@SerialVersionUID(509929039250432923L) // value computed by serialver for 2.11.2, annotation added in 2.11.4
final case class ::[B](override val head: B, private[scala] var tl: List[B]) extends List[B] {
override def tail : List[B] = this.tl : @inline
override def isEmpty: Boolean = false
}
Results in:
public scala.collection.immutable.List<B> tail();
Code:
0: aload_0
1: getfield #23 // Field tl:Lscala/collection/immutable/List;
4: areturn
Which might help some unlucky code that got caught at the threshhold of -XX:MaxInlineLevel
.
Nil has multiple levels of methods for var access
tail calls tl, tl accesses the field and we have an tl$access that isnt needed?