View Javadoc
1   /*
2   MemberName
3   format = ^m[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   * Contains simple mistakes:
16   * - Long lines
17   * - Tabs
18   * - Format of variables and parameters
19   * - Order of modifiers
20   * @author Oliver Burn
21   **/
22  final class InputMemberNameSimpleOne
23  {
24      // Long line ----------------------------------------------------------------
25      // Contains a tab ->        <-
26      // Contains trailing whitespace ->
27  
28      // Name format tests
29      //
30      /** Invalid format **/
31      public static final int badConstant = 2;
32      /** Valid format **/
33      public static final int MAX_ROWS = 2;
34  
35      /** Invalid format **/
36      private static int badStatic = 2;
37      /** Valid format **/
38      private static int sNumCreated = 0;
39  
40      /** Invalid format **/
41      private int badMember = 2; // violation 'Name 'badMember' must match pattern'
42      /** Valid format **/
43      private int mNumCreated1 = 0;
44      /** Valid format **/
45      protected int mNumCreated2 = 0;
46  
47      /** commas are wrong **/
48      private int[] mInts = new int[] {1,2, 3,
49                                       4};
50  
51      //
52      // Accessor tests
53      //
54      /** should be private **/
55      public static int sTest1;
56      /** should be private **/
57      protected static int sTest3;
58      /** should be private **/
59      static int sTest2;
60  
61      /** should be private **/
62      int mTest1;
63      /** should be private **/
64      public int mTest2;
65  
66      //
67      // Parameter name format tests
68      //
69  
70      /**
71       * @return hack
72       * @param badFormat1 bad format
73       * @param badFormat2 bad format
74       * @param badFormat3 bad format
75       * @throws java.lang.Exception abc
76       **/
77      int test1(int badFormat1,int badFormat2,
78                final int badFormat3)
79          throws java.lang.Exception
80      {
81          return 0;
82      }
83  
84      /** method that is 20 lines long **/
85      private void longMethod()
86      {
87          // a line
88          // a line
89          // a line
90          // a line
91          // a line
92          // a line
93          // a line
94          // a line
95          // a line
96          // a line
97          // a line
98          // a line
99          // a line
100         // a line
101         // a line
102         // a line
103         // a line
104         // a line
105     }
106 }