fix for 1223290 (LocalFinalVariableNameCheck fail on catch variable)

This commit is contained in:
Oleg Sukhodolsky 2005-06-24 21:02:25 +00:00
parent 5fa648f830
commit 3d281a9683
3 changed files with 11 additions and 3 deletions

View File

@ -25,7 +25,8 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
/**
* <p>
* Checks that local final variable names conform to a format specified
* by the format property. The format is a
* by the format property. A catch parameter is considered to be
* a local variable.The format is a
* {@link java.util.regex.Pattern regular expression} and defaults to
* <strong>^[a-z][a-zA-Z0-9]*$</strong>.
* </p>
@ -60,7 +61,10 @@ public class LocalFinalVariableNameCheck
/** @see com.puppycrawl.tools.checkstyle.api.Check */
public int[] getDefaultTokens()
{
return new int[] {TokenTypes.VARIABLE_DEF};
return new int[] {
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
};
}
/** @see com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck */

View File

@ -58,7 +58,8 @@
</tr>
<tr>
<td><span class="code">LocalFinalVariableName</span></td>
<td>local, <span class="code">final</span> variables</td>
<td>local, <span class="code">final</span> variables, including
<span class="code">catch</span> parameters</td>
<td><span class="default">^[a-z][a-zA-Z0-9]*$</span></td>
</tr>
<tr>

View File

@ -28,6 +28,9 @@
<li>TypecastParenPad and ParenPad are now smarter in detecting
if paren is part of typecast (bug 1217798)</li>
<li>LocalFinalVariable now also checks catch parameters (bug
1223290)</li>
</ul>
<p>Other improvements:</p>