VisibiltyModifer allowPublicImmutableFields - enums not final classes?

27 views
Skip to first unread message

Edward Knight

unread,
Nov 26, 2015, 12:32:35 PM11/26/15
to check...@googlegroups.com
Hey,

Been playing around with the module "VisibilityModifier", specifically
the allowPublicImmutableFields property which is enabled by default. See
http://checkstyle.sourceforge.net/config_design.html#VisibilityModifier
.

Quoting the docs: "allowPublicImmutableFields - which allows immutable
fields be declared as public if defined in
final class."

I have found that this doesn't apply to enums (which are implicitly
final instead of explicitly like final classes) and causes a check
error. Is there a rationale behind this, or should the check not error?

This has been tested on the latest version (6.12.1).

Regards,
Edward Knight.

Roman Ivanov

unread,
Dec 4, 2015, 9:17:38 AM12/4/15
to Edward Knight, checkstyle
Hi Edward Knight,

Sorry for delay in answer.

please provide example of code and configuration to make sure we speak about the same case.

thanks,
Roman Ivanov



--
You received this message because you are subscribed to the Google Groups "checkstyle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to checkstyle+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

edw...@freeletics.com

unread,
Feb 8, 2016, 8:50:01 AM2/8/16
to checkstyle, e...@rdknig.ht
Hi Roman,

I just came across this same problem and created a bug for it: https://github.com/checkstyle/checkstyle/issues/2887

I'd like to create a pull request to fix it, but can't promise anything right now.

Cheers,
Edward
Reply all
Reply to author
Forward
0 new messages