Skip to content
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

Unreachable Mutant, ENUM::lambda$static$0 #1273

Open
Shawn-Armstrong opened this issue Nov 6, 2023 · 2 comments
Open

Unreachable Mutant, ENUM::lambda$static$0 #1273

Shawn-Armstrong opened this issue Nov 6, 2023 · 2 comments

Comments

@Shawn-Armstrong
Copy link

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

@hcoles
Copy link
Owner

hcoles commented Nov 6, 2023

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.

@hcoles
Copy link
Owner

hcoles commented Nov 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants