开发者

Javadoc {@inheritDoc} tag class

I would like to use the {@inheritDoc} class to inherit methods from开发者_开发技巧 my abstract class. In the documentation for the abstract class, I refer to the abstract class by name. How can I tag this so when the subclass inherits the documentation from the super class, it replaces the abstract class's name with the subclass's name?


What you are describing is not supported by the javadoc generation tool.

And I think that there is a good reason for this too:

If your method in the subclass is merely an implementation of an abstract method, then I think it would be correct to leave the abstract class' name in there.

On the flip side, if your method in the subclass is not just a simple implementation, and does something more that is noteworthy (enough to be mentioned in the javadoc), then you should write a new javadoc on the method in the subclass, instead of invoking inheritDoc.


I'm not aware of a way, but you might elaborate on why you want {@inheritDoc} to do this. I may misunderstand, but it seems confusing. You can document how your concrete implementation varies form the parent and use @see to refer to the contract in the abstract class. Note "Automatic Copying of Method Comments" may obviate the need for an explicit {@inheritDoc}.


You can also, IIRC, write additional text around the {@inheritDoc} tag in your own comments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜