RFR: 8299498: Usage of constructors of primitive wrapper classes should be avoided in java.lang API docs [v2]

Joe Darcy darcy at openjdk.org
Tue Jan 10 20:07:52 UTC 2023


On Tue, 10 Jan 2023 18:40:28 GMT, Justin Lu <duke at openjdk.org> wrote:

> > Given that type conversions create the primitive wrapper instances when they are needed, I think the examples should be reconsidered. They needlessly suggest that the wrapper instances need to be explicitly created.
> 
> Hi Roger, thanks for the comment,
> 
> When I was deciding between autoboxing and using the valueOf() methods, I personally saw the latter as providing more clarity from a documentation standpoint but I understand your concerns. Curious what others think on the decision of using one vs the other.

I concur that it is clearer to readers to have the explicit valueOf call in the code examples.

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

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


More information about the core-libs-dev mailing list