Search code examples
javajavadoc

Method listed twice in JavaDoc


I have two classes and two interfaces. InterfaceA

package ch.sukha.testmachine.client;
interface InterfaceA {
    /**
     * Foo.
     */
    void foo();
}

is the super interface of InterfaceB.

package ch.sukha.testmachine.client;
public interface InterfaceB extends InterfaceA {
   /**
    * Bar.
    */
   void bar();
}

Likewise, class A is the super class of

package ch.sukha.testmachine.client;
class A implements InterfaceA {
    @Override
    public void foo() {
    }
}

class B.

package ch.sukha.testmachine.client;
public class B extends A implements InterfaceB {
    @Override
    public void bar() {
    }
}

In the generated JavaDoc, method foo appears twice.

enter image description here


Solution

  • A is not exported. I want to create multiple subclasses of A and reuse the documentation of InterfaceA.

    Export everything to JavaDoc.

    To reuse parts of it, you can use the

    @inheritDoc 
    

    annotation.