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

Copy of array(collections) to protect data from changes #1301

Open
Kevin222004 opened this issue Jan 30, 2024 · 1 comment
Open

Copy of array(collections) to protect data from changes #1301

Kevin222004 opened this issue Jan 30, 2024 · 1 comment

Comments

@Kevin222004
Copy link

<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.

@romani
Copy link
Contributor

romani commented Jan 31, 2024

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.

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