View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule42blockindentation;
2   
3   /** some javadoc. */
4   public class ClassWithChainedMethods {
5   
6     /** some javadoc. */
7     public ClassWithChainedMethods(Object... params) {}
8   
9     /** some javadoc. */
10    public static void main(String[] args) {
11      new ClassWithChainedMethods()
12          .getInstance("string_one")
13      .doNothing("string_one".trim(), "string_two");
14      // violation above ''method call' child has incorrect indentation level 4, expected .* 8.'
15  
16      int length =
17      new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length();
18      // violation above ''new' has incorrect indentation level 4, expected .* 8.'
19  
20      int length2 =
21      new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length();
22      // violation above ''new' has incorrect indentation level 4, expected .* 8.'
23    }
24  
25    /** some javadoc. */
26    public String doNothing(String something, String... uselessParams) {
27      return something;
28    }
29  
30    /** some javadoc. */
31    public ClassWithChainedMethods getInstance(String... uselessParams) {
32      return this;
33    }
34  }