RecordTypeParameterName

Since Checkstyle 8.36

Description

Checks that record type parameter names conform to a specified pattern.

Properties

name description type default value since
format Sets the pattern to match valid identifiers. Pattern "^[A-Z]$" 8.36

Examples

To configure the check:

<module name="Checker">
  <module name="TreeWalker">
    <module name="RecordTypeParameterName"/>
  </module>
</module>
        

An example of how to configure the check for names that are only a single letter is:

Configuration:

<module name="Checker">
  <module name="TreeWalker">
    <module name="RecordTypeParameterName">
      <property name="format" value="^[a-zA-Z]$"/>
    </module>
  </module>
</module>
        

Example:

record MyRecord1<T> {} // OK
record MyRecord2<t> {} // OK
record MyRecord3<abc> {} // violation, the record type parameter
// name should match the regular expression "^[a-zA-Z]$"
        

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Package

com.puppycrawl.tools.checkstyle.checks.naming

Parent Module

TreeWalker