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