[jdk20] RFR: 4958969: ObjectOutputStream example leads to non-working code

Roger Riggs rriggs at openjdk.org
Mon Dec 19 20:33:51 UTC 2022


On Mon, 19 Dec 2022 20:22:22 GMT, Lance Andersen <lancea at openjdk.org> wrote:

>> Update javadoc examples to use try-with-resources and use javadoc snippet tags.
>> The examples in ObjectInputStream and ObjectOutputStream get an update with
>> try-with-resources and use of javadoc snippet tags.
>> ObjectInputFilter is updated with use of snippet tags instead of html markup.
>
> src/java.base/share/classes/java/io/ObjectInputStream.java line 126:
> 
>> 124:  *         String label = (String) ois.readObject();
>> 125:  *         LocalDateTime date = (LocalDateTime) ois.readObject();
>> 126:  *         System.out.println(label + ": " + date);
> 
> would it be worth using `System.out.printf` here?

Maybe printing is a distraction; there many preferences for output and the original did not include it.
Simple string concatenation is the most efficient, but the least parameterizable.

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

PR: https://git.openjdk.org/jdk20/pull/59


More information about the core-libs-dev mailing list