Javadoc bug: @link to method with generic, omitted parameters
Chris Povirk
cpovirk at google.com
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 <B> (or,
better(?), nothing at all). The result is that the remainder of the
page renders in bold.
$ cat LinkToGenericOmittedParameters.java
/**
* This class contains {@link #bar} and nothing else.
*/
public class LinkToGenericOmittedParameters
{
interface Foo<B> {}
void bar(Foo<B> foo) {}
}
$ javadoc LinkToGenericOmittedParameters.java -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
href="LinkToGenericOmittedParameters.html#bar(LinkToGenericOmittedParameters.Foo)"><code>bar(LinkToGenericOmittedParameters.Foo<B>)</code></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
HREF="LinkToGenericOmittedParameters.html#bar(LinkToGenericOmittedParameters.Foo)"><CODE>bar(LinkToGenericOmittedParameters.Foo<B>)</CODE></A>
and nothing else.
Workaround: {@link #bar(Foo)} works fine.
More information about the compiler-dev
mailing list