I want to write Javadoc in DRY way. But the oracle document about Javadoc says write same thing again in overload method comment. Can't I avoid repetition?
DRY way to write Javadoc on overload methods
commentsdocumentationdryjavadocs
Related Topic
- Unit Testing and DRY Principle – Best Practices
- JavaDocs – Deprecated vs. Denigrated in JavaDoc?
- Java – Is Repeating Links to the Same Class in a Single Javadoc Comment a Bad Practice?
- Javadocs – Documenting Static Overloaded Methods
- Refactoring – DRY Code and DRY Tests
- Design Principles – What to Consider When DRY and KISS Principles Are Incompatible?
- The Don’t Repeat Yourself (DRY) principle in documentation
Best Answer
I sprinkle
{@inheritDoc}
directives here and there in my Javadoc comments when overriding methods from superclasses or implementing interface-defined methods.This works well for me at least, avoids repetition in the source code, and you can still add specific information to the particular Javadoc comment if there is a need to do so. I don't consider the fact that the Javadoc comment itself is fairly bare to be any issue when all it takes in a decent IDE is to hover over the associated identifier name to get the rendered Javadoc with references and all.