View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="LocalFinalVariableName">
5         <property name="format" value="^[A-Z][A-Z0-9]*$"/>
6       </module>
7       <module name="SuppressionXpathSingleFilter">
8         <property name="checks" value="LocalFinalVariableName"/>
9         <property name="query" value="//CLASS_DEF[./IDENT[@text='Example9']]/OBJBLOCK
10              /METHOD_DEF[./IDENT[@text='testMethod']]/SLIST
11              /VARIABLE_DEF/IDENT[@text='testVariable1']"/>
12      </module>
13    </module>
14  </module>
15  */
16  
17  package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter;
18  
19  // xdoc section -- start
20  public class Example9 {
21    public void testMethod() {
22      // filtered violation below 'Name 'testVariable1' must match pattern'
23      final int testVariable1 = 10;
24      // violation below, 'Name 'testVariable2' must match pattern'
25      final int testVariable2 = 10;
26    }
27  }
28  // xdoc section -- end