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