View Javadoc
1   /*
2   ExecutableStatementCount
3   max = 1
4   tokens = LAMBDA
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.sizes.executablestatementcount;
10  
11  import java.util.function.Consumer;
12  import java.util.function.Function;
13  
14  public class InputExecutableStatementCountLambdas {
15  
16      Consumer a = (o) -> { // violation
17          o.toString(); // 1
18          o.toString(); // 2
19          o.toString(); // 3
20          o.toString(); // 4
21          o.toString(); // 5
22          o.toString(); // 6
23      };
24  
25      Consumer b = (x) -> { // violation
26          Consumer c = (s) -> { // violation
27              String str = s.toString();
28              str = str + "!";
29          };
30          Consumer d = (s) -> { // violation
31              String str = s.toString();
32              Consumer t = a -> a.toString().trim(); // ok
33              Function x1 = a -> a; // ok
34              Function y = a -> null; // ok
35          };
36      };
37  }