# Remove Explicit Call To super()

# Properties

Property Value
Rule ID RemoveExplicitCallToSuper
First seen in jSparrow version 2.7.0
Minimum Java version 1.1
Remediation cost 1 min

# Description

If a constructor does not explicitly invoke a superclass constructor, the Java compiler automatically inserts a call to the no-argument constructor of the superclass. Hence, there is no need to explicitly call the default constructor of the super class.

# Benefits

Improves the readability by removing unnecessary lines of code.

# Code Changes

Pre

class Parent {
     public Parent() {
         initParent();
     }
}

class Child extends Parent {
     public Child() {
           super();
           initChild();
     }
}

Post

class Parent {
     public Parent() {
         initParent();
     }
}

class Child extends Parent {
     public Child() {
           initChild();
     }
}

Automatic Application of This Rule

The automatic application of this rule is supported in the following jSparrow version:

# Tags

1
default
You & jSparrow
default

Hey there! May I help you? 😊