View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="DescendantToken">
5         <property name="tokens" value="CLASS_DEF,INTERFACE_DEF"/>
6         <property name="limitedTokens" value="VARIABLE_DEF"/>
7         <property name="maximumDepth" value="2"/>
8         <property name="maximumNumber" value="1"/>
9       </module>
10    </module>
11  </module>
12  */
13  package com.puppycrawl.tools.checkstyle.checks.descendanttoken;
14  
15  // xdoc section -- start
16  class Example13 {
17    private int field1;
18  
19    // Some code
20  }
21  // violation below, 'Count of 2 for 'CLASS_DEF' descendant'
22  class ExampleTest {
23    private int field1;
24    private int field2;
25  
26    // Some code
27  }
28  interface Test1 {
29    int FIELD_1 = 1;
30  }
31  // violation below,'Count of 2 for 'INTERFACE_DEF' descendant'
32  interface Test2 {
33    int FIELD_1 = 1;
34    int FIELD_2 = 2;
35  }
36  // xdoc section -- end
37