View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="AnonInnerLength"/>
5     </module>
6   </module>
7   */
8   package com.puppycrawl.tools.checkstyle.checks.sizes.anoninnerlength;
9   
10  // xdoc section -- start
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  // xdoc section -- end