You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] ImmutableField: False positive on picocli annotated fields #6925
Description:
Non-final private field annotated by picocli's @Option annotation (and probably their @Parameters annotation too) violates the ImmutableField rule, but picocli will write such a field when the associated option is provided on the command line.
publicclassDemo {
@Option(
names = "--ref-date",
description = "Reference date (yyyy-MM-dd) for calculating"
)
privateLocalDaterefDate = LocalDate.now().withDayOfMonth(1);
publicvoidsomething() {...}
}
Expected outcome: PMD either ignores the ImmutableField rule when these specific picocli annotations are present, or provides some option to configure a custom set of annotations that should have the same effect.
PMD reports a violation at line 6, but that's wrong. That's a false positive.
changed the title [-][java] ImmutableField: false positive on picocli annotated fields with default[/-][+][java] ImmutableField: False positive on picocli annotated fields with default[/+]on Aug 20, 2026
changed the title [-][java] ImmutableField: False positive on picocli annotated fields with default[/-][+][java] ImmutableField: False positive on picocli annotated fields[/+]on Aug 20, 2026
Activity
[java] ImmutableField: false positive on picocli @Option/@parameters …
[-][java] ImmutableField: false positive on picocli annotated fields with default[/-][+][java] ImmutableField: False positive on picocli annotated fields with default[/+][-][java] ImmutableField: False positive on picocli annotated fields with default[/-][+][java] ImmutableField: False positive on picocli annotated fields[/+]