forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue checkstyle#13345: Enable Local Final Variable Name Check Exampl…
…s Test
- Loading branch information
1 parent
ab7ac57
commit 8780d60
Showing
8 changed files
with
115 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...ources/com/puppycrawl/tools/checkstyle/checks/naming/localfinalvariablename/Example1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*xml | ||
<module name="Checker"> | ||
<module name="TreeWalker"> | ||
<module name="LocalFinalVariableName"> | ||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/> | ||
</module> | ||
</module> | ||
</module> | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.naming.localfinalvariablename; | ||
|
||
// xdoc section -- start | ||
class Example1{ | ||
void MyMethod() { | ||
try { | ||
final int VAR1 = 5; // violation | ||
final int var1 = 10; | ||
} catch (Exception ex) { | ||
final int VAR2 = 15; // violation | ||
final int var2 = 20; | ||
} | ||
} | ||
} | ||
// xdoc section -- end |
10 changes: 0 additions & 10 deletions
10
...sources/com/puppycrawl/tools/checkstyle/checks/naming/localfinalvariablename/Example1.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ources/com/puppycrawl/tools/checkstyle/checks/naming/localfinalvariablename/Example3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*xml | ||
<module name="Checker"> | ||
<module name="TreeWalker"> | ||
<module name="LocalFinalVariableName"> | ||
<property name="format" value="^[A-Z][A-Z0-9]*$"/> | ||
<property name="tokens" value="PARAMETER_DEF,RESOURCE"/> | ||
</module> | ||
</module> | ||
</module> | ||
*/ | ||
|
||
package com.puppycrawl.tools.checkstyle.checks.naming.localfinalvariablename; | ||
|
||
import java.util.Scanner; | ||
|
||
// xdoc section -- start | ||
class Example3 { | ||
void MyMethod() { | ||
try(Scanner scanner = new Scanner(System.in)) { // violation | ||
|
||
final int VAR1 = 5; | ||
final int var1 = 10; | ||
} catch (final Exception ex) { // violation | ||
|
||
final int VAR2 = 15; | ||
final int var2 = 20; | ||
} | ||
} | ||
} | ||
// xdoc section -- end |
26 changes: 0 additions & 26 deletions
26
...sources/com/puppycrawl/tools/checkstyle/checks/naming/localfinalvariablename/Example3.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters