You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by "Bill (GitHub)" <gi...@apache.org> on 2019/09/24 17:48:38 UTC

[GitHub] [geode] Bill commented on issue #4078: GEODE-7226: Ignore @Immutable classes in PMD

IMO it is not ok for the `StaticFieldsMustBeImmutable` rule to ignore classes with the `@Immutable` annotation.

The only purpose I can see, of an `@Immutable` anno, would be to express developer intent similarly to the way `@Override` does. For the expression of intent to be most useful, it would be enforced somehow, e.g. if I mark a class as `@Immutable` but that class has a non-final field, I should get a build-time error.

Mutability of static fields is an issue orthogonal to mutability of the class that contains the fields. Whether or not a class (i.e. its instances) are mutable, it should be viewed as a design bug, if that class has any non-final static field, or any final static field referencing a mutable object type.

So I'm a -1 on this PR as it stands.

[ Full content available at: https://github.com/apache/geode/pull/4078 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org