View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0
2   
3   import java.awt.event.ActionEvent; //indent:0 exp:0
4   import java.awt.event.ActionListener; //indent:0 exp:0
5   
6   import javax.swing.JButton; //indent:0 exp:0
7   
8   /**                                                                           //indent:0 exp:0
9    * This test-input is intended to be checked using following configuration:   //indent:1 exp:1
10   *                                                                            //indent:1 exp:1
11   * arrayInitIndent = 4                                                        //indent:1 exp:1
12   * basicOffset = 4                                                            //indent:1 exp:1
13   * braceAdjustment = 0                                                        //indent:1 exp:1
14   * caseIndent = 4                                                             //indent:1 exp:1
15   * forceStrictCondition = false                                               //indent:1 exp:1
16   * lineWrappingIndentation = 4                                                //indent:1 exp:1
17   * tabWidth = 4                                                               //indent:1 exp:1
18   * throwsIndent = 4                                                           //indent:1 exp:1
19   *                                                                            //indent:1 exp:1
20   * @author  jrichard                                                          //indent:1 exp:1
21   */                                                                           //indent:1 exp:1
22    public class InputIndentationInvalidClassDefIndent extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:2 exp:0 warn
23  
24  
25  } //indent:0 exp:0
26  
27  class InputIndentationInvalidClassDefIndentB extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener  //indent:0 exp:0
28    { //indent:2 exp:0 warn
29  
30  
31    } //indent:2 exp:0 warn
32  
33  
34    class InputIndentationInvalidClassDefIndentC  //indent:2 exp:0 warn
35  { //indent:0 exp:0
36  
37  
38    } //indent:2 exp:0 warn
39  
40  
41  
42  class InputIndentationValidClassDefIndent22  //indent:0 exp:0
43    extends java.awt.event.MouseAdapter  //indent:2 exp:>=4 warn
44    implements java.awt.event.MouseListener  //indent:2 exp:>=4 warn
45  { //indent:0 exp:0
46  
47  } //indent:0 exp:0
48  
49  class InputIndentationValidClassDefIndent33 //indent:0 exp:0
50    extends java.awt.event.MouseAdapter  //indent:2 exp:>=4 warn
51      implements java.awt.event.MouseListener  //indent:4 exp:>=4
52  { //indent:0 exp:0
53  
54  } //indent:0 exp:0
55  
56  final class InputIndentationValidClassDefIndent44 //indent:0 exp:0
57      extends java.awt.event.MouseAdapter  //indent:4 exp:>=4
58    implements  //indent:2 exp:>=4 warn
59    java.awt.event.MouseListener  //indent:2 exp:>=4 warn
60  { //indent:0 exp:0
61  
62  } //indent:0 exp:0
63  
64    final class InputIndentationValidClassDefIndent55 extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener  //indent:2 exp:0 warn
65    { //indent:2 exp:0 warn
66  
67  } //indent:0 exp:0
68  
69  
70  final class InputIndentationValidClassDefIndent5b extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener  //indent:0 exp:0
71  { //indent:0 exp:0
72  
73    } //indent:2 exp:0 warn
74  
75  
76  class InputIndentationInvalidClassDefIndentc2 //indent:0 exp:0
77    extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:2 exp:4 warn
78  
79  
80  } //indent:0 exp:0
81  
82  
83  
84  final class InputIndentationValidClassDefIndent66 extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:0 exp:0
85  
86    class foo { } //indent:2 exp:4 warn
87  
88        class fooBS { } //indent:6 exp:4 warn
89  
90  
91    class foo2 { public int x; } //indent:2 exp:4 warn
92  
93  
94      class foo3 {  //indent:4 exp:4
95        public  //indent:6 exp:8 warn
96              int x;  //indent:12 exp:>=10
97      } //indent:4 exp:4
98  
99      class foo3b {  //indent:4 exp:4
100         public  //indent:8 exp:8
101           int x;  //indent:10 exp:>=12 warn
102     } //indent:4 exp:4
103 
104 
105     class foo4 {  //indent:4 exp:4
106       public int x;  //indent:6 exp:8 warn
107     } //indent:4 exp:4
108 
109     class foo4c {  //indent:4 exp:4
110         public int x;  //indent:8 exp:8
111       } //indent:6 exp:4 warn
112 
113       class foo4b {  //indent:6 exp:4 warn
114         public int x;  //indent:8 exp:8
115     } //indent:4 exp:4
116 
117 
118     private void myMethod() { //indent:4 exp:4
119       class localFoo { //indent:6 exp:8 warn
120 
121         } //indent:8 exp:8
122           class localFoo1 { //indent:10 exp:8 warn
123 
124           } //indent:10 exp:8 warn
125 
126         class localFoo2 { //indent:8 exp:8
127           int x; //indent:10 exp:12 warn
128 
129             int func() { return 3; } //indent:12 exp:12
130         } //indent:8 exp:8
131 
132           new JButton().addActionListener(new ActionListener() //indent:10 exp:8 warn
133         { //indent:8 exp:10,14 warn
134             public void actionPerformed(ActionEvent e) { //indent:12 exp:12
135 
136             } //indent:12 exp:12
137         }); //indent:8 exp:10,14 warn
138 
139 
140         new JButton().addActionListener(new ActionListener()  //indent:8 exp:8
141       { //indent:6 exp:8,12 warn
142             public void actionPerformed(ActionEvent e) { //indent:12 exp:10 warn
143 
144             } //indent:12 exp:10 warn
145       }); //indent:6 exp:8,12 warn
146 
147 
148         new JButton().addActionListener(new ActionListener()  //indent:8 exp:8
149         { //indent:8 exp:8,12
150           public void actionPerformed(ActionEvent e) { //indent:10 exp:12 warn
151 
152           } //indent:10 exp:12 warn
153         }); //indent:8 exp:8,12
154 
155 
156         new JButton().addActionListener(new ActionListener() { //indent:8 exp:8
157             public void actionPerformed(ActionEvent e) { //indent:12 exp:12
158                 int i = 2; //indent:16 exp:16
159             } //indent:12 exp:12
160         }); //indent:8 exp:8,12
161 
162         Object o = new ActionListener()  //indent:8 exp:8
163         { //indent:8 exp:8,12
164             public void actionPerformed(ActionEvent e) { //indent:12 exp:12
165 
166             } //indent:12 exp:12
167         }; //indent:8 exp:8,12
168 
169         myfunc2(10, 10, 10, //indent:8 exp:8
170             myfunc3(11, 11, //indent:12 exp:>=12
171                 11, 11), //indent:16 exp:>=16
172             10, 10, //indent:12 exp:>=12
173             10); //indent:12 exp:>=12
174 
175 
176     } //indent:4 exp:4
177 
178     private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4
179     } //indent:4 exp:4
180 
181     private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4
182         return 1; //indent:8 exp:8
183     } //indent:4 exp:4
184 } //indent:0 exp:0
185 
186 
187 final  //indent:0 exp:0
188 class InputIndentationValidClassDefIndent4d //indent:0 exp:4 warn
189     extends  //indent:4 exp:4
190         java.awt.event.MouseAdapter  //indent:8 exp:>=4
191     implements  //indent:4 exp:>=4
192         java.awt.event.MouseListener  //indent:8 exp:>=4
193 { //indent:0 exp:0
194 
195 } //indent:0 exp:0