Since Checkstyle 5.8
name | description | type | default value | since |
---|---|---|---|---|
format | Sets the pattern to match valid identifiers. | Pattern | "^[A-Z]$" |
5.8 |
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="InterfaceTypeParameterName"/> </module> </module>
Code Example:
class Example1 { interface FirstInterface<T> {} interface SecondInterface<t> {} // violation }
An example of how to configure the check for names that are only a single letter is:
<module name="Checker"> <module name="TreeWalker"> <module name="InterfaceTypeParameterName"> <property name="format" value="^[a-zA-Z]$"/> </module> </module> </module>
Code Example:
class Example2 { interface FirstInterface<T> {} interface SecondInterface<t> {} interface ThirdInterface<type> {} // violation }
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.naming