blob: 71bd1edbb5d04e845f7eb4d9d6b4aa0544412b66 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://maven.apache.org/XDOC/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<head>
<title>Naming Conventions</title>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/>
<script type="text/javascript" src="js/anchors.js"/>
<script type="text/javascript" src="js/google-analytics.js"/>
<link rel="icon" href="images/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/ico" />
</head>
<body>
<section name="Content">
<macro name="toc">
<param name="fromDepth" value="1"/>
<param name="toDepth" value="1"/>
</macro>
</section>
<section name="Overview">
<p>
Each of these naming modules validates identifiers for particular code
elements. Valid identifiers for a naming module are specified by its
<code> format</code> property. The value of <code>format</code> is a <a
href="https://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html">
regular expression</a> for valid identifiers.
</p>
</section>
<section name="AbbreviationAsWordInName">
<p>Since Checkstyle 5.8</p>
<subsection name="Description" id="AbbreviationAsWordInName_Description">
<p>
The Check validate abbreviations(consecutive capital letters)
length in identifier name, it also allows to enforce camel case naming. Please read more at
<a href="http://checkstyle.sourceforge.net/reports/google-java-style-20170228.html#s5.3-camel-case">
Google Style Guide</a>
to get to know how to avoid long abbreviations in names.
</p>
<p>
<code>allowedAbbreviationLength</code> specifies how many consecutive capital letters are
allowed in the identifier.
A value of <i>3</i> indicates that up to 4 consecutive capital letters are allowed,
one after the other, before a violation is printed. The identifier 'MyTEST' would be
allowed, but 'MyTESTS' would not be.
A value of <i>0</i> indicates that only 1 consecutive capital letter is allowed. This
is what should be used to enforce strict camel casing. The identifier 'MyTest' would
be allowed, but 'MyTEst' would not be.
</p>
</subsection>
<subsection name="Properties" id="AbbreviationAsWordInName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>allowedAbbreviationLength</td>
<td>Indicate the number of consecutive capital letters allowed in targeted
identifiers (abbreviations in the classes, interfaces, variables and methods
names, ... ).</td>
<td><a href="property_types.html#integer">Integer</a></td>
<td><code>3</code></td>
<td>5.8</td>
</tr>
<tr>
<td>allowedAbbreviations</td>
<td>Specify list of abbreviations that must be skipped for checking.
Abbreviations should be separated by comma.</td>
<td><a href="property_types.html#stringSet">String Set</a></td>
<td><code>{}</code></td>
<td>5.8</td>
</tr>
<tr>
<td>ignoreFinal</td>
<td>Allow to skip variables with <code>final</code> modifier.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.8</td>
</tr>
<tr>
<td>ignoreStatic</td>
<td>Allow to skip variables with <code>static</code> modifier.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.8</td>
</tr>
<tr>
<td>ignoreOverriddenMethods</td>
<td>Allow to ignore methods tagged with <code>@Override</code> annotation
(that usually mean inherited name).</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.8</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">
CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">
INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">
ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
ANNOTATION_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">
ANNOTATION_FIELD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">
PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">
VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">
METHOD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">
ENUM_CONSTANT_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">
CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">
INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">
ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
ANNOTATION_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">
ANNOTATION_FIELD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">
PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">
VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">
METHOD_DEF</a>.
</td>
<td>5.8</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="AbbreviationAsWordInName_Examples">
<p>
Default configuration
</p>
<source>
&lt;module name="AbbreviationAsWordInName"/&gt;
</source>
<p>
To configure to check variables and classes identifiers,
do not ignore variables with static modifier and allow
no abbreviations (enforce camel case phrase) and
allow no abbreviations to use (camel case phrase) and allow XML and URL abbreviations.
</p>
<source>
&lt;module name="AbbreviationAsWordInName"&gt;
&lt;property name="tokens" value="VARIABLE_DEF,CLASS_DEF"/&gt;
&lt;property name="ignoreStatic" value="false"/&gt;
&lt;property name="allowedAbbreviationLength" value="1"/&gt;
&lt;property name="allowedAbbreviations" value="XML,URL"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="AbbreviationAsWordInName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbbreviationAsWordInName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbbreviationAsWordInName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="AbbreviationAsWordInName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22abbreviation.as.word%22">
abbreviation.as.word</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="AbbreviationAsWordInName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="AbbreviationAsWordInName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="AbstractClassName">
<p>Since Checkstyle 3.2</p>
<subsection name="Description" id="AbstractClassName_Description">
<p>
Ensures that the names of abstract classes conforming to some regular expression and
check that <code>abstract</code> modifier exists.
</p>
<p>
Rationale: Abstract classes are convenience base class implementations of
interfaces, not types as such. As such they should be named to indicate this.
Also if names of classes starts with 'Abstract' it's very convenient that
they will have abstract modifier.
</p>
</subsection>
<subsection name="Properties" id="AbstractClassName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specify valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^Abstract.+$"</code></td>
<td>3.2</td>
</tr>
<tr>
<td>ignoreModifier</td>
<td>
Control whether to ignore checking for the
<code>abstract</code> modifier on classes that match the
name.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
<tr>
<td>ignoreName</td>
<td>
Control whether to ignore checking the name. Realistically
only useful if using the check to identify that match name
and do not have the <code>abstract</code> modifier.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="AbstractClassName_Examples">
<p>
The following example shows how to configure the
<code>AbstractClassName</code> to checks names, but ignore
missing <code>abstract</code> modifiers:
</p>
<p>Configuration:</p>
<source>
&lt;module name=&quot;AbstractClassName&quot;&gt;
&lt;property name=&quot;ignoreModifier&quot; value=&quot;true&quot;/&gt;
&lt;/module&gt;
</source>
<p>Example:</p>
<pre>
abstract class AbstractFirstClass {} // OK
abstract class SecondClass {} // violation, it should match the pattern "^Abstract.+$"
class AbstractThirdClass {} // OK, no "abstract" modifier
</pre>
</subsection>
<subsection name="Example of Usage" id="AbstractClassName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbstractClassName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="AbstractClassName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22illegal.abstract.class.name%22">
illegal.abstract.class.name</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22no.abstract.class.modifier%22">
no.abstract.class.modifier</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="AbstractClassName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="AbstractClassName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="CatchParameterName">
<p>Since Checkstyle 6.14</p>
<subsection name="Description" id="CatchParameterName_Description">
<p>
Checks that <code>catch</code> parameter names conform to a format specified by the
format property.
</p>
<p>
Default pattern has the following characteristic:
</p>
<ul>
<li>allows names beginning with two lowercase letters followed by at least one uppercase
or lowercase letter</li>
<li>allows <code>e</code> abbreviation (suitable for exceptions end errors)</li>
<li>allows <code>ex</code> abbreviation (suitable for exceptions)</li>
<li>allows <code>t</code> abbreviation (suitable for throwables)</li>
<li>prohibits numbered abbreviations like <code>e1</code> or <code>t2</code></li>
<li>prohibits one letter prefixes like <code>pException</code></li>
<li>prohibits two letter abbreviations like <code>ie</code> or <code>ee</code></li>
<li>prohibits any other characters than letters</li>
</ul>
</subsection>
<subsection name="Properties" id="CatchParameterName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td>
<a href="property_types.html#regexp">Regular Expression</a>
</td>
<td>
<code>"^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"</code>
</td>
<td>6.14</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="CatchParameterName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;CatchParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that begin with
a lower case letter, followed by any letters or digits is:
</p>
<p>Configuration:</p>
<source>
&lt;module name="CatchParameterName"&gt;
&lt;property name="format" value="^[a-z][a-zA-Z0-9]+$"/&gt;
&lt;/module&gt;
</source>
<p>Example:</p>
<pre>
public class MyTest {
public void myTest() {
try {
// ...
} catch (ArithmeticException ex) { //OK
// ...
} catch (ArrayIndexOutOfBoundsException ex2) { //OK
// ...
} catch (IOException thirdException) { //OK
// ...
} catch (Exception FourthException) { // violation, the initial letter
// should be lowercase
// ...
}
}
}
</pre>
</subsection>
<subsection name="Example of Usage" id="CatchParameterName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CatchParameterName">
Google Style
</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CatchParameterName">
Checkstyle Style
</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="CatchParameterName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="CatchParameterName_Package">
<p>com.puppycrawl.tools.checkstyle.checks.naming</p>
</subsection>
<subsection name="Parent Module" id="CatchParameterName_Parent_Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="ClassTypeParameterName">
<p>Since Checkstyle 5.0</p>
<subsection name="Description" id="ClassTypeParameterName_Description">
<p>Checks that class type parameter names conform to a format specified by the format
property.</p>
</subsection>
<subsection name="Properties" id="ClassTypeParameterName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z]$"</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="ClassTypeParameterName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;ClassTypeParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that are only a single letter is:
</p>
<p>Configuration:</p>
<source>
&lt;module name=&quot;ClassTypeParameterName&quot;&gt;
&lt;property name="format" value="^[a-zA-Z]$"/&gt;
&lt;/module&gt;
</source>
<p>Example:</p>
<pre>
class MyClass1&lt;T&gt; {} // OK
class MyClass2&lt;t&gt; {} // OK
class MyClass3&lt;abc&gt; {} // violation, the class type parameter
// name should match the regular expression "^[a-zA-Z]$"
</pre>
</subsection>
<subsection name="Example of Usage" id="ClassTypeParameterName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassTypeParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassTypeParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="ClassTypeParameterName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="ClassTypeParameterName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="ClassTypeParameterName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="ConstantName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="ConstantName_Description">
<p>
Checks that constant names conform to a format specified by the format property.
A <em>constant</em> is a <strong>static</strong> and <strong>final</strong> field or an
interface/annotation field, except <strong>serialVersionUID</strong> and
<strong>serialPersistentFields</strong>.
</p>
</subsection>
<subsection name="Properties" id="ConstantName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="ConstantName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name="ConstantName"/&gt;
</source>
<p>
The following configuration apart from names allowed by default allows <code>log</code>
or <code>logger</code>:
</p>
<source>
&lt;module name=&quot;ConstantName&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;^log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="ConstantName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ConstantName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ConstantName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="ConstantName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="ConstantName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="ConstantName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="InterfaceTypeParameterName">
<p>Since Checkstyle 5.8</p>
<subsection name="Description" id="InterfaceTypeParameterName_Description">
<p>
Checks that interface type parameter names conform to a format specified by the format
property.
</p>
</subsection>
<subsection name="Properties" id="InterfaceTypeParameterName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z]$"</code></td>
<td>5.8</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="InterfaceTypeParameterName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;InterfaceTypeParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that are only a single
letter is:
</p>
<source>
&lt;module name="InterfaceTypeParameterName"&gt;
&lt;property name="format" value="^[a-zA-Z]$"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="InterfaceTypeParameterName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+InterfaceTypeParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+InterfaceTypeParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="InterfaceTypeParameterName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="InterfaceTypeParameterName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="InterfaceTypeParameterName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="LambdaParameterName">
<p>Since Checkstyle 8.11</p>
<subsection name="Description" id="LambdaParameterName_Description">
<p>
Check to verify lambda parameter names.
</p>
</subsection>
<subsection name="Properties" id="LambdaParameterName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>8.11</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="LambdaParameterName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name="LambdaParameterName"/&gt;
</source>
<p>
An example of how to configure the check for names that begin with a lower case letter,
followed by letters is:
</p>
<source>
&lt;module name="LambdaParameterName"&gt;
&lt;property name="format" value="^[a-z]([a-zA-Z]+)*$"/&gt;
&lt;/module&gt;
</source>
<p>Example of checking with this config:</p>
<source>
public class TestClass {
Function&lt;String, String&gt; function1 = str -> str.toUpperCase().trim();
Function&lt;String, String&gt; function2 = _s -> _s.trim().toUpperCase(); // violation
public boolean testMethod(String sentence) {
return Stream.of(sentence.split(" "))
.map(word -> word.trim())
.anyMatch(Word -> "in".equals(Word)); // violation
}
}
</source>
</subsection>
<subsection name="Example of Usage" id="LambdaParameterName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LambdaParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LambdaParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="LambdaParameterName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="LambdaParameterName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="LambdaParameterName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="LocalFinalVariableName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="LocalFinalVariableName_Description">
<p>
Checks that local final variable names conform to a format specified
by the format property. A catch parameter and resources in try statements
are considered to be a local, final variables.
</p>
</subsection>
<subsection name="Properties" id="LocalFinalVariableName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">
VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">
PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RESOURCE">
RESOURCE</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">
VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">
PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RESOURCE">
RESOURCE</a>.
</td>
<td>3.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="LocalFinalVariableName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;LocalFinalVariableName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that are only upper case letters and
digits is:
</p>
<source>
&lt;module name=&quot;LocalFinalVariableName&quot;&gt;
&lt;property name="format" value="^[A-Z][A-Z0-9]*$"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="LocalFinalVariableName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalFinalVariableName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalFinalVariableName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="LocalFinalVariableName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="LocalFinalVariableName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="LocalFinalVariableName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="LocalVariableName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="LocalVariableName_Description">
<p>
Checks that local, non-<code>final</code> variable names conform to a format specified
by the format property. A catch parameter is considered to be a local variable.
</p>
</subsection>
<subsection name="Properties" id="LocalVariableName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>allowOneCharVarInForLoop</td>
<td>
Allow one character variable name in
<a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html">
initialization expressions</a> in FOR loop. For example:
<pre>
for (int i = 1; i &lt; 10; i++) {}
</pre>
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.8</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="LocalVariableName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;LocalVariableName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that begin with a lower
case letter, followed by letters, digits, and underscores is:
</p>
<source>
&lt;module name="LocalVariableName"&gt;
&lt;property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/&gt;
&lt;/module&gt;
</source>
<p>
An example of one character variable name in initialization expression(like "i")
in FOR loop:
</p>
<source>
for(int i = 1; i &lt; 10; i++) {}
</source>
<p>
An example of how to configure the check to allow one character variable name in
<a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html">
initialization expressions</a> in FOR loop:
</p>
<source>
&lt;module name="LocalVariableName"&gt;
&lt;property name="allowOneCharVarInForLoop" value="true"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="LocalVariableName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="LocalVariableName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="LocalVariableName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="LocalVariableName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="MemberName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="MemberName_Description">
<p>
Checks that instance variable names conform to a format specified by the format property.
</p>
</subsection>
<subsection name="Properties" id="MemberName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>3.4</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="MemberName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name="MemberName"/&gt;
</source>
<p>
An example of how to configure the check for names that begin with
<code>&quot;m&quot;</code>, followed by an upper case letter, and then letters and
digits is:
</p>
<source>
&lt;module name=&quot;MemberName&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;^m[A-Z][a-zA-Z0-9]*$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="MemberName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="MemberName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="MemberName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="MemberName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="MethodName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="MethodName_Description">
<p>
Checks that method names conform to a format specified by the format property.
</p>
<p>
Also, checks if a method name has the same name as the residing class.
The default is false (it is not allowed). It is legal in Java to have
method with the same name as a class. As long as a return type is specified
it is a method and not a constructor which it could be easily confused as.
Does not check-style the name of an overridden methods because the developer
does not have a choice in renaming such methods.
</p>
</subsection>
<subsection name="Properties" id="MethodName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>allowClassName</td>
<td>
Controls whether to allow a method name to have the same
name as the residing class name. This is not to be confused
with a constructor. An easy mistake is to place a return
type on a constructor declaration which turns it into a
method. For example:
<pre>
class MyClass {
public void MyClass() {} //this is a method
public MyClass() {} //this is a constructor
}
</pre>
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.1</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="MethodName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;MethodName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that begin with a lower case letter,
followed by letters, digits, and underscores is:
</p>
<source>
&lt;module name="MethodName"&gt;
&lt;property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/&gt;
&lt;/module&gt;
</source>
<p>
An example of how to configure the check to allow method names to be equal to the
residing class name is:
</p>
<source>
&lt;module name="MethodName"&gt;
&lt;property name="allowClassName" value="true"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="MethodName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="MethodName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22method.name.equals.class.name%22">
method.name.equals.class.name</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="MethodName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="MethodName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="MethodTypeParameterName">
<p>Since Checkstyle 5.0</p>
<subsection name="Description" id="MethodTypeParameterName_Description">
<p>
Checks that method type parameter names conform to a format specified by the format
property.
</p>
</subsection>
<subsection name="Properties" id="MethodTypeParameterName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z]$"</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="MethodTypeParameterName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;MethodTypeParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that are only a single letter is:
</p>
<source>
&lt;module name="MethodTypeParameterName"&gt;
&lt;property name="format" value="^[a-zA-Z]$"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="MethodTypeParameterName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodTypeParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodTypeParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="MethodTypeParameterName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="MethodTypeParameterName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="MethodTypeParameterName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="PackageName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="PackageName_Description">
<p>
Checks that package names conform to a format specified by the format property.
</p>
<p>
The default value of <code>format</code> for module <code>PackageName</code> has been
chosen to match the requirements in the <a
href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.5.3">Java
Language specification</a> and the Sun coding conventions. However
both underscores and uppercase letters are rather uncommon, so most
configurations should probably assign value <code>^[a-z]+(\.[a-z][a-z0-9]*)*$</code> to
<code>format</code> for module <code>PackageName</code>.
</p>
</subsection>
<subsection name="Properties" id="PackageName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$"</code></td>
<td>3.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="PackageName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name="PackageName"/&gt;
</source>
<p>
An example of how to configure the check to ensure with packages start with a lowercase
letter and only contains lowercase letters or numbers is:
</p>
<source>
&lt;module name=&quot;PackageName&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;^[a-z]+(\.[a-z][a-z0-9]*)*$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="PackageName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="PackageName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="PackageName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="PackageName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="ParameterName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="ParameterName_Description">
<p>
Checks that method parameter names conform to a format specified
by the format property. By using <code>accessModifiers</code> property it is possible
to specify different formats for methods at different visibility levels.
</p>
<p>
To validate <code>catch</code> parameters please use
<a href="#CatchParameterName">CatchParameterName</a>.
</p>
<p>
To validate lambda parameters please use
<a href="#LambdaParameterName">LambdaParameterName</a>.
</p>
</subsection>
<subsection name="Properties" id="ParameterName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>ignoreOverridden</td>
<td>
Allows to skip methods with Override annotation from validation. For example, the
following method's parameter will be skipped from validation, if
ignoreOverridden is true:
<pre>
@Override
public boolean equals(Object o) {
return super.equals(o);
}
</pre>
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
<td>6.12.1</td>
</tr>
<tr>
<td>accessModifiers</td>
<td>Access modifiers of methods where parameters are checked.</td>
<td><a href="property_types.html#access_modifiers">Access Modifier Set</a></td>
<td><code>public, protected, package, private</code></td>
<td>7.5</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="ParameterName_Examples">
<p>
An example of how to configure the check:
</p>
<source>
&lt;module name=&quot;ParameterName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that begin with a lower case letter,
followed by letters, digits, and underscores:
</p>
<source>
&lt;module name="ParameterName"&gt;
&lt;property name="format" value="^[a-z][_a-zA-Z0-9]+$"/&gt;
&lt;/module&gt;
</source>
<p>
An example of how to configure the check to skip methods with Override annotation from
validation:
</p>
<source>
&lt;module name="ParameterName"&gt;
&lt;property name="ignoreOverridden" value="true"/&gt;
&lt;/module&gt;
</source>
<p>
An example of how to configure the check for names that begin with
a lower case letter, followed by letters and digits is:
</p>
<source>
&lt;module name="ParameterName"&gt;
&lt;property name="format" value="^[a-z][a-zA-Z0-9]+$"/&gt;
&lt;/module&gt;
</source>
<p>
The following configuration checks that the parameters always start with two
lowercase characters and, in addition, that public method parameters cannot be one
character long:
</p>
<source>
&lt;module name=&quot;ParameterName&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;^[a-z]([a-z0-9][a-zA-Z0-9]*)?$&quot;/&gt;
&lt;property name=&quot;accessModifiers&quot; value=&quot;protected, package, private&quot;/&gt;
&lt;message key=&quot;name.invalidPattern&quot;
value=&quot;Parameter name ''{0}'' must match pattern ''{1}''&quot;/&gt;
&lt;/module&gt;
&lt;module name=&quot;ParameterName&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;^[a-z][a-z0-9][a-zA-Z0-9]*$&quot;/&gt;
&lt;property name=&quot;accessModifiers&quot; value=&quot;public&quot;/&gt;
&lt;message key=&quot;name.invalidPattern&quot;
value=&quot;Parameter name ''{0}'' must match pattern ''{1}''&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="ParameterName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="ParameterName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="ParameterName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="ParameterName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="StaticVariableName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="StaticVariableName_Description">
<p>
Checks that {@code static}, non-{@code final} variable names conform to a format
specified by the format property.
</p>
</subsection>
<subsection name="Properties" id="StaticVariableName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[a-z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="StaticVariableName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name=&quot;StaticVariableName&quot;/&gt;
</source>
<p>
An example of how to configure the check for names that begin with a lower case letter,
followed by letters, digits, and underscores is:
</p>
<source>
&lt;module name="StaticVariableName"&gt;
&lt;property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="StaticVariableName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+StaticVariableName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+StaticVariableName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="StaticVariableName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="StaticVariableName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="StaticVariableName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="TypeName">
<p>Since Checkstyle 3.0</p>
<subsection name="Description" id="TypeName_Description">
<p>
Checks that type names for classes, interfaces, enums, and annotations conform to a
format specified by the format property.
</p>
</subsection>
<subsection name="Properties" id="TypeName_Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>format</td>
<td>Specifies valid identifiers.</td>
<td><a href="property_types.html#regexp">Regular Expression</a></td>
<td><code>"^[A-Z][a-zA-Z0-9]*$"</code></td>
<td>3.0</td>
</tr>
<tr>
<td>applyToPublic</td>
<td>Controls whether to apply the check to public member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToProtected</td>
<td>Controls whether to apply the check to protected member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPackage</td>
<td>
Controls whether to apply the check to package-private member.
</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>applyToPrivate</td>
<td>Controls whether to apply the check to private member.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>true</code></td>
<td>5.0</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">
CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">
INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">
ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
ANNOTATION_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">
CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">
INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">
ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">
ANNOTATION_DEF</a>.
</td>
<td>3.0</td>
</tr>
</table>
</subsection>
<subsection name="Examples" id="TypeName_Examples">
<p>
An example of how to configure the check is:
</p>
<source>
&lt;module name="TypeName"/&gt;
</source>
<p>
An example of how to configure the check for names that begin with a lower case letter,
followed by letters, digits, and underscores is:
</p>
<source>
&lt;module name="TypeName"&gt;
&lt;property name="format" value="^[a-z](_?[a-zA-Z0-9]+)*$"/&gt;
&lt;/module&gt;
</source>
<p>
The following configuration element ensures that
interface names begin with <code>"I_"</code>, followed by
letters and digits:
</p>
<source>
&lt;module name=&quot;TypeName&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;^I_[a-zA-Z0-9]*$&quot;/&gt;
&lt;property name=&quot;tokens&quot;
value=&quot;INTERFACE_DEF&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage" id="TypeName_Example_of_Usage">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName">
Google Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName">
Sun Style</a>
</li>
<li>
<a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Error Messages" id="TypeName_Error_Messages">
<ul>
<li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22">
name.invalidPattern</a>
</li>
</ul>
<p>
All messages can be customized if the default message doesn't suit you.
Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to.
</p>
</subsection>
<subsection name="Package" id="TypeName_Package">
<p> com.puppycrawl.tools.checkstyle.checks.naming </p>
</subsection>
<subsection name="Parent Module" id="TypeName_Parent_Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
</body>
</document>