Skip to content

Commit

Permalink
Also ignore C# const fields in FinalizePrivateFields
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Aug 24, 2024
1 parent 30cb79f commit 7c6c218
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private List<J.VariableDeclarations.NamedVariable> collectPrivateFields(Cursor c
.map(J.VariableDeclarations.class::cast)
.filter(mv -> mv.hasModifier(J.Modifier.Type.Private)
&& !mv.hasModifier(J.Modifier.Type.Final)
&& (!(topLevel instanceof Cs) || mv.getModifiers().stream().noneMatch(m -> "readonly".equals(m.getKeyword())))
&& (!(topLevel instanceof Cs) || mv.getModifiers().stream().noneMatch(m -> "readonly".equals(m.getKeyword()) || "const".equals(m.getKeyword())))
&& !mv.hasModifier(J.Modifier.Type.Volatile))
.filter(mv -> !anyAnnotationApplied(new Cursor(bodyCursor, mv)))
.map(J.VariableDeclarations::getVariables)
Expand Down

0 comments on commit 7c6c218

Please sign in to comment.