Issue #18028: Resolve Pitest Suppressions - api#18443
Conversation
| * @return An unmodifiable view of the provided Charset. | ||
| */ | ||
| public static Charset unmodifiableCharSet(Charset charset) { | ||
| return charset; |
There was a problem hiding this comment.
This code is nonsense.
We need different fix
There was a problem hiding this comment.
what about making two of the constructors in FileText.java to call this method it will be like this
public static Charset unmodifiableCharSet(Charset charset) {
return Objects.requireNonNullElseGet(charset, Charset::defaultCharset);
}
is this a good solution?
There was a problem hiding this comment.
I think we need to open issue on pitest.
Removal of this line doesn't make code compile-able, so it is defect of pitest, or there should be some settings to skip such cases, can you create issue?
There was a problem hiding this comment.
you mean that pitest should know that the variable is final and removing its assignment will result in error so it should not remove this assignment am i understanding right?
There was a problem hiding this comment.
Thanks, i will create an issue there
There was a problem hiding this comment.
I think that pitest ignores the compilation it only focuses that when they remove an assignment it results in a difference in the tests that at least one test will fail. And that's why i think checkstyle have mutations only on the assignment to null for final variables but we do not have mutations for assigning to other thing other than null even when it is final as in this case of the previous pr Issue #18033
if (items == null) {
this.items = null;
index = -1;
}
else {
this.items = new ArrayList<>(items);
index = items.size() - 1;
}
There was a problem hiding this comment.
Pitest works with bytecode, a lot more can be done on bytecode that is not allowed by compilation, but pitest still can improve.
There was a problem hiding this comment.
Done I created an issue hcoles/pitest#1440
There was a problem hiding this comment.
@romani
The Pitest maintainer confirmed that EXPERIMENTAL_MEMBER_VARIABLE is disabled by default because it produces low-quality mutations (like the equivalent mutations we're seeing). See their response in the issue.
I tested disabling the EXPERIMENTAL_MEMBER_VARIABLE mutator in our codebase, and it would actually help us remove most of the suppressions we currently have. The mutations it produces are indeed low quality and not providing much value.
Should we proceed with disabling this mutator globally in our Pitest configuration? This would clean up our suppressions significantly.
a442625 to
bfb1ad2
Compare
| <sourceFile>FileText.java</sourceFile> | ||
| <mutatedClass>com.puppycrawl.tools.checkstyle.api.FileText</mutatedClass> | ||
| <mutatedMethod><init></mutatedMethod> | ||
| <mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator</mutator> |
There was a problem hiding this comment.
Let's disable mutator at pom.xml with comment until issue in pitest are resolved
There was a problem hiding this comment.
Thanks, I will send a PR that comments EXPERIMENTAL_MEMBER_VARIABLE mutator and delete all the suppressions in various pitests related to this mutator
bfb1ad2 to
c6d7ea5
Compare
|
Done |
|
we will wait for pitest project to do update. |
|
Thanks a lot |
Issue #18028: Removed the suppression of the mutation charset = null; in Pitest Suppressions - api