View Javadoc
1   /*
2   MethodName
3   format = (default)^[a-z][a-zA-Z0-9]*$
4   allowClassName = (default)false
5   applyToPublic = (default)true
6   applyToProtected = (default)true
7   applyToPackage = (default)true
8   applyToPrivate = (default)true
9   
10  
11  */
12  
13  package com.puppycrawl.tools.checkstyle.checks.naming.methodname;
14  
15  /**
16   * Contains simple mistakes:
17   * - Long lines
18   * - Tabs
19   * - Format of variables and parameters
20   * - Order of modifiers
21   * @author Oliver Burn
22   **/
23  final class InputMethodNameSimpleOne
24  {
25      // Long line ----------------------------------------------------------------
26      // Contains a tab ->        <-
27      // Contains trailing whitespace ->
28  
29      // Name format tests
30      //
31      /** Invalid format **/
32      public static final int badConstant = 2;
33      /** Valid format **/
34      public static final int MAX_ROWS = 2;
35  
36      /** Invalid format **/
37      private static int badStatic = 2;
38      /** Valid format **/
39      private static int sNumCreated = 0;
40  
41      /** Invalid format **/
42      private int badMember = 2;
43      /** Valid format **/
44      private int mNumCreated1 = 0;
45      /** Valid format **/
46      protected int mNumCreated2 = 0;
47  
48      /** commas are wrong **/
49      private int[] mInts = new int[] {1,2, 3,
50                                       4};
51  
52      //
53      // Accessor tests
54      //
55      /** should be private **/
56      public static int sTest1;
57      /** should be private **/
58      protected static int sTest3;
59      /** should be private **/
60      static int sTest2;
61  
62      /** should be private **/
63      int mTest1;
64      /** should be private **/
65      public int mTest2;
66  
67      //
68      // Parameter name format tests
69      //
70  
71      /**
72       * @return hack
73       * @param badFormat1 bad format
74       * @param badFormat2 bad format
75       * @param badFormat3 bad format
76       * @throws java.lang.Exception abc
77       **/
78      int test1(int badFormat1,int badFormat2,
79                final int badFormat3)
80          throws java.lang.Exception
81      {
82          return 0;
83      }
84  
85      /** method that is 20 lines long **/
86      private void longMethod()
87      {
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         // a line
106     }
107 
108 }