# Remove Explicit Call To super()

# 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.

# Tags

# 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();
     }
}

🛠️ Auto-refactor Available

You can auto-refactor this with jSparrow.
Drop this button to your Eclipse IDE workspace to install jSparrow for free:

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

Need help? Check out our installation guide.

# Properties

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