javajavadoccustom-tagtaglet

Expand inline tags in custom Javadoc taglet


I wrote a custom Javadoc taglet that adds a new note tag:

 ...
 public boolean isInlineTag() { return false; }

  public String toString(Tag tag) {
      return "<pre class='note'>" + tag.text() + "</pre>";
   }

It works so far, but inline tags are not expanded. Here is an example comment:

/**
 * @note Test note with {@link Someclass} // @link tag is NOT expanded
 * @param name - here the {@link Someclass} works // works for standard 'param' tag
 */

The {@link} inline tag is not expanded. However, it works just fine for the built-in param javadoc tag.

Is there a way to expand nested inline tags in a custom Javadoc taglet?

Thanks!


Solution

  • The Taglet overview says:

    Taglets can be written as either block tags, such as @todo, or inline tags, such as {@underline}. Block taglets do not currently support inline tags in their text.

    In fact, the taglet API is a bit too minimal, as it supports only the toString() method.

    You could inside this method retrieve the subtags of the parameter tag (with .inlineTags()), but then you would have to format them yourself, since you don't have access to the normal machinery of the standard doclet from your taglet.

    So, looks like you are out of luck here, if you don't want to reimplement (or copy) parts of the standard doclet in your own taglet. (But then, you could the same directly extend the standard doclet instead of patching it with taglets.)