Click here to Skip to main content
15,304,276 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
I'm writing a subclass and while adding documentation, I would like to add detail to a method which I'm not changing. More specifically, I'm inheriting a List<> and it only contains items after certain other method calls, a detail I would like to add to the description of inherited methods such as get(). Preferrably, I would like to do this without something like the following:
*Updated description
public int get(int n)
    return super.get(n)

Google has failed me in finding an answer to this.

Thanks in advance.

1 solution

I have a horrible feeling that you're stuck between a rock and a hard place.

If you don't override the methods of your base class, I can't see how you can fiddle with their Javadoc. Consider the case where I derive two subclasses D and E from base class B. B.x() in inherited by both, and has Javadoc. However, I want the Javadoc of D.x() to tell me that D deals with even integers. I want E.x() likewise to tell me that E works with odd integers.

If you want to decorate the Javadoc in the derived class, the only solution I can see is as in your code snippet. Depending on how much work the method does, the overhead of another level of method call may be acceptable.

btw, thanks for a thought-provoking and well-expressed question!


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900