Since Checkstyle 3.4
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="MissingCtor"/> </module> </module>
Example:
public class Example1 { private int a; Example1(int a) { this.a = a; } } class ExampleDefaultCtor { private String s; ExampleDefaultCtor() { s = "foobar"; } } class InvalidExample { // violation, 'Class should define a constructor' public void test() {} } abstract class AbstractExample { public abstract void test(); }
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