I have generated an Interface which is very well documented. Every method does have his own JavaDoc. The clases which implement this Interface can have little differents in their logic.
How can i add JavaDoc to the existing JavaDoc from the super class. The key word
/**
* {@inheritDoc}
*/
only set the javaDoc of the super class to the current method. But when i try to add some words, the JavaDoc of the super method is gone, like
/**
* {@inheritDoc}
* These value depends on...
*/
Does anybody have a idea how i can update the JavaDoc of a super method, without deleting.
EDIT:
Regarding to Brian Agnew answer, which is good but not a real answer ;)
You also can have the same problem when you want to overwrite an existing method, like paint() in Swing, and want to describ how to initialize or handle the draw behaviour from outside. This is not only for interface description.
Place the caret at the declaration in the editor, press Alt+Enter , and select Add Javadoc from the list.
super. method() not allowed in Java?” Because it violates encapsulation. Encapsulation is a principle of wrapping code and data(variables) together into a single unit.
The super keyword in Java is a reference variable that is used to refer parent class objects. The super() in Java is a reference variable that is used to refer parent class constructors. super can be used to call parent class' variables and methods. super() can be used to call parent class' constructors only.
To call methods of the superclass that is overridden in the subclass. To access attributes (fields) of the superclass if both superclass and subclass have attributes with the same name. To explicitly call superclass no-arg (default) or parameterized constructor from the subclass constructor.
I guess that when you need to add something to javadoc, you changed something. So maybe it will be correct to write javadoc in exactly same way.
/**
* Enhanced swing paint for my cool component.
* @see JButton#paint();
*/
@Override
public void paint() {
super.paint();
//my stuff
}
I don't know any direct JavaDoc idiom that does that. However Eclipse and IntelliJ will let you grab the super JDoc and insert it... it's far from perfect, as if you change the supr JDoc you will have to reedit all the overrides, but it's better than copy-paste by hand...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With