New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failure on JDK11 with PowerMock + JaCoCo offline instrumentation #1017
Comments
The error comes from Javassist. PowerMock uses javassistVersion = "3.25.0-GA", the described issue was fixed and released in javassist 3.26.0-GA (jboss-javassist/javassist#270). However it is still not fully compatible with JDK 11, one more issue was found: jboss-javassist/javassist#282. |
based on your answer and the fact that javaassist 3.26.0-GA is released, do you know if there is any powermock's released planned to update to 3.26 from javaassist? |
jboss-javassist/javassist#282 is fixed and merged to |
thanks for the quick reply! |
Looks like the fix for jboss-javassist/javassist#282 has now been included in the latest release at 3.27.0-GA. Is there scope for this issue to be picked back up? |
Thanks for your work both. |
@rhysowen9 the release is already published, it's |
🤦♂ Didn't get the release email. My bad, thanks again for your work 💪 |
Hi @valfirst is this issue only for offline instructions? Using this example for reporting- https://github.com/SonarSource/sonar-scanning-examples/tree/master/sonarqube-scanner-maven/maven-multimodule |
Did it work before migration to Java 11? |
Hi @valfirst, Able to see coverage with: When we moved from Java 8 to Java 11, we update PowerMock version and also moved from powermock-api-mockito to powermock-api-mockito2, Mockito-all to Mockito-core. |
@arushi315 I believe you should migrate to powermock-api-mockito2 at first, and then migrate from JDK 8 to JDK 11 |
Sure @valfirst I can give that a try but ultimately we want to move to JDK11. |
I recommend to migrate with small steps and check the state at each step:
|
HI @valfirst, Coverage is generated with Java 8 with the following versions: Maven dependencies:
The same fails with Java 11. With Java 8 although coverage is generated, it still does not create the coverage for test classes using powermock. Is there anything you recommend checking? |
Hi @valfirst just following up on this, if you got a chance to take a look? |
Steps to reproduce
PowerMock version:
JaCoCo version: 0.8.4
Operating system: used this docker image maven:3-jdk-11-slim
Tool integration: Maven
Expected behaviour
Complete code coverage equally on different JDK's
Actual behaviour
Tests breaking on JDK11 and working ok with JDK8
I've created a repository to show the problem. I know that the integration between PowerMock and JaCoCo needs to work with offline instrumentation (in some cases) and I've created a test project to try it. So I got these results:
On branch master uses java11 with online instrumentation. The code coverage on DummyService is 15%
On branch java8 uses java8 with offline instrumentation. The code coverage on DummyService is 100%
On branch java11 uses java11 with offline instrumentation. The tests are broken with the error bellow:
I've created the same issue inntially on JaCoCo's repository and as explained there the issue is thrown by PowerMock
https://github.com/powermock/powermock/blob/powermock-2.0.3/powermock-core/src/main/java/org/powermock/core/classloader/javassist/JavassistMockClassLoader.java#L119
The text was updated successfully, but these errors were encountered: