I got some troubles with a Sonar issue.
I have a bunch of child classes, and I declared a concrete method in the parent class. When called, this method should do something in common for every child class, and then just some of the child classes would override it to do some extra steps.
Parent class method:
protected void doSomething(Object firstParameter, Object secondParameter) {
//do something with first parameter
}
Child class method:
@Override
protected void doSomething(Object firstParameter, Object secondParameter) {
super.doSomething(firstParameter, secondParameter)
//do something with second parameter
}
The problem is that the concrete method in the parent class doesn't use secondParameter
while the child class does.
Therefore, I got a Sonar issue:
Remove this unused method parameter "careCase".
Can you please help? Is it due to bad design? I just want all the child classes to do something when this method is triggered, but just a few of them to do another extra thing (which requires the second parameter)