Skip to content

Commit

Permalink
ignore setter parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Luro02 committed Apr 4, 2024
1 parent 91e81d5 commit 351f078
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void process(CtVariable<?> ctVariable) {
}

// skip fields inside overridden methods
if (SpoonUtil.isInOverriddenMethod(ctVariable)) {
if (SpoonUtil.isInOverriddenMethod(ctVariable) || SpoonUtil.isInSetter(ctVariable)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ public static boolean isSetter(CtMethod<?> method) {
&& (method.isAbstract() || getEffectiveStatements(method.getBody()).size() == 1);
}

public static boolean isInSetter(CtElement ctElement) {
CtMethod<?> parent = ctElement.getParent(CtMethod.class);
return parent != null && SpoonUtil.isSetter(parent);
}

public static boolean isPrimitiveNumeric(CtTypeReference<?> type) {
return type.isPrimitive()
&& !type.getQualifiedName().equals("boolean")
Expand Down

0 comments on commit 351f078

Please sign in to comment.