JaCoCo support for lambda syntax in Groovy 3?

瀏覽次數:48 次
跳到第一則未讀訊息

Damir Murat

未讀,
2020年10月4日 清晨6:31:322020/10/4
收件者:JaCoCo and EclEmma Users
Besides closures, Groovy 3 introduces support for Java-like lambda syntax. I noticed that Groovy lambdas are not covered in the JaCoCo coverage report. Is this a known limitation or maybe a bug? Tnx.

Marc Hoffmann

未讀,
2020年10月4日 上午11:56:462020/10/4
收件者:JaCoCo and EclEmma Users
Hi,

we haven’t looked actively at Groovy 3 features. Can you provide a minimal demonstrator preferably based on Maven?

Thanks,
-marc 

On 4. Oct 2020, at 12:31, Damir Murat <damir...@gmail.com> wrote:

Besides closures, Groovy 3 introduces support for Java-like lambda syntax. I noticed that Groovy lambdas are not covered in the JaCoCo coverage report. Is this a known limitation or maybe a bug? Tnx.

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/eaf82478-ff2e-4f39-be30-f022c0d3e117n%40googlegroups.com.

Damir Murat

未讀,
2020年10月5日 清晨5:19:092020/10/5
收件者:JaCoCo and EclEmma Users
Here is a project: https://github.com/dmurat/jacoco-groovy3-lambda-demo

Would you like me to file the issue too?

Tnx

Evgeny Mandrikov

未讀,
2020年10月5日 清晨6:18:592020/10/5
收件者:JaCoCo and EclEmma Users
Hi,

On Monday, October 5, 2020 at 11:19:09 AM UTC+2 damir...@gmail.com wrote:
Here is a project: https://github.com/dmurat/jacoco-groovy3-lambda-demo

Thank you for the example.
 
Would you like me to file the issue too?

I have a feeling that issue or at least question should be raised on Groovy compiler side, because
in both cases Groovy compiler generates an additional class with a body of Closure/Lambda,

however this class in the case of new Java-like syntax is marked as synthetic - see ACC_SYNTHETIC in output of command
javap -v -p target/classes/org/jacoco/groovy/lambda/demo/GreeterDemo\$_greetFromLambda_lambda1.class

whereas is not marked in another case - see output of command
javap -v target/classes/org/jacoco/groovy/lambda/demo/GreeterDemo\$_greetFromClosure_closure2.class

If Groovy 3 compiler will not be marking class in the first case as synthetic,
consistently with how it does and was doing Groovy 2 compiler for the second case,
then JaCoCo without any changes will be showing coverage for the new Java-like syntax.
So that's why in my opinion will be valuable to receive an authoritative answer from developers of the Groovy compiler whether or not this can be done on their side.
And if not, then why and what will they advise for JaCoCo as a way to detect code of lambda expressions.


Regards,
Evgeny

Damir Murat

未讀,
2020年10月5日 清晨7:13:292020/10/5
收件者:JaCoCo and EclEmma Users

Damir Murat

未讀,
2020年10月5日 下午1:19:242020/10/5
收件者:JaCoCo and EclEmma Users
Here is a related Groovy issue: https://issues.apache.org/jira/browse/GROOVY-9770
回覆所有人
回覆作者
轉寄
0 則新訊息