View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="ExecutableStatementCount">
5         <property name="max" value="2"/>
6         <property name="tokens" value="CTOR_DEF"/>
7       </module>
8     </module>
9   </module>
10  */
11  package com.puppycrawl.tools.checkstyle.checks.sizes.executablestatementcount;
12  
13  // xdoc section -- start
14  class Example2 {
15  
16    Example2() { // violation, 'Executable statement count is 3 (max allowed is 2)'
17      int a=10;
18      int b=20;
19      int sub=b-a;
20    }
21    void testMethod1() {
22      int a = 10;
23      int b = 20;
24      int sum = a + b;
25    }
26  }
27  // xdoc section -- end