AvoidNoArgumentSuperConstructorCall

Since Checkstyle 8.29

Description

Checks if call to superclass constructor without arguments is present. Such invocation is redundant because constructor body implicitly begins with a superclass constructor invocation super(); See specification for detailed information.

Examples

To configure the check:

<module name="Checker">
  <module name="TreeWalker">
    <module name="AvoidNoArgumentSuperConstructorCall"/>
  </module>
</module>
        

Example of violations

class SuperClass {
  public SuperClass() {}
  public SuperClass(int arg) {}
}
class Example1 extends SuperClass {
  Example1() {
    super(); // violation
  }

  Example1(int arg) {
    super(arg); // ok, explicit constructor invocation with argument
  }

  Example1(long arg) {
    // ok, no explicit constructor invocation
  }
}
        

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Package

com.puppycrawl.tools.checkstyle.checks.coding

Parent Module

TreeWalker