RFR: 8357176: java.awt javadoc code examples still use Applet API [v3]
Phil Race
prr at openjdk.org
Tue May 20 22:09:37 UTC 2025
On Tue, 20 May 2025 20:00:16 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8357176
>
> src/java.desktop/share/classes/java/awt/BorderLayout.java line 103:
>
>> 101: *
>> 102: * <hr><blockquote><pre>
>> 103: * import java.awt.BorderLayout;
>
> Should we replace `<blockquote><pre>` with `{@snippet}` instead?
>
> So, the sample could look like this:
>
>
> * {@snippet lang='java':
> * import java.awt.BorderLayout;
> * // all the other code
> * });
> * }
> * }
> * }
>
> The last `}` closes the `{@snippet}`, the previous `}` closes `BorderLayoutExample` class.
>
> I used `{@snippet}` in [`PassFailJFrame` javadocs](https://github.com/openjdk/jdk/blob/972f2ebe978280d22531a70116e79837632f6ebc/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java#L166-L185), and it looks like this in [the generated javadoc](https://cr.openjdk.org/~aivanov/PassFailJFrame/api/PassFailJFrame.html#sampleManualTestCode) with a *Copy* button embedded.
>
> [Programmer's Guide to Snippets](https://docs.oracle.com/en/java/javase/21/javadoc/snippets.html) explains how to use this new javadoc feature available since Java 18 ([JDK-8201533](https://bugs.openjdk.org/browse/JDK-8201533)).
updated to use snippets.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25278#discussion_r2098948465
More information about the client-libs-dev
mailing list