1
2
3
4
5
6 package com.puppycrawl.tools.checkstyle.checks.coding.unusedlocalvariable;
7
8 import java.util.function.Function;
9
10 public class InputUnusedLocalVariableGenericAnonInnerClasses {
11
12 Function<Integer, Integer> obj = a -> {
13 int l = 12;
14 testClass obj = new testClass() {
15 void method() {
16 l += 1;
17 }
18 };
19 return a;
20 };
21
22 testClass obj2 = new testClass() {
23 int l = 13;
24 testClass obj2 = new testClass() {
25 void method() {
26 l += 1;
27 }
28 };
29 };
30
31 testClass obj3 = new testClass() {
32 void method() {
33 int l = 13;
34 testClass obj2 = new testClass() {
35 void method() {
36 l += 1;
37 }
38 };
39 }
40 };
41 }
42
43 class testClass {
44 int l = 12;
45
46 void method2() {
47 int s = 12;
48 int j = 13;
49 hoo k = () -> {
50 Integer.valueOf(j);
51 hoo obj2 = () -> {
52 testClass obj3 = new testClass() {
53 void foo() {
54 s += 12;
55 }
56 };
57 obj3.getClass();
58 };
59 obj2.anotherMethod();
60 };
61 k.anotherMethod();
62 }
63
64 int s = 2;
65
66 void test() {
67 int variable = 1;
68 int mainVar = 2;
69 int anotherVar = 1;
70 testingGenerics<Integer>.nested obj
71 = new testingGenerics<Integer>().new nested() {
72 void method() {
73 anotherVar += 1;
74 }
75 };
76 obj.getClass();
77
78 testingGenerics<Integer>.clazz<String>.nested obj2
79 = new testingGenerics<Integer>().new clazz<String>().new nested() {
80 void method() {
81 variable += 1;
82 Integer.valueOf(mainVar);
83 }
84 };
85 }
86 }
87 class testingGenerics<T> {
88 int mainVar = 2;
89
90 class clazz<T> {
91 class nested {
92 int variable = 1;
93 }
94 }
95
96 class nested {
97 int anotherVar = 2;
98 }
99 }