Thank you for your feedback! This is an interesting use-case. However, I believe that S1186 should still not make an exception for empty default constructors that have a JavaDoc comment.
The protection that S1186 provides is still relevant in this scenario, as the implementation might be forgotten or misunderstood by readers who may wonder if it was unintentionally left out. If a default constructor has a JavaDoc, it could be even more confusing, as the documentation might describe behavior that is not actually implemented.
A similar situation arises when a subclass overrides an empty method with another empty method, simply to update the JavaDoc for the method in the subclass.
In both cases (empty default constructors and empty method overrides), I therefore think that it’s still beneficial to clearly state the developer’s intent with a comment:
class FooBar extends Bar {
/** Behavior description, notes, comments, examples */
public FooBar() {
// empty
}
/** Behavior description, notes, comments, examples */
@Override
public void doSomething() {
// empty
}
}
Would you suggest then having a rule parameter for S1186 to enable or disable the report of empty methods and constructors in case they have a JavaDoc comment?
Since there is a workaround that requires only 8 extra characters (// empty), I think it’s not worth the effort to implement that. It would also go against the spirit of that rule.