Relative link tags in record javadoc don't resolve

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Dec 24 19:54:35 UTC 2019


Michael,

Thanks for the report.

I'll follow up and file a  bug if necessary.

-- Jon

On 12/24/19 11:28 AM, Michael Hixson wrote:
> Hello,
>
> The javadoc tool in 14-ea+28-1366 doesn't resolve {@link} tags in
> records unless the link target is qualified with its class name.  This
> seems like a bug because it's different than the behavior for
> non-record classes.
>
> Take this code for example:
>
>      package example;
>
>      public class JavadocTest {
>        /**
>         * {@link #foo()}
>         * {@link Bar}
>         */
>        public static class Foo {
>          public void foo() {}
>        }
>
>        /**
>         * {@link #bar()}
>         * {@link Foo}
>         */
>        public record Bar() {
>          public void bar() {}
>        }
>      }
>
> The javadoc tool complains about both of the link tags in the "Bar"
> record class.  It's fine with the similar-looking link tags in the
> "Foo" non-record class.
>
>      javadoc --enable-preview --release 14 -d jdoc
> src/main/java/example/JavadocTest.java
>
>      src\main\java\example\JavadocTest.java:13: error: reference not found
>         * {@link #bar()}
>                  ^
>      src\main\java\example\JavadocTest.java:14: error: reference not found
>         * {@link Foo}
>                  ^
>
> If I qualify the link tags in the record class, then javadoc is happy.
>
>      package example;
>
>      public class JavadocTest {
>        /**
>         * {@link #foo()}
>         * {@link Bar}
>         */
>        public static class Foo {
>          public void foo() {}
>        }
>
>        /**
>         * {@link JavadocTest.Bar#bar()}
>         * {@link JavadocTest.Foo}
>         */
>        public record Bar() {
>          public void bar() {}
>        }
>      }
>
> -Michael


More information about the amber-dev mailing list