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 = 4                                                            //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   * @author  jrichard                                                          //indent:1 exp:1
16   */                                                                           //indent:1 exp:1
17  public class InputIndentationInvalidForIndent { //indent:0 exp:0
18  
19      /** Creates a new instance of InputIndentationValidForIndent */ //indent:4 exp:4
20      public InputIndentationInvalidForIndent() { //indent:4 exp:4
21      } //indent:4 exp:4
22  
23  
24      private void method1() //indent:4 exp:4
25      { //indent:4 exp:4
26        for (int i=0; i<10; i++) { //indent:6 exp:8 warn
27            } //indent:10 exp:8 warn
28  
29           for (int i=0; i<10; i++)  //indent:9 exp:8 warn
30        { //indent:6 exp:8 warn
31        } //indent:6 exp:8 warn
32  
33          for (int i=0; i<10; i++)  //indent:8 exp:8
34          { //indent:8 exp:8
35            System.getProperty("foo"); //indent:10 exp:12 warn
36            } //indent:10 exp:8 warn
37  
38          for (int i=0; i<10; i++)  //indent:8 exp:8
39            { //indent:10 exp:8 warn
40            boolean test = true; //indent:10 exp:12 warn
41              if (test) { // mixed styles are OK //indent:12 exp:12
42                  System.getProperty("foo"); //indent:16 exp:16
43              } //indent:12 exp:12
44          } //indent:8 exp:8
45  
46          for ( //indent:8 exp:8
47              int i=0;  //indent:12 exp:>=12
48            i<10;  //indent:10 exp:>=12 warn
49              i++)  //indent:12 exp:>=12
50          { //indent:8 exp:8
51  
52          } //indent:8 exp:8
53  
54         for ( //indent:7 exp:8 warn
55            int i=0;  //indent:10 exp:>=12 warn
56              i<10;  //indent:12 exp:>=12
57              i++)  //indent:12 exp:>=12
58          { //indent:8 exp:8
59  
60          } //indent:8 exp:8
61  
62          for (int i=0;  //indent:8 exp:8
63              i<10;  //indent:12 exp:>=12
64         i++)  //indent:7 exp:>=12 warn
65          { //indent:8 exp:8
66  
67          } //indent:8 exp:8
68  
69        for (int i=0;  //indent:6 exp:8 warn
70            i<10 && 4<5 //indent:10 exp:>=12 warn
71                && 7<8;  //indent:14 exp:>=16 warn
72            i++)  //indent:10 exp:12 warn
73          { //indent:8 exp:8
74          } //indent:8 exp:8
75  
76          for (int i=0; i<10; i++) { //indent:8 exp:8
77              System.getProperty("foo"); } //indent:12 exp:12
78  
79          for (int i=0;  //indent:8 exp:8
80              i<10; i++ //indent:12 exp:>=12
81              ) { //indent:12 exp:8 warn
82              System.getProperty("foo"); //indent:12 exp:12
83          } //indent:8 exp:8
84      } //indent:4 exp:4
85  
86  } //indent:0 exp:0