Modifier Checks |
![]() |
ModifierDescriptionChecks that the order of modifiers conforms to the suggestions in the Java Language specification, sections 8.1.1, 8.3.1 and 8.4.3. The correct order is:
ExampleTo configure the check:
<module name="Modifier"/>
Packagecom.puppycrawl.tools.checkstyle.checks Parent ModuleRedundantModifierChecks that method declarations in interfaces include neither the public modifier nor the abstract modifier (see the Java Language specification, section 9.4). ExampleTo configure the check:
<module name="RedundantModifier"/>
Packagecom.puppycrawl.tools.checkstyle.checks Parent ModuleVisibilityModifierChecks visibility of class members. Only static final members may be public; other class members must be private unless property protectedAllowed or packageAllowed is set. Public members are not flagged if the name matches the public member regular expression (contains "^serialVersionUID$" by default). Note: Checkstyle 2 used to include "^f[A-Z][a-zA-Z0-9]*$" in the default pattern to allow CMP for EJB 1.1 with the default settings. With EJB 2.0 it is not longer necessary to have public access for persistent fields. Rationale: Enforce encapsulation. Properties
ExamplesTo configure the check:
<module name="VisibilityModifier"/>
To configure the check so that it allows package visible members:
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
</module>
To configure the check so that it allows no public members:
<module name="VisibilityModifier">
<property name="publicMemberPattern" value="^$"/>
</module>
Packagecom.puppycrawl.tools.checkstyle.checks Parent Module |
Copyright © 2002 Oliver Burn. All rights Reserved.