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