pitest icon indicating copy to clipboard operation
pitest copied to clipboard

Copy of array(collections) to protect data from changes

Open Kevin222004 opened this issue 1 year ago • 1 comments

<mutation unstable="false"> 
   <sourceFile>JavadocMethodCheck.java</sourceFile> 
   <mutatedClass>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck</mutatedClass> 
   <mutatedMethod>setAccessModifiers</mutatedMethod> 
   <mutator>org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator</mutator> 
   <description>replaced call to java/util/Arrays::copyOf with argument</description> 
   <lineContent>Arrays.copyOf(accessModifiers, accessModifiers.length);</lineContent> 
 </mutation> 

It is possible that the removal of Arrays.copyOf will not make any issue in the code. but still, it will protect data from changes.

Kevin222004 avatar Jan 30 '24 18:01 Kevin222004

In recent world, people do care about data protection more than memory, so this pattern is frequent and better to not raise flag on it. Extra config is completely ok, to let reconcile team with different vision on what is good.

romani avatar Jan 31 '24 02:01 romani