1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="MatchXpath"> 5 <property name="query" 6 value="//METHOD_DEF[.//LITERAL_PRIVATE 7 and following-sibling::METHOD_DEF[.//LITERAL_PUBLIC]]"/> 8 <message key="matchxpath.match" 9 value="Private methods must appear after public methods"/> 10 </module> 11 </module> 12 </module> 13 */ 14 package com.puppycrawl.tools.checkstyle.checks.coding.matchxpath; 15 16 // xdoc section -- start 17 public class Example1 { 18 public void method1() { } 19 private void method2() { } // violation 20 public void method3() { } 21 private void method4() { } // violation 22 public void method5() { } 23 private void method6() { } 24 } 25 // xdoc section -- end