-
Notifications
You must be signed in to change notification settings - Fork 354
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
Pitest not filtering try-with-resources correctly in Java 11 #766
Comments
I am using pitest results for quality checks. The same problem occured with me. I had to disable pitest from my project. I would like to see this working with Java 11 as well. |
Same here. |
Sorry for the delay fixing this folks, it is very annoying. Should have something out early next week. |
Javac emits fewer null checks for try with resources in 11 than in 8. This trips up the junk mutation filtering. This change broadens the filtering to catch java 11 generated code and changes the implementation to use the bytecode matching system.
Javac emits fewer null checks for try with resources in 11 than in 8. This trips up the junk mutation filtering. This change broadens the filtering to catch java 11 generated code and changes the implementation to use the bytecode matching system.
This has gone a little easier than I'd exepected, so I'll push a release out later today. New filtering catches the issues in @johnsterken 's example, plus some sample real world projects. I expect there will be further issues with more complex examples, but current code seems to give 90% of the benefit. |
Looking good! I just tried your 1.6.3 version in the project that triggered this issue. It's working like a charm. Thanks @hcoles! |
Summary
Pitest is trying to mutate bytecode used for closing resources when using the try-with-resources in Java 11
Expected: No mutations on the generated parts of the bytecode, this behaviour works correctly in Java 8
Actual: Mutations happening on the generated parts in the bytecode used for closing the resources that are used in the try block
Steps to reproduce
mvn clean test pitest:mutationCoverage
Other info
Probably this is related to #689
Tested with OpenJDK
Java 11
Java 8
I also checked out the pitest repository locally. When I create a test in
TryWithResourcesFilterTest
with the Java 11 bytecode from my local JDK I don't see any mutation being filtered. When I run the same test on a Java 8 class file it does filter out mutationsjava8_pit_report.zip
java11_pit_report.zip
The text was updated successfully, but these errors were encountered: