Skip to content

Files

Latest commit

 

History

History
32 lines (21 loc) · 794 Bytes

AvoidNoArgumentSuperConstructorCall.md

File metadata and controls

32 lines (21 loc) · 794 Bytes

Pattern: Redundant call to superclass constructor without arguments

Issue: -

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();.

Examples

Example of violations:

class MyClass extends SomeOtherClass {
    MyClass() {
        super(); // violation
    }

    MyClass(int arg) {
        super(arg); // OK, call with argument have to be explicit
    }

    MyClass(long arg) {
        // OK, call is implicit
    }
}
 

Further Reading