1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="IllegalThrows"/> 5 <module name="SuppressionXpathSingleFilter"> 6 <property name="checks" value="IllegalThrows"/> 7 <property name="query" value="//LITERAL_THROWS/IDENT[@text='RuntimeException' 8 and ./ancestor::METHOD_DEF[./IDENT[@text='throwsMethod']]]"/> 9 </module> 10 </module> 11 </module> 12 */ 13 14 package com.puppycrawl.tools.checkstyle.filters.suppressionxpathsinglefilter; 15 16 // xdoc section -- start 17 public class Example12 { 18 // filtered violation below 'Throwing 'RuntimeException' is not allowed.' 19 public void throwsMethod() throws RuntimeException { 20 } 21 22 // violation below, 'Throwing 'RuntimeException' is not allowed.' 23 public void sampleMethod() throws RuntimeException { 24 } 25 } 26 // xdoc section -- end