# Remove Inherited Interfaces from Class Declaration
# Description
This rule removes interfaces from class declaration, which are already implemented by a super class. These interfaces are inherited from the super class.
# Benefits
Removing redundant syntax improves readability.
# Tags
# Code Changes
Pre
class Child extends Parent implements Observer {
@Override
public void update(Observable o, Object arg) {
// do nothing
}
}
class Parent implements Observer {
@Override
public void update(Observable o, Object arg) {
// do nothing
}
}
Post
class Child extends Parent {
@Override
public void update(Observable o, Object arg) {
// do nothing
}
}
class Parent implements Observer {
@Override
public void update(Observable o, Object arg) {
// do nothing
}
}
🛠️ Auto-refactor Available
You can auto-refactor this with jSparrow.
Drop this button to your Eclipse IDE workspace to install jSparrow for free:
Need help? Check out our installation guide.
# Properties
Property | Value |
---|---|
Rule ID | ReImplementingInterface |
First seen in jSparrow version | 2.2.0 |
Minimum Java version | 1 |
Remediation cost | 2 min |
Links |