View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.finallocalvariable;
2   
3   
4   public class InputFinalLocalVariableBreak {
5   
6       void foo1() throws Exception {
7           Exception e; // violation
8           final int a = (int) Math.random();
9           final int b = (int) Math.random();
10  
11          switch (a) {
12          case 0:
13              e = new Exception();
14              break;
15          case 1:
16              if (b == 0) {
17                  e = new Exception();
18                  break;
19              }
20  
21              if (b == 1) {
22                  e = new Exception();
23              }
24              else {
25                  e = new Exception();
26              }
27              break;
28          case 2:
29              if (b == 0) {
30                  return;
31              }
32  
33              e = new Exception();
34              break;
35          default:
36              e = new Exception();
37              break;
38          }
39  
40          throw e;
41      }
42  
43      int foo2() {
44          int a;
45          if (true) {
46              a = 1;
47          } else {
48              a = 2;
49              if (a == 3) {
50                  return a;
51              }
52              a = 4;
53          }
54          return a;
55      }
56  }