1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.coding.finallocalvariable;
10
11 public class InputFinalLocalVariableThree {
12 class class2 {
13 public void method1() {
14 int x;
15 x = 3;
16 }
17
18 public void method2() {
19 for (int i = 0; i < 5; i++) {
20 int x;
21 x = 3;
22 }
23 int y;
24 for (int i = 0; i < 5; i++) {
25 y = 3;
26 }
27 for (int i = 0; i < 5; i++) {
28 int z;
29 for (int j = 0; j < 5; j++) {
30 z = 3;
31 }
32 }
33 }
34
35 public void method3() {
36 int m;
37 do {
38 m = 0;
39 } while (false);
40 do {
41 int n;
42 n = 0;
43 } while (true);
44 }
45
46 private void foo() {
47 int q;
48 int w;
49 int e;
50 q = 1;
51 w = 1;
52 e = 1;
53 e = 2;
54 class Local {
55 void bar() {
56 int q;
57 int w;
58 int e;
59 q = 1;
60 q = 2;
61 w = 1;
62 e = 1;
63 }
64 }
65
66 int i;
67 for (; ; i = 1) {
68 }
69 }
70
71 public void method4() {
72 int m;
73 int i = 5;
74 while (i > 1) {
75 m = 0;
76 i++;
77 }
78 while (true) {
79 int n;
80 n = 0;
81 }
82 }
83
84 int[] array = new int[10];
85
86 public void method5() {
87 int r;
88 for (int a : array) {
89 r = 0;
90 }
91 for (int a : array) {
92 int t;
93 t = 0;
94 }
95 }
96 }
97
98 class classs3 {
99 public void method(final int i) {
100 switch (i) {
101 case 1:
102 int foo = 1;
103 break;
104 default:
105 }
106 switch (i) {
107 case 1:
108 int foo = 1;
109 break;
110 case 2:
111 foo = 2;
112 break;
113 default:
114 }
115 }
116 }
117 }