Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen how to inherit documents from overriden methods in a generic interface?

I have an interface Collection<T extends Item>, and a class that implements that interface Movies implements Collection<Movie>. The interface has a couple of abstract methods for sorting that are overriden by Movies.

What I want to know is, how can I get Doxygen to use the documentation from Collection.sort() and Collection.safeSort() in the class Movies? It'd be useful to know because then I can write the documentation for the interface, rather than each implementation of the interface. If I could -add- documentation to the overridden methods, that would be great, but that's not 100% necessary.

INHERIT_DOCS is set to YES by the way, I believe Doxygen is struggling because it implements Collection<Movie> and not Collection<T extends Item>.

like image 673
Chris Browne Avatar asked Sep 02 '25 18:09

Chris Browne


1 Answers

There appear to be a number of bugs filed against doxygen related to this type of behavior, see the following for some examples:

  • https://bugzilla.gnome.org/show_bug.cgi?id=516656
  • https://bugzilla.gnome.org/show_bug.cgi?id=583958
  • https://bugzilla.gnome.org/show_bug.cgi?id=631675

For a workaround, you could use @copydoc to bring the documentation in your base class in to your derived class, something like:

/**
 * Movies
 */
public class Movies extends Collection<Movie> {
    /**
     * @copydoc Collection<T extends Item>::sort()
     *
     * Additional documentation specific to Movies::sort().
     */
    public void sort(void) { return; }
}

This will allow the documentation in the base class to appear to in the derived class documentation without having to copy it.

like image 70
DRH Avatar answered Sep 04 '25 06:09

DRH