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

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Jan 11 14:07:43 PST 2011


Chris,

There was a major update to javadoc in 1.7.0 b123, so it would help to 
know which version you are using.

-- Jon

On 01/11/2011 01:56 PM, Chris Povirk wrote:
> 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 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