public Set<DetailAST> getMethodCalls() {
return Collections.unmodifiableSet(methodCalls);
}
this code has been mutated as
public Set<DetailAST> getMethodCalls() {
return methodCalls;
}
for
<mutation unstable="false">
<sourceFile>EqualsAvoidNullCheck.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck$FieldFrame</mutatedClass>
<mutatedMethod>getMethodCalls</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator>
<description>replaced call to java/util/Collections::unmodifiableSet with argument</description>
<lineContent>return Collections.unmodifiableSet(methodCalls);</lineContent>
</mutation>
Modifying the code with Pitest from return Collections.unmodifiableSet(methodCalls) to return new HashSet<>(methodCalls) eliminates the guarantee of returning an unmodifiable set, potentially leading to unintended modifications and inconsistent behavior.
we have faced this issue at checkstyle/checkstyle#13127
and checkstyle/checkstyle#13126
this code has been mutated as
for
Modifying the code with Pitest from
return Collections.unmodifiableSet(methodCalls)toreturn new HashSet<>(methodCalls)eliminates the guarantee of returning an unmodifiable set, potentially leading to unintended modifications and inconsistent behavior.we have faced this issue at checkstyle/checkstyle#13127
and checkstyle/checkstyle#13126