javadoc & sealed class & generics

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Feb 18 21:22:26 UTC 2022


Udo,

What does `javac` report?   `javadoc` uses the `javac` front end, and 
those look like `javac` errors to me, implying this is invalid source code.

-- Jon


On 2/18/22 1:00 PM, Udo Höfel wrote:
>
> Dear all,
>
> Please consider the following example
>
>     import test.A.B;
>     import test.A.C;
>
>     public sealed class A permits B<?>, C {
>         public static final class B<T> extends A { }
>         public static final class C    extends A { }
>     }
>
> Calling "javadoc.exe --release 17 A.java" produces the following error:
>
>     Loading source file A.java...
>     A.java:6: error: '{' expected
>     public sealed class A permits B<?>, C {
>                                    ^
>     A.java:9: error: class, interface, enum, or record expected
>     }
>     ^
>     2 errors
>
> The following works fine, though:
>
>     import test.A.B;
>     import test.A.C;
>
>     public sealed class A permits B, C {
>         public static final class B extends A { }
>         public static final class C extends A { }
>     }
>
> produces:
>
>     Loading source file A.java...
>     Constructing Javadoc information...
>     Building index for all the packages and classes...
>     Standard Doclet version 17.0.2+8-86
>     ...
>
> Am I missing something here? The first example produces no warnings 
> (at least in eclipse) and compiles just fine, except for javadoc.
> My version is
>
>     openjdk 17.0.2 2022-01-18
>     OpenJDK Runtime Environment (build 17.0.2+8-86)
>     OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
>
> Best,
>
> Udo
>
>
> -- 
> Dr. Udo Höfel
> Max Planck Institute for Plasma Physics, Branch Greifswald
> Wendelsteinstraße 1 (Room: 7.1 003), D-17491, Greifswald, Germany
> Phone: +49 (0)3834 88 1825
> Fax:   +49 (0)3834 88 2509
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/javadoc-dev/attachments/20220218/2b8c8a59/attachment-0001.htm>


More information about the javadoc-dev mailing list