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 InputIndentationValidClassDefIndent //indent:0 exp:0
23      extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:4 exp:>=4
24  
25  
26  } //indent:0 exp:0
27  
28  class InputIndentationValidClassDefIndent2  //indent:0 exp:0
29      extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener  //indent:4 exp:>=4
30  { //indent:0 exp:0
31  
32  } //indent:0 exp:0
33  
34  class InputIndentationValidClassDefIndent3 //indent:0 exp:0
35      extends java.awt.event.MouseAdapter  //indent:4 exp:>=4
36      implements java.awt.event.MouseListener  //indent:4 exp:>=4
37  { //indent:0 exp:0
38  
39  } //indent:0 exp:0
40  
41  final class InputIndentationValidClassDefIndent4 //indent:0 exp:0
42      extends java.awt.event.MouseAdapter  //indent:4 exp:>=4
43      implements java.awt.event.MouseListener  //indent:4 exp:>=4
44  { //indent:0 exp:0
45  
46  } //indent:0 exp:0
47  
48  final  //indent:0 exp:0
49  class InputIndentationValidClassDefIndent4a //indent:0 exp:>=4 warn
50      extends java.awt.event.MouseAdapter  //indent:4 exp:>=4
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 InputIndentationValidClassDefIndent5 extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener  //indent:0 exp:0
57  { //indent:0 exp:0
58  
59  } //indent:0 exp:0
60  
61  final class InputIndentationValidClassDefIndent6 extends java.awt.event.MouseAdapter implements java.awt.event.MouseListener { //indent:0 exp:0
62  
63      class foo { } //indent:4 exp:4
64  
65  
66      class foo2 { public int x; } //indent:4 exp:4
67  
68  
69      class foo3 {  //indent:4 exp:4
70          public  //indent:8 exp:8
71          int x;  //indent:8 exp:>=12 warn
72      } //indent:4 exp:4
73  
74  
75      class foo4 {  //indent:4 exp:4
76          public int x;  //indent:8 exp:8
77      } //indent:4 exp:4
78  
79  
80      private void myMethod() { //indent:4 exp:4
81          class localFoo { //indent:8 exp:8
82  
83          } //indent:8 exp:8
84  
85          class localFoo2 { //indent:8 exp:8
86              int x; //indent:12 exp:12
87  
88              int func() { return 3; } //indent:12 exp:12
89          } //indent:8 exp:8
90  
91  
92          //     : this is broken right now: //indent:8 exp:8
93          //   1) this is both an expression and an OBJBLOCK //indent:8 exp:8
94          //   2) methods aren't yet parsed //indent:8 exp:8
95          //   3) only CLASSDEF is handled now, not OBJBLOCK //indent:8 exp:8
96          new JButton().addActionListener(new ActionListener()  //indent:8 exp:8
97          { //indent:8 exp:8
98              public void actionPerformed(ActionEvent e) { //indent:12 exp:12
99  
100             } //indent:12 exp:12
101         }); //indent:8 exp:8
102 
103 
104         new JButton().addActionListener(new ActionListener() { //indent:8 exp:8
105             public void actionPerformed(ActionEvent e) { //indent:12 exp:12
106                 int i = 2; //indent:16 exp:16
107             } //indent:12 exp:12
108         }); //indent:8 exp:8
109 
110         Object o = new ActionListener()  //indent:8 exp:8
111         { //indent:8 exp:8
112             public void actionPerformed(ActionEvent e) { //indent:12 exp:12
113 
114             } //indent:12 exp:12
115         }; //indent:8 exp:8
116 
117         myfunc2(10, 10, 10, //indent:8 exp:8
118             myfunc3(11, 11, //indent:12 exp:>=12
119                 11, 11), //indent:16 exp:>=16
120             10, 10, //indent:12 exp:>=12
121             10); //indent:12 exp:>=12
122     } //indent:4 exp:4
123 
124     private void myfunc2(int a, int b, int c, int d, int e, int f, int g) { //indent:4 exp:4
125     } //indent:4 exp:4
126 
127     private int myfunc3(int a, int b, int c, int d) { //indent:4 exp:4
128         return 1; //indent:8 exp:8
129     } //indent:4 exp:4
130 
131     /** The less than or equal operator. */ //indent:4 exp:4
132     public static final Operator LT_OR_EQUAL = //indent:4 exp:4
133         new Operator( //indent:8 exp:8
134             "<=", //indent:12 exp:>=12
135             new OperatorHelper() //indent:12 exp:>=12
136             { //indent:12 exp:12
137                 public boolean compare(int value1, int value2) //indent:16 exp:16
138                 { //indent:16 exp:16
139                     return (value1 <= value2); //indent:20 exp:20
140                 } //indent:16 exp:16
141 
142                 public boolean compare(Comparable<Object> obj1, Comparable<Object> obj2) //indent:16 exp:16
143                 { //indent:16 exp:16
144                     return (obj1.compareTo(obj2) <= 0); //indent:20 exp:20
145                 } //indent:16 exp:16
146             }); //indent:12 exp:12
147 } //indent:0 exp:0
148 
149 class HashingContainer<K, V> { //indent:0 exp:0
150     @Deprecated //indent:4 exp:4
151     public Object[] table; //indent:4 exp:4
152 
153     @Override //indent:4 exp:4
154     public String toString() { //indent:4 exp:4
155         return ""; //indent:8 exp:8
156     } //indent:4 exp:4
157 } //indent:0 exp:0
158 
159 class Operator { //indent:0 exp:0
160     public Operator(String str, OperatorHelper handler) { //indent:4 exp:4
161     } //indent:4 exp:4
162 } //indent:0 exp:0
163 
164 class OperatorHelper { //indent:0 exp:0
165 } //indent:0 exp:0