View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0
2   
3   /**                                                                           //indent:0 exp:0
4    * This test-input is intended to be checked using following configuration:   //indent:1 exp:1
5    *                                                                            //indent:1 exp:1
6    * arrayInitIndent = 4                                                        //indent:1 exp:1
7    * basicOffset = 2                                                            //indent:1 exp:1
8    * braceAdjustment = 0                                                        //indent:1 exp:1
9    * caseIndent = 4                                                             //indent:1 exp:1
10   * forceStrictCondition = false                                               //indent:1 exp:1
11   * lineWrappingIndentation = 4                                                //indent:1 exp:1
12   * tabWidth = 4                                                               //indent:1 exp:1
13   * throwsIndent = 4                                                           //indent:1 exp:1
14   *                                                                            //indent:1 exp:1
15   *                                                                            //indent:1 exp:1
16   */                                                                           //indent:1 exp:1
17  class InputIndentationCorrectIfAndParameter { //indent:0 exp:0
18  
19    String getString(int someInt, String someString) { //indent:2 exp:2
20      return "String"; //indent:4 exp:4
21    } //indent:2 exp:2
22  
23    void fooMethodWithIf() { //indent:2 exp:2
24  
25      if (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4
26          SecondClassLongNam7("Loooooooooooooooooog"). //indent:8 exp:8
27          getInteger(new InputIndentationCorrectIfAndParameter(), "Looooog"), //indent:8 exp:8
28          new InnerClassFoo())) {} //indent:8 exp:8
29  
30      if (conditionSecond(10000000000.0, new //indent:4 exp:4
31          SecondClassLongNam7("Looooooooooooo" //indent:8 exp:8
32          + "oooooooooooong").getString(new InputIndentationCorrectIfAndParameter(), //indent:8 exp:8
33          new SecondClassLongNam7("loooooooooong"). //indent:8 exp:10,12 warn
34          getInteger(new InputIndentationCorrectIfAndParameter(), "long")), "loong") //indent:8 exp:8
35          || conditionThird(2048) || conditionFourth(new //indent:8 exp:8
36          SecondClassLongNam7("Looooooooooooooo" //indent:8 exp:8
37          + "oo").gB(new InputIndentationCorrectIfAndParameter(), false)) || //indent:8 exp:8
38          conditionFifth(true, new SecondClassLongNam7(getString(2048, "Looo" //indent:8 exp:8
39          + "ooooooooooooooooooooooooooooooooooooooooooong")).gB( //indent:8 exp:8
40          new InputIndentationCorrectIfAndParameter(), true)) //indent:8 exp:10,12 warn
41          || co(false, new //indent:8 exp:8
42          SecondClassLongNam7(getString(100000, "Loooooong" //indent:8 exp:8
43          + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8
44          || conditionNoArg() || //indent:8 exp:8
45          conditionNoArg() || conditionNoArg()) {} //indent:8 exp:8
46    } //indent:2 exp:2
47  
48    private boolean conditionFirst(String longString, int //indent:2 exp:2
49        integer, InnerClassFoo someInstance) { //indent:6 exp:6
50      return false; //indent:4 exp:4
51    } //indent:2 exp:2
52  
53    private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2
54        String longLongLongString, String secondLongLongString) { //indent:6 exp:6
55      return false; //indent:4 exp:4
56    } //indent:2 exp:2
57  
58    private boolean conditionThird(long veryLongValue) { //indent:2 exp:2
59      return false; //indent:4 exp:4
60    } //indent:2 exp:2
61  
62    private boolean conditionFourth(boolean flag) { //indent:2 exp:2
63      return false; //indent:4 exp:4
64    } //indent:2 exp:2
65  
66    private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2
67      return false; //indent:4 exp:4
68    } //indent:2 exp:2
69  
70    private boolean co(boolean flag, //indent:2 exp:2
71        SecondClassLongNam7 instance) { //indent:6 exp:6
72      return false; //indent:4 exp:4
73    } //indent:2 exp:2
74  
75    private boolean conditionNoArg() { //indent:2 exp:2
76      return false; //indent:4 exp:4
77    } //indent:2 exp:2
78  
79    class InnerClassFoo { //indent:2 exp:2
80  
81      void fooMethodWithIf() { //indent:4 exp:4
82        if (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6
83            SecondClassLongNam7("Loooooooooooooooooog"). //indent:10 exp:10
84                getInteger(new InputIndentationCorrectIfAndParameter(), "Log"), //indent:14 exp:>=10
85                new InnerClassFoo())) {} //indent:14 exp:>=10
86  
87        if (conditionSecond(10000000000.0, new //indent:6 exp:6
88            SecondClassLongNam7("Looooooooooooo" //indent:10 exp:10
89            + "ooooooong").getString(new InputIndentationCorrectIfAndParameter(), //indent:10 exp:10
90            new SecondClassLongNam7("loooooooooong"). //indent:10 exp:12,14 warn
91            getInteger(new InputIndentationCorrectIfAndParameter(), "long")), "l") //indent:10 exp:10
92            || conditionThird(2048) || conditionFourth(new //indent:10 exp:10
93            SecondClassLongNam7("Looooooooooooooo" //indent:10 exp:10
94              + "og").gB(new InputIndentationCorrectIfAndParameter(), false)) || //indent:12 exp:>=10
95              conditionFifth(true, new SecondClassLongNam7(getString(2048, "Loo" //indent:12 exp:>=10
96              + "ooooooooooooooooooooooooooooooooooooooooooong")).gB( //indent:12 exp:>=10
97              new InputIndentationCorrectIfAndParameter(), true)) //indent:12 exp:14,16 warn
98                ||co(false,new //indent:14 exp:14
99                SecondClassLongNam7(getString(100000, "Loooooong" //indent:14 exp:>=10
100               + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10
101               || conditionNoArg() || //indent:14 exp:>=10
102               conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10
103     } //indent:4 exp:4
104 
105     Object ann = new Object() { //indent:4 exp:4
106 
107       void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6
108           int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10
109               fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10
110 
111         if (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8
112             SecondClassLongNam7("Loooooooooooooooooog"). //indent:12 exp:12
113                 getInteger(new InputIndentationCorrectIfAndParameter(), "Lg"), //indent:16 exp:>=12
114                    new InnerClassFoo())) {} //indent:19 exp:>=12
115 
116         if (conditionSecond(10000000000.0, new //indent:8 exp:8
117             SecondClassLongNam7("Looooooooooooo" //indent:12 exp:12
118             + "oooooong").getString(new InputIndentationCorrectIfAndParameter(), //indent:12 exp:12
119             new SecondClassLongNam7("loooooooooong"). //indent:12 exp:14,16 warn
120             getInteger(new InputIndentationCorrectIfAndParameter(), "lg")), "l") //indent:12 exp:12
121             || conditionThird(2048) || conditionFourth(new //indent:12 exp:12
122             SecondClassLongNam7("Looooooooooooooo" //indent:12 exp:12
123               + "o").gB(new InputIndentationCorrectIfAndParameter(), false))|| //indent:14 exp:>=12
124               conditionFifth(true, new SecondClassLongNam7(getString(2048, "L" //indent:14 exp:>=12
125               + "ooooooooooooooooooooooooooooooooooooooooooong")).gB( //indent:14 exp:>=12
126               new InputIndentationCorrectIfAndParameter(),true))//indent:14 exp:16,18 warn
127                 || co(false, new //indent:16 exp:16
128                 SecondClassLongNam7(getString(100000, "Loooooong" //indent:16 exp:>=12
129                 + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12
130                 || conditionNoArg() || //indent:16 exp:>=12
131                   conditionNoArg() || conditionNoArg() //indent:18 exp:>=12
132                      && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12
133       } //indent:6 exp:6
134     }; //indent:4 exp:4
135   } //indent:2 exp:2
136 } //indent:0 exp:0
137 
138 class SecondClassLongNam7 { //indent:0 exp:0
139 
140   public SecondClassLongNam7(String string) { //indent:2 exp:2
141 
142   } //indent:2 exp:2
143 
144   String getString(InputIndentationCorrectIfAndParameter instance, int integer) { //indent:2 exp:2
145     return "String"; //indent:4 exp:4
146   } //indent:2 exp:2
147 
148   int getInteger(InputIndentationCorrectIfAndParameter instance, String string) { //indent:2 exp:2
149     return -1;   //indent:4 exp:4
150   } //indent:2 exp:2
151 
152   boolean gB(InputIndentationCorrectIfAndParameter instance,boolean flag){ //indent:2 exp:2
153     return false; //indent:4 exp:4
154   } //indent:2 exp:2
155 
156   SecondClassLongNam7 getInstance() { //indent:2 exp:2
157     return new SecondClassLongNam7("VeryLoooooooooo" //indent:4 exp:4
158         + "oongString"); //indent:8 exp:8
159   } //indent:2 exp:2
160 } //indent:0 exp:0