EclEmma, Java8 and Lambda - no coverage on lambda expression

前端 未结 1 851
南笙
南笙 2021-01-15 05:46

I have a Java project under Eclipse Luna, with EclEmma 2.3.1.201405111647 (latest), which use Jacoco 0.7.1, which have support for Java 8 as stated in their changelog:

相关标签:
1条回答
  • 2021-01-15 06:34

    Lambda expression bodies are compiled into synthetic methods, but as far as I read, synthetic methods are unconditionally filtered out in the code coverage analysis.

    By looking at the Change History of JaCoCo I see

    Snapshot Build 0.7.2.201408210455 (2014/08/21)

    Fixed Bugs

    Do not ignore synthetic lambda methods to get code coverage for Java 8 lambda expressions (GitHub #232).

    which seems to address your issue. Since you are using EclEmma 2.3.1 which is using JaCoCo version 0.7.1 you just need an update.

    0 讨论(0)
提交回复
热议问题