Unused parameters are misleading. Whatever the values passed to such parameters, the behavior will be the same.
void doSomething(int a, int b) { // "b" is unused
compute(a);
}
void doSomething(int a) {
compute(a);
}
The rule will not raise issues for unused parameters:
@javax.enterprise.event.Observes default methods throw or that have empty bodies @SuppressWarning("unchecked") or @SuppressWarning("rawtypes"), in
which case the annotation will be ignored
@Override
void doSomething(int a, int b) { // no issue reported on b
compute(a);
}
public void foo(String s) {
// designed to be extended but noop in standard case
}
protected void bar(String s) {
//open-closed principle
}
public void qix(String s) {
throw new UnsupportedOperationException("This method should be implemented in subclasses");
}
/**
* @param s This string may be use for further computation in overriding classes
*/
protected void foobar(int a, String s) { // no issue, method is overridable and unused parameter has proper javadoc
compute(a);
}