Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8224052

Javadoc doesn't handle non-public intermediate types well

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 14
    • 12, 13
    • tools
    • None

        Consider the hierarchy below:

        $ cat test/Foo.java
        package test;

        public interface Foo {
           /**
            * A foo.
            */
           Foo foo();

           /**
            * A bar.
            */
           int bar();
        }

        $ cat test/Bar.java
        package test;

        /*package*/ class Bar<F extends Foo> implements Foo {
           @Override
           public F foo() { return null; }

           @Override
           public int bar() { return 42; }
        }

        $ cat test/Baz.java
        package test;

        public class Baz extends Bar<Baz> { }


        If we generate the javadoc for these classes, the javadoc for Baz will have several issues:

        * the 'foo' member will be shown in black, and will not be clickable.
        * same fate for 'bar' member, but actually, this shouldn't even be shown?
        * the signature of the 'foo' member will mention the type-variable F, which has been bound by Baz

        (please see attached image)

        The workaround is to add dumb overrides which delegate to the superclass methods.

              hannesw Hannes Wallnoefer
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: