1
2
3
4
5
6
7
8
9
10 package com.puppycrawl.tools.checkstyle.checks.sizes.anoninnerlength;
11
12
13 class Example2 {
14 void testMethod() {
15 Runnable shortAnonClass = new Runnable() {
16 @Override
17 public void run() {
18 System.out.println("Short anonymous class.");
19 }
20 };
21 shortAnonClass.run();
22
23 Runnable longAnonClass = new Runnable() {
24 @Override
25 public void run() {
26 System.out.println("This is a lengthy anonymous class.");
27 System.out.println("It has too many lines of code.");
28 System.out.println("Exceeding the length limit.");
29 System.out.println("This would trigger the AnonInnerLength rule.");
30 }
31 };
32 longAnonClass.run();
33 }
34 }
35