View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="Indentation">
5         <property name="caseIndent" value="0"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.indentation.indentation;
12  
13  // xdoc section -- start
14  class Example2 {
15      String field = "example";                  // basicOffset
16      int[] values = {                           // basicOffset
17          10,
18          20,
19          30
20      };
21  
22      void processValues() throws Exception {
23          handleValue("Test String", 42);          // basicOffset
24      }
25  
26      void handleValue(String aFooString,
27                       int aFooInt) {
28  
29          boolean cond1,cond2,cond3,cond4,cond5,cond6;
30          cond1=cond2=cond3=cond4=cond5=cond6=false;
31  
32          if (cond1
33              || cond2) {
34              field = field.toUpperCase()
35                  .concat(" TASK");
36          }
37  
38          if ((cond1 && cond2)
39                  || (cond3 && cond4)           // ok, lineWrappingIndentation
40                  || !(cond5 && cond6)) {       // ok, lineWrappingIndentation
41              field.toUpperCase()
42                   .concat(" TASK")             // ok, lineWrappingIndentation
43                   .chars().forEach(c -> {      // ok, lineWrappingIndentation
44                       System.out.println((char) c);
45                   });
46          }
47      }
48  
49      void demonstrateSwitch() throws Exception {
50          switch (field) {
51          case "EXAMPLE": processValues();                            // caseIndent
52          case "COMPLETED": handleValue("Completed Case", 456);       // caseIndent
53          }
54      }
55  }
56  // xdoc section -- end
57  
58  
59