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