InterfaceTypeParameterName

Since Checkstyle 5.8

Description

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

Properties

name description type default value since
format Specifies valid identifiers. Pattern "^[A-Z]$" 5.8

Examples

To configure the check:

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

Code Example:

interface FirstInterface<T> {} // OK
interface SecondInterface<t> {} // violation, name 't' must match pattern '^[A-Z]$'
        

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:

interface FirstInterface<T> {} // OK
interface SecondInterface<t> {} // OK
interface ThirdInterface<type> {} // violation, name 'type' must
                                        // match pattern '^[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