Open Shawn-Armstrong opened 1 year ago
Thanks for the report and the reproducable sample.
The problem is that this is a mutation called only from static initialization code. This means the code is exectued only once per jvm and causes multiple problems for mutation testing (theres an entry on this in the FAQ which I can't link to as I seem to have cunningly include no anchors in the page).
Pitest avoids mutating code in static initializers and tries to avoid mutating code called only from static initializers. The filtering doesn't seem to be working in this case, probably because the code predates lambdas and hasn't been updated.
The analysis was indeed failing to consider invokeDynamic calls. A fix has been merged and will be in the next release.
Thanks again for the high quality bug report.
@Shawn-Armstrong
This took a bit more work than expected as the initial fix resulted in the suppression of valid mutants when code execution was delayed and had to be reverted.
1.16.3 is now released which should solve these issues.
I've encountered a mutant that I wasn't able to remove in a Java 17 code base using PITest (1.15.0) in conjunction with JUnit5 (5.9.3) test cases. The code is a bit niche and poorly written but I managed to recreate it in this repository.
Details
The mutant lives at this line:
https://github.com/Shawn-Armstrong/mutation_case/blob/0fc16a8e8d0f8a2a883898e9aa4ea2759c27abc4/app/src/main/java/myjavaproject2/Toto.java#L19
The report indicated the following mutation:
19 | | 1. replaced return value with null for myjavaproject2/Toto$TOYS::lambda$static$0 → SURVIVED -- | -- | --ENUM
andstatic final
fields.