Pitest creates equivalent mutations
Mutator: https://pitest.org/quickstart/mutators/#EXPERIMENTAL_MEMBER_VARIABLE
It is also documented that:
Please Note: This mutator is likely to create equivalent mutations if a member variable is explicitly initialized with the Java default value for the specific type of the member variable as in
public class EquivalentMutant {
private int x = 0;
}
It was recently faced when a final field was initialized to null in a constructor. Removing the initialization is not possible as it will give a compile-time error.
/**
* The charset used to read the file.
* {@code null} if the file was reconstructed from a list of lines.
*/
private final Charset charset;
Though this is already documented, would it be possible to fix this? I.e. to mutate the member variable with the default value only when it has a non-default value?
@hcoles ping
Yes, it should now be possible to fix this. A static analysis filtering system was introduced long after this mutator was created that ought to be able to handle this. Similar filters have been created for the default operators, but the non defaults have been overlooked. Thanks for the suggestion.
@hcoles , is there any plan to fix this issue ?
or may be you just share a bit more links to code on how to do this (based on your comment similar problem was fixed in some other part) and somebody from web can send a fix.