Closed freshcodemonger closed 4 years ago
This plugin wraps the OpenClover library, it does not change what it can handle. Are you setting the correct version of OpenClover in the clover
dependency?
Do you have a small example project that can demonstrate this particular issue?
Also, provide Gradle version in addition to relevant source and target bytecode settings in your project.
I created a repo with a sample project and added you as a collaborator.
gradle5 build fails....
if you switch the sourceCompatibility = 8 instead of = 11 it works.
Your example project uses openclover 4.2.0. That version is known not to work with Java 11. Version 4.4.1 works as far as I know.
No matter, I will use your example to see if I can make it work.
Sorry I did have it at 4.4.1, first time creating a repo here so had some learning and must have lost the 4.4.1 change. If you change that you will see the enum issue come up.
I found the issue and it is OpenClover after all. The latest available OpenClover only recognizes source compatibility up to Java 9. Anything above that falls back to the lowest setting or 1.3.
Thus, this is not something I can change and you must redirect your issue to the OpenClover team.
Here is the latest source code showing the lack of support for anything beyond Java 9:
OpenClover 4.4.1 supports Java sourceCompatibilty=9 but nothing beyond this. Until OpenClover adds support for Java 11 I cannot do anything about this problem.
Thanks for looking at it !
Seems like Java 11 support isn't there in 4.4.1 yet.
https://bitbucket.org/openclover/clover/issues/64/480-support-java-11
Added a new override in the plugin, it may help at least if your code is Java 9 but builds for Java 11. Using this configuration in your project you can have files building as Java 11 for production but Java 9 for Clover.
sourceCompatbility = '11'
targetCompatibility = '11'
clover {
compiler {
sourceCompatbility = '1.9'
targetCompatibility = '1.9'
}
}
I have not tried this as much since I do not have any Java 9 code to run it with. It does make OpenClover select lower compatibility than Java/Groovy for compilation. If you are not using Java 10 or 11 features in your code it probably works fine.
I spent a little more time on this and it turns out that the error I reported is not a java 1.9 or greater issue. The problem is that the gradle clover plugin was compiling against 1.3 as "enum" was introduce maybe in 1.4. So somehow setting source Compatibility to 11 caused the gradle clover plugin to use 1.3. I'll give this fix a try though.
Yes, that is what my solution is attempting to address. OpenClover if given a choice of Java 10 or 11 or any version higher than what it can support it magically reconfigures its choice as the LOWEST supported version. This is unfortunate but it is why you see the issue.
My solution simply lets you build for Java 11 as long as your source is compilable for Java 9 which at this time is the largest Java version supported by OpenClover.
Ok great. Thanks for the work on the plugin !
It doesn't seem like the gradle clover plugin works for JDK11.0.5, I am pretty sure openClover 4.4.1 works with JDK11.