1
2
3
4
5
6
7
8
9
10 package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;
11
12 public class InputRequireThisAnonymousEmpty {
13
14 private int bar; private int Override;
15 int a;
16
17 interface AnonWithEmpty {
18 public void fooEmpty();
19 }
20
21 void method() {
22 AnonWithEmpty foo = new AnonWithEmpty() {
23
24 public void emptyMethod() {
25 }
26
27 @Override
28 public void fooEmpty() {
29 int a = doSideEffect();
30 }
31
32 public int doSideEffect() {
33 return bar;
34 }
35 };
36
37 new AnonWithEmpty() {
38 int anonMember = 0;
39
40 @Override
41 public void fooEmpty() {
42 new AnonWithEmpty() {
43
44 @Override
45 public void fooEmpty() {
46 anonMember++;
47 }
48 };
49 }
50 };
51
52 new AnonWithEmpty() {
53 int foobar = 1;
54 @Override
55 public void fooEmpty() {
56 foobar++;
57 }
58 };
59 }
60
61 void method2() {
62 int a = 1;
63 InputRequireThisAnonymousEmpty obj =
64 new InputRequireThisAnonymousEmpty() {
65 void method() {
66 a += 1;
67 }
68 };
69 }
70
71 void anotherMethod() {
72 int var1 = 12;
73 int var2 = 13;
74 Foo obj = new Foo() {
75 void method() {
76 var2 += var1;
77 }
78 };
79 obj.getClass();
80 }
81 }
82
83 class SharkFoo {
84 int var1 = 12;
85 }
86
87 class Foo {
88 int var2 = 13;
89
90 class SharkFoo {
91 }
92 }