javadoc & sealed class & generics

Udo Höfel udo at hoefel.eu
Fri Feb 18 21:00:47 UTC 2022


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/689a5f95/attachment.htm>


More information about the javadoc-dev mailing list