View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.finallocalvariable;
2   
3   import java.util.stream.Stream;
4   
5   public class InputFinalLocalVariableLeavingSlistToken {
6   
7       private int assignedInInstanceInitAndCtor;
8       private static int assignedInStaticInitAndFoo1;
9   
10      {
11          assignedInInstanceInitAndCtor = 1;
12      }
13  
14      static {
15          assignedInStaticInitAndFoo1 = 1;
16      }
17  
18      InputFinalLocalVariableLeavingSlistToken() {
19          assignedInInstanceInitAndCtor = 2;
20      }
21  
22      void foo1() {
23          assignedInStaticInitAndFoo1 = 2;
24      }
25  
26      void foo2() {
27          int a;
28          if (true) {
29          }
30          else {
31              a = 1;
32  
33              try {
34              } catch (Exception e) {
35              } finally {
36              }
37  
38              if (true) {
39              }
40  
41              Stream.of(1).forEach(integer -> {});
42  
43              synchronized (InputFinalLocalVariableLeavingSlistToken.class) {
44              }
45  
46              for (int i = 0; i < 0; ++i) {
47              }
48              while (Math.random() > 0) {
49              }
50              do {
51              }
52              while (Math.random() > 0);
53  
54              {}
55  
56              a = 2;
57          }
58      }
59  }