View Javadoc
1   /*
2   MethodLength
3   max = 19
4   countEmpty = (default)true
5   tokens = (default)METHOD_DEF , CTOR_DEF , COMPACT_CTOR_DEF
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.sizes.methodlength;
10  import java.io.*;
11  
12  final class InputMethodLengthSimpleOne
13  {
14      // Long line ----------------------------------------------------------------
15      // Contains a tab ->        <-
16      // Contains trailing whitespace ->
17  
18      // Name format tests
19      //
20      /** Invalid format **/
21      public static final int badConstant = 2;
22      /** Valid format **/
23      public static final int MAX_ROWS = 2;
24  
25      /** Invalid format **/
26      private static int badStatic = 2;
27      /** Valid format **/
28      private static int sNumCreated = 0;
29  
30      /** Invalid format **/
31      private int badMember = 2;
32      /** Valid format **/
33      private int mNumCreated1 = 0;
34      /** Valid format **/
35      protected int mNumCreated2 = 0;
36  
37      /** commas are wrong **/
38      private int[] mInts = new int[] {1,2, 3,
39                                       4};
40  
41      //
42      // Accessor tests
43      //
44      /** should be private **/
45      public static int sTest1;
46      /** should be private **/
47      protected static int sTest3;
48      /** should be private **/
49      static int sTest2;
50  
51      /** should be private **/
52      int mTest1;
53      /** should be private **/
54      public int mTest2;
55  
56      // Parameter name format tests
57  
58      /**
59       * @return hack
60       * @param badFormat1 bad format
61       * @param badFormat2 bad format
62       * @param badFormat3 bad format
63       * @throws java.lang.Exception abc
64       **/
65      int test1(int badFormat1,int badFormat2,
66                final int badFormat3)
67          throws java.lang.Exception
68      {
69          return 0;
70      }
71  
72  /** constructor that is 10 lines long **/
73      private InputMethodLengthSimpleOne()
74      {
75          // a line
76          // a line
77          // a line
78          // a line
79          // a line
80          // a line
81          // a line
82          // a line
83      }
84  
85      /** test local variables */
86      private void localVariables()
87      {
88          // normal decl
89          int abc = 0;
90          int ABC = 0;
91  
92          // final decls
93          final int cde = 0;
94          final int CDE = 0;
95  
96          // decl in for loop init statement
97          for (int k = 0; k < 1; k++)
98          {
99              String innerBlockVariable = "";
100         }
101         for (int I = 0; I < 1; I++)
102         {
103             String InnerBlockVariable = "";
104         }
105     }
106 }
107 
108 /** Test class for variable naming in for each clause. */
109 class InputSimple2
110 {
111     /** Some more Javadoc. */
112     public void doSomething()
113     {
114         //"O" should be named "o"
115         for (Object O : new java.util.ArrayList())
116         {
117         }
118     }
119 }