Javadoc bug: @link to method with generic, omitted parameters

Chris Povirk cpovirk at
Tue Jan 11 13:56:18 PST 2011

A parameters-omitted @link to a method that accepts a generic type as
a parameter doesn't work right.  When filling in the type parameter,
javadoc inserts a literal (e.g.) <B>, rather than &lt;B&gt; (or,
better(?), nothing at all).  The result is that the remainder of the
page renders in bold.

$ cat
 * This class contains {@link #bar} and nothing else.
public class LinkToGenericOmittedParameters
  interface Foo<B> {}

  void bar(Foo<B> foo) {}

$ javadoc -d javadocout

$ firefox javadocout/LinkToGenericOmittedParameters.html
Notice that the page is in bold from the closing paren of
"bar(LinkToGenericOmittedParameters.Foo)" onward.  The source HTML
shows the <B> that has been inserted:

$ grep 'and nothing else' javadocout/LinkToGenericOmittedParameters.html
<div class="block">This class contains <a
and nothing else.</div>

(...or -- different version, though I'd have to check with Martin to
determine precisely what our "jdk1.7.0-latest" and "jdk1.7.0-latest"
directories contain...)
This class contains <A
and nothing else.

Workaround: {@link #bar(Foo)} works fine.

More information about the compiler-dev mailing list