openclover / clover

This repository contains source code of OpenClover Core as well as its integrations: Clover-for-Ant, Clover-for-Eclipse and Clover-for-IDEA plugins. Sources are licensed under Apache 2.0 license.
Other
57 stars 14 forks source link

Support Groovy 3.0.x #121

Open bjornvester opened 4 years ago

bjornvester commented 4 years ago

Add support for instrumenting Groovy 3.0.x code.

This could potentially be split into two issues:

As an example of the first part, OpenClover fails on my Groovy 2.5 source code under Groovy 3.0 with:

[...]
11:24:01  Caused by: java.lang.UnsupportedOperationException: EmptyExpression.INSTANCE is immutable
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.transform(InstrumentingCodeVisitor.java:358)
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.transform(InstrumentingCodeVisitor.java:309)
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitExpressionStatement(InstrumentingCodeVisitor.java:633)
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitBlockStatement(InstrumentingCodeVisitor.java:675)
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitConstructorOrMethod(InstrumentingCodeVisitor.java:250)
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.visitClass(InstrumentingCodeVisitor.java:210)
11:24:01    at com.atlassian.clover.instr.groovy.InstrumentingCodeVisitor.instrument(InstrumentingCodeVisitor.java:194)
11:24:01    at com.atlassian.clover.instr.groovy.Grover.addRecorderIncCalls(Grover.java:365)
11:24:01    at com.atlassian.clover.instr.groovy.Grover.visit(Grover.java:320)
11:24:01    ... 24 more
andersaaberg commented 3 years ago

The lack of Groovy 3 support is getting a real pain for the Groovy community as Groovy 3 is supported in Micronaut 2 and will also be supported in the upcoming Grails 5 release. If financial support is needed in order to fix this issue, then I suggest to apply here: https://opencollective.com/friends-of-groovy

hydra commented 3 months ago

Today I finally found the code causing the 'EmptyExpression.INSTANCE is immutable' issue that we have been experiencing. I made a PR to my own repo, documented my findings and add with several commits which show the changes I had to make.

See here:

https://github.com/hydra/pnpconvert/pull/19