View Javadoc
1   /*
2   LocalVariableName
3   format = (default)^[a-z][a-zA-Z0-9]*$
4   allowOneCharVarInForLoop = (default)false
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.naming.localvariablename;
10  
11  /**
12   * Tests having inner types
13   * @author Oliver Burn
14   **/
15  class InputLocalVariableNameInnerClass
16  {
17      // Ignore - two violations
18      class InnerInner2
19      {
20          // Ignore
21          public int fData;
22      }
23  
24      // Ignore - 2 violations
25      interface InnerInterface2
26      {
27          // Ignore - should be all upper case
28          String data = "zxzc";
29  
30          // Ignore
31          class InnerInterfaceInnerClass
32          {
33              // Ignore - need Javadoc and made private
34              public int rData;
35  
36              /** needs to be made private unless allowProtected. */
37              protected int protectedVariable;
38  
39              /** needs to be made private unless allowPackage. */
40              int packageVariable;
41          }
42      }
43  
44      /** demonstrate bug in handling static final **/
45      protected static Object sWeird = new Object();
46      /** demonstrate bug in handling static final **/
47      static Object sWeird2 = new Object();
48  
49      /** demonstrate bug in local final variable */
50      public interface Inter
51      {
52      }
53  
54       public static void main()
55       {
56          Inter m = new Inter()
57          {
58              private static final int CDS = 1;
59  
60              private int ABC;
61          };
62       }
63  
64      /** annotation field incorrectly named. */
65      @interface InnerAnnotation
66      {
67          /** Ignore - should be all upper case. */
68          String data = "zxzc";
69      }
70  
71      /** enum with public member variable */
72      enum InnerEnum
73      {
74          /** First constant */
75          A,
76  
77          /** Second constant */
78          B;
79  
80          /** Should be private */
81          public int someValue;
82      }
83  }