object App {- def main(args : Array[String]) {
- val myList = List(1,2,3)
- println("Length of " + myList + " is: " + listLength(myList))
- }
- def listLength[A](list: List[A]) : Int = {
- list match {
- case Nil => 0
- case head :: tail => 1 + listLength(tail)
- }
- }
- }
"That line, from the perspective of bytecode analysis, is something along the lines of
if (list == null) throw new MatchError else ...
And the null branch is never taken. I imagine it will stop complaining if the match were written
case head :: tail => ...
case _ => 0
because it would no longer have to perform the null check."
Are general Java code coverage tools are doomed to produce too much noise / require too many work-arounds to be useful for Scala?
Scct doesn't suffer from this problem, but it would be useful to use Jacoco for the extra coverage metrics.