Search code examples
annotationsdocumentationjavadoc

Javadoc annotation for "copying" documentation


In my application I have few classes with package-protected methods and JavaDoc associated. I have then some other classes in same package with public methods -- in a few situations the public method is nothing more than a "proxy" for the package-protected method -- for these kinds of situation I would love to "inherit" the JavaDoc from the pp method but I don't know how to do

@inheritDoc works for inheritance situations
@see and @link creates a pointer to a class/method documentation

I would like to "copy" the documentation, not to create a link to the other's method doc. I've been looking for this kind of annotation but I did not find it.

Any idea?

btw: using NetBeans if I create an interface and implement it in a class, even though I did not annotate the class methods with @inheritDoc I can see the interface documentation when using the class methods -- still wondering why!

Thanks, Carlo


Solution

  • Per the JavaDocs documentation, this is only possible in three cases:-

    • When a method in a class overrides a method in a superclass
    • When a method in an interface overrides a method in a superinterface
    • When a method in a class implements a method in an interface

    Given that you're not overriding a method, it seems it's not possible.

    See here: Automatic re-use of method comments