Since Checkstyle 8.31
Checks if unnecessary semicolon is used after type declaration.
This check is not applicable to nested type declarations, UnnecessarySemicolonAfterTypeMemberDeclaration is responsible for it.
name | description | type | default value | since |
---|---|---|---|---|
tokens | tokens to check | subset of tokens CLASS_DEF , INTERFACE_DEF , ENUM_DEF , ANNOTATION_DEF , RECORD_DEF . | CLASS_DEF , INTERFACE_DEF , ENUM_DEF , ANNOTATION_DEF , RECORD_DEF . | 8.31 |
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/> </module> </module>
Example:
class Example1 { class Nested { }; // OK, nested type declarations are ignored }; // violation interface B { }; // violation enum C { }; // violation @interface D { }; // violation
To configure the check to detect unnecessary semicolon only after top level class definitions:
<module name="Checker"> <module name="TreeWalker"> <module name="UnnecessarySemicolonAfterOuterTypeDeclaration"> <property name="tokens" value="CLASS_DEF"/> </module> </module> </module>
Example:
class Example2 { class Nested { }; // OK, nested type declarations are ignored }; // violation interface T { }; enum U { }; @interface V { };
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
com.puppycrawl.tools.checkstyle.checks.coding