View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="LambdaBodyLength"/>
5     </module>
6   </module>
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.sizes.lambdabodylength;
12  
13  // xdoc section -- start
14  class Example1 {
15    Runnable r = () -> { // OK, length is 10
16      System.out.println(2); // line 2 of lambda
17      System.out.println(3);
18      System.out.println(4);
19      System.out.println(5);
20      System.out.println(6);
21      System.out.println(7);
22      System.out.println(8);
23      System.out.println(9);
24    }; // line 10
25    Runnable r2 = () -> { // violation 'length is 11'
26      System.out.println(2); // line 2 of lambda
27      System.out.println(3);
28      System.out.println(4);
29      System.out.println(5);
30      System.out.println(6);
31      System.out.println(7);
32      System.out.println(8);
33      System.out.println(9);
34      System.out.println(10);
35    }; // line 11
36    Runnable r3 = () -> // violation 'length is 11'
37      "someString".concat("1") // line 1 of lambda
38                  .concat("2")
39                  .concat("3")
40                  .concat("4")
41                  .concat("5")
42                  .concat("6")
43                  .concat("7")
44                  .concat("8")
45                  .concat("9")
46                  .concat("10")
47                  .concat("11"); // line 11
48  }
49  // xdoc section -- end