View Javadoc
1   package com.google.checkstyle.test.chapter5naming.rule527localvariablenames;
2   
3   final class InputLocalVariableNameSimple {
4     public static final int badConstant = 2;
5   
6     public static final int MAX_ROWS = 2;
7   
8     private static int badStatic = 2;
9   
10    private static int sNumCreated = 0;
11  
12    private int badMember = 2;
13  
14    private int numCreated1 = 0;
15  
16    protected int numCreated2 = 0;
17  
18    private int[] ints = new int[] {1, 2, 3, 4};
19  
20    /** test local variables. */
21    private void localVariables() {
22      // bad examples
23      int a;
24      int aA; // violation 'Local variable name 'aA' must match pattern'
25      int a1_a; // violation 'Local variable name 'a1_a' must match pattern'
26      int A_A; // violation 'Local variable name 'A_A' must match pattern'
27      int aa2_a; // violation 'Local variable name 'aa2_a' must match pattern'
28      int _a; // violation 'Local variable name '_a' must match pattern'
29      int _aa; // violation 'Local variable name '_aa' must match pattern'
30      int aa_; // violation 'Local variable name 'aa_' must match pattern'
31      int aaa$aaa; // violation 'Local variable name .* must match pattern'
32      int $aaaaaa; // violation 'Local variable name .* must match pattern'
33      int aaaaaa$; // violation 'Local variable name .* must match pattern'
34  
35      // good examples
36      int aa;
37      int aaAa1a;
38      int aaAaaAa2a1;
39    }
40  }