View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="DescendantToken">
5         <property name="tokens" value="METHOD_DEF"/>
6         <property name="limitedTokens" value="EXPR"/>
7         <property name="maximumNumber" value="2"/>
8       </module>
9     </module>
10  </module>
11  */
12  package com.puppycrawl.tools.checkstyle.checks.descendanttoken;
13  
14  // xdoc section -- start
15  class Example11 {
16    void testMethod1() {
17      int x = 1;
18      int z = x + 2;
19    }
20    // violation below, 'Count of 3 for 'METHOD_DEF' descendant'
21    void testMethod2() {
22      int x = 1;
23      int y = 2;
24      int z = x + y;
25    }
26  }
27  // xdoc section -- end