On Fri, 12 Feb 2021 20:27:00 GMT, Patrick Concannon <pconcan...@openjdk.org> 
wrote:

>> Hi,
>> 
>> Could someone please review my changeset for JDK-8252399: 'Update mapMulti 
>> documentation to use type test pattern instead of instanceof once JEP 375 
>> exits preview' ?
>> 
>> This change updates the example code displayed in the API documentation for 
>> mapMulti to use the type test pattern introduced in 
>> [JEP375](https://openjdk.java.net/jeps/375).
>> 
>> Kind regards,
>> Patrick
>
> Patrick Concannon has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8252399: Converted JavadocExamples to test

Marked as reviewed by smarks (Reviewer).

src/java.base/share/classes/java/util/stream/Stream.java line 410:

> 408:      *
> 409:      *     public static void main(String[] args) {
> 410:      *         var nestedList = ...;

I think it would be good to expand the RHS to use what you use in the test, 
namely

var nestedList = List.of(1, List.of(2, List.of(3, 4)), 5);

That would clarify the example quite a bit. Similar for the numbers example 
above.

src/java.base/share/classes/java/util/stream/Stream.java line 414:

> 412:      *     }
> 413:      * }
> 414:      * }</pre>

I'd suggest putting a comment somewhere outside the javadoc that points to the 
test and has a statement similar to the one in the test, about keeping the 
example here in synch with the test. I'm not sure what the best way is to do 
this though. It probably cannot be after the javadoc comment, because the 
javadoc comment needs to be immediately prior to the method declaration. Maybe 
a // comment above the doc comment?

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

PR: https://git.openjdk.java.net/jdk/pull/2544

Reply via email to