Since Checkstyle 5.8
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="OverloadMethodsDeclarationOrder"/> </module> </module>
Example of correct and incorrect grouping of overloaded methods:
class Example1 { void same(int i) {} // comments between overloaded methods are allowed. void same(String s) {} void same(String s, int i) {} void same(int i, String s) {} void notSame() {} interface notSame{} void otherSame(String s) {} void foo() {} // violation below, 'All overloaded methods should be placed next to each other' void otherSame(String s, int i) {} }
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
com.puppycrawl.tools.checkstyle.checks.coding