RFR: 8300792: Refactor examples in java.net.http to use @snippet [v2]

Daniel Fuchs dfuchs at openjdk.org
Wed Feb 22 18:26:31 UTC 2023


On Wed, 22 Feb 2023 16:02:16 GMT, Darragh Clarke <duke at openjdk.org> wrote:

>> Refactored instances of `@code` to instead use `@snippet`.
>> 
>> I also spent some time looking into using external snippets to reference the existing files `JavadocExamples` and `WebSocketExample` though ultimately thought it was better to keep the docs pretty much as they had been with only a few small changes to formatting.
>
> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   cleaned up formatting, fixed snippets breaking when code sample starts on same line

src/java.net.http/share/classes/java/net/http/HttpRequest.java line 571:

> 569:      *
> 570:      * {@snippet :
> 571:      *   // Request body from a String

Since this snippet contains three different individual examples it would be better to have each example in its own snippet.

src/java.net.http/share/classes/java/net/http/HttpResponse.java line 279:

> 277:      * convert a flow of response body data into common high-level Java objects:
> 278:      *
> 279:      * {@snippet :

Same remark here. It would make more sense to have each example in its own snippet.

src/java.net.http/share/classes/java/net/http/HttpResponse.java line 917:

> 915:      *
> 916:      * {@snippet :
> 917:      *   // Streams the response body to a File

And here as well.

-------------

PR: https://git.openjdk.org/jdk/pull/12692


More information about the net-dev mailing list