Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override method's javadoc without overriding the method itself?

Say I have two classes:

public abstract class AbstractFoo {

    /**
     * Do bar. Subclasses may override this method, it is not required that they do baz.
     */
    public void bar() {
        // default implementation
    }

}

public class ConcreteFoo extends AbstractFoo {

    /**
     * Do bar. <b>Note:</b> does not do baz, you have to do it yourself.
     */
    @Override
    public void bar() {
        super.bar();
    }
}

In the subclass (ConcreteFoo) I want to override bar()'s javadoc but keep the implementation as in the super class (AbstractFoo). Is there any way to do this without overriding the method?

like image 797
Actine Avatar asked Oct 18 '22 17:10

Actine


1 Answers

No there is absolutely no way of doing that.
You should, however, use the

/**
 * {@inheritDoc}
 * add whatever you would like here
 */

notation as the implementation javadoc, if you plan on really overriding the method.

like image 138
Idos Avatar answered Oct 21 '22 06:10

Idos