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