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?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The point of documentation is to illuminate future users of an item. This is partly for the convenience of the author, so that he or she does not have to be contacted whenever someone cannot figure out how the thing works. Mostly, however, it is for the benefit of the people who need to use or support the thing.
As such, the point should be clarity, as opposed to convenience for the author. You cannot expect folks to hunt up and down through your API documentation because you were essentially too lazy to repeat yourself. Suck it up--Javadoc will be repetitive.
That said, there's no reason, if you're clever, you can't write a program that would stick comments into your code based on markers or some other criteria. It may be more trouble than it's worth. Or not.
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.