View Javadoc
1   /*
2    * InputInalidMethodIndent.java
3    *
4    * Created on November 11, 2002, 10:14 PM
5    */
6   
7   package com.puppycrawl.tools.checkstyle.indentation;
8   import java.util.Arrays;
9   /**
10   *
11   * @author  jrichard
12   */
13  public class InputInvalidMethodIndent {
14      
15      /** Creates a new instance of InputInalidMethodIndent */
16      public InputInvalidMethodIndent() {
17        }
18      
19      // ctor with rcurly on next line
20        public InputInvalidMethodIndent(int dummy)
21    {
22        }
23        
24      // method with rcurly on same line
25    public void method() {
26        }
27  
28      // method with rcurly on next line
29      public void method2()
30      {
31      }
32      
33      // method with a bunch of params
34      public int method2(int x, int y, int w, int h) {
35          return 1;
36      }
37      
38      // params on multiple lines
39      public void method2(int x, int y, int w, int h,
40          int x1, int y1, int w1, int h1)
41      {
42      }
43  
44      // params on multiple lines
45      public void method3(int x, int y, int w, int h,
46          int x1, int y1, int w1, int h1)
47      {
48          System.getProperty("foo");
49      }
50  
51      
52      
53      // params on multiple lines
54      public void method4(int x, int y, int w, int h,
55          int x1, int y1, int w1, int h1)
56      {
57          boolean test = true;
58          if (test) {
59              System.getProperty("foo");
60          }
61      }
62      
63       public 
64       final
65       void 
66      method5()
67      {
68          boolean test = true;
69          if (test) {
70              System.getProperty("foo");
71          }
72      }
73      
74     public 
75     final
76     void 
77       method6()
78      {
79          boolean test = true;
80          if (test) {
81              System.getProperty("foo");
82          }
83      }
84     
85      public InputInvalidMethodIndent(int dummy, int dummy2)
86      {
87      System.getProperty("foo");
88      }
89        
90      void method6a()
91      {
92        boolean test = true;
93        if (test) {
94            System.getProperty("foo");
95        }
96        
97          System.out.println("methods are: " + 
98            Arrays.asList(
99                  new String[] {"method"}).toString());
100 
101                 
102         System.out.println("methods are: " + 
103             Arrays.asList(
104               new String[] {"method"}).toString());
105                 
106         System.out.println("methods are: " 
107           + Arrays.asList(
108                 new String[] {"method"}).toString());
109                 
110         System.out.println("methods are: " 
111             + Arrays.asList(
112               new String[] {"method"}).toString());
113                 
114 
115         String blah = (String) System.getProperty(
116           new String("type"));
117 
118         
119         String blah1 = (String) System.getProperty(
120           new String("type")
121       );
122         
123         System.out.println("methods are: " + Arrays.asList(
124             new String[] {"method"}).toString()
125       );
126     }
127 
128     
129     private void myfunc2(int a, int b, int c, int d, int e, int f, int g) {
130     }
131     
132     private int myfunc3(int a, int b, int c, int d) {
133         return 1;
134     }
135     
136     private void myMethod()
137     {
138         myfunc2(3, 4, 5, 
139           6, 7, 8, 9);
140             
141         myfunc2(3, 4, method2(3, 4, 5, 6) + 5, 
142           6, 7, 8, 9);
143         
144 
145 // TODO: this is not illegal, but probably should be
146 //        myfunc3(11, 11, Integer.
147 //            getInteger("mytest").intValue(),
148 //            11);
149 
150 
151         System.out.toString()
152       .equals("blah");
153         
154      
155     }
156     
157     private void myFunc()
158       throws Exception
159     {
160     }
161 
162     void method7() {
163         // return incorrectly indented
164     return;
165     }
166 
167     void method8() {
168         // thow invorrectly indented
169     throw new RuntimeException("");
170     }
171 
172     public
173 int[]
174     method9()
175     {
176         return null;
177     }
178 
179     private int[] getArray() {
180         return new int[] {1};
181     }
182 
183     private void indexTest() {
184             getArray()[0] = 2;
185     }
186 }