Skip to content

Commit

Permalink
ignore new class/array assignments for Arrays.fill
Browse files Browse the repository at this point in the history
  • Loading branch information
Luro02 committed Apr 2, 2024
1 parent 7194c45 commit 114fd18
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import spoon.reflect.code.CtInvocation;
import spoon.reflect.code.CtLiteral;
import spoon.reflect.code.CtNewArray;
import spoon.reflect.code.CtNewClass;
import spoon.reflect.code.CtOperatorAssignment;
import spoon.reflect.code.CtStatement;
import spoon.reflect.code.CtVariableAccess;
Expand Down Expand Up @@ -161,6 +162,11 @@ private void checkArraysFill(CtFor ctFor) {
return;
}

// ignore new array or new class assignments
if (ctAssignment.getAssignment() instanceof CtNewClass<?> || ctAssignment.getAssignment() instanceof CtNewArray<?>) {
return;
}

CtExpression<?> rhs = ctAssignment.getAssignment();
if (!SpoonUtil.isImmutable(rhs.getType())) {
return;
Expand Down

0 comments on commit 114fd18

Please sign in to comment.