View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="MethodCount">
5         <property name="maxTotal" value="5"/>
6       </module>
7     </module>
8   </module>
9   */
10  package com.puppycrawl.tools.checkstyle.checks.sizes.methodcount;
11  
12  // xdoc section -- start
13  class Example2 { // violation, 'Total number of methods is 6 (max allowed is 5)'
14  
15    public void outerMethod1(int i) {}
16    public void outerMethod2() {}
17    public void outerMethod3(String str) {}
18  
19    private void outerMethod4() {
20      Runnable r = (new Runnable() {
21        public void run() {} // NOT counted towards Example2
22      });
23    }
24  
25    private void outerMethod5(int i) {}
26    void outerMethod6(int i, int j) {}
27  
28    public static class InnerExample{
29      public void innerMethod1() {} // NOT counted towards Example2
30      public void innerMethod2() {} // NOT counted towards Example2
31    }
32  }
33  // xdoc section -- end