View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.indentation.indentation; //indent:0 exp:0
2   import java.util.HashMap; //indent:0 exp:0
3   import java.util.Map; //indent:0 exp:0
4   
5   /**                                                                           //indent:0 exp:0
6    * This test-input is intended to be checked using following configuration:   //indent:1 exp:1
7    *                                                                            //indent:1 exp:1
8    * arrayInitIndent = 4                                                        //indent:1 exp:1
9    * basicOffset = 2                                                            //indent:1 exp:1
10   * braceAdjustment = 0                                                        //indent:1 exp:1
11   * caseIndent = 4                                                             //indent:1 exp:1
12   * forceStrictCondition = false                                               //indent:1 exp:1
13   * lineWrappingIndentation = 4                                                //indent:1 exp:1
14   * tabWidth = 4                                                               //indent:1 exp:1
15   * throwsIndent = 4                                                           //indent:1 exp:1
16   *                                                                            //indent:1 exp:1
17   *                                                                            //indent:1 exp:1
18   */                                                                           //indent:1 exp:1
19  class FooFieldClass { //indent:0 exp:0
20  
21    boolean flag //indent:2 exp:2
22       = conditionFirst("Loooooooooooooooooong", new  //indent:5 exp:6 warn
23        SecondFieldClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:6 exp:6
24        getInteger(new FooFieldClass(), "Loooooooooooooooooog"), new InnerClassFoo()); //indent:6 exp:6
25  
26  
27    String getString(int someInt, String someString) { //indent:2 exp:2
28      return "String"; //indent:4 exp:4
29    } //indent:2 exp:2
30  
31    private boolean conditionFirst(String longString, int //indent:2 exp:2
32        integer, InnerClassFoo someInstance) { //indent:6 exp:6
33      return false; //indent:4 exp:4
34    } //indent:2 exp:2
35  
36    private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2
37        String longLongLongString, String secondLongLongString) { //indent:6 exp:6
38      return false; //indent:4 exp:4
39    } //indent:2 exp:2
40  
41    class InnerClassFoo { //indent:2 exp:2
42  
43      boolean flag //indent:4 exp:4
44          = conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8
45          SecondFieldClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:8 exp:8
46              getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:12 exp:>=8
47               new InnerClassFoo()); //indent:13 exp:>=8
48  
49      FooFieldClass anonymousClass = //indent:4 exp:4
50          new FooFieldClass() { //indent:8 exp:8
51            boolean secondFlag = conditionSecond(10000000000.0, new //indent:10 exp:10
52                SecondFieldClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:14 exp:14
53                  + "oooooooooooong").getString(new FooFieldClass(), //indent:16 exp:>=14
54                     new SecondFieldClassWithVeryVeryVeryLongName("loooooooooong"). //indent:19 exp:>=14
55                   getInteger(new FooFieldClass(), "loooooooooooooong")), "loooooooooooong"); //indent:17 exp:>=14
56          }; //indent:8 exp:8
57     } //indent:3 exp:2 warn
58  } //indent:0 exp:0
59  
60  class SecondFieldClassWithVeryVeryVeryLongName { //indent:0 exp:0
61  
62    public SecondFieldClassWithVeryVeryVeryLongName(String string) { //indent:2 exp:2
63  
64    } //indent:2 exp:2
65  
66    String getString(FooFieldClass instance, int integer) { //indent:2 exp:2
67      return "String"; //indent:4 exp:4
68    } //indent:2 exp:2
69  
70    int getInteger(FooFieldClass instance, String string) { //indent:2 exp:2
71      return -1;   //indent:4 exp:4
72    } //indent:2 exp:2
73  
74    boolean getBoolean(FooFieldClass instance, boolean flag) { //indent:2 exp:2
75      return false; //indent:4 exp:4
76    } //indent:2 exp:2
77  
78    SecondFieldClassWithVeryVeryVeryLongName getInstanse() { //indent:2 exp:2
79      return new SecondFieldClassWithVeryVeryVeryLongName("VeryLoooooooooo" //indent:4 exp:4
80          + "oongString"); //indent:8 exp:8
81    } //indent:2 exp:2
82  } //indent:0 exp:0
83  
84  abstract class WithAnnotations { //indent:0 exp:0
85    @GwtIncompatible("Non-UTF-8" //indent:2 exp:2
86         + "Charset") //indent:7 exp:7
87    public static final int FOO_CONSTANT = 111; //indent:2 exp:2
88  
89    private void foo34() {} //indent:2 exp:2
90    final Map<String, String> //indent:2 exp:2
91        comeMapWithLongName = new HashMap //indent:6 exp:6
92        <String, String>(); //indent:6 exp:6
93  
94    @MyAnnotation //indent:2 exp:2
95    byte[] getBytesInternal() { //indent:2 exp:2
96      return new byte[] {}; //indent:4 exp:4
97    } //indent:2 exp:2
98  
99    @MyAnnotation public abstract <K, V> Map<K, V> rowMap(); //indent:2 exp:2
100 } //indent:0 exp:0
101 
102 @interface GwtIncompatible { //indent:0 exp:0
103   String value(); //indent:2 exp:2
104 } //indent:0 exp:0
105 
106 @interface MyAnnotation {} //indent:0 exp:0
107 
108 @MyAnnotation //indent:0 exp:0
109 enum MyEnum{ //indent:0 exp:0
110 
111 } //indent:0 exp:0