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

Roger Riggs rriggs at openjdk.org
Tue Jan 10 20:02:56 UTC 2023


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

>> The javadocs of the following methods used deprecated constructors of the primitive wrapper classes:
>> 
>> java.lang.ArrayStoreException
>> java.lang.ClassCastException
>> java.lang.Double.compare(double, double)
>> java.lang.Float.compare(float, float)
>> java.lang.Integer.getInteger(String, int)
>> java.lang.Integer.valueOf(String)
>> java.lang.Integer.valueOf(String, int)
>> java.lang.Long.getLong(String, long)
>> java.lang.Long.valueOf(String)
>> java.lang.Long.valueOf(String, int)
>> java.lang.Short.valueOf(String)
>> java.lang.Short.valueOf(String, int) 
>> 
>> This change replaces the constructors with .valueOf() methods except java.lang.ClassCastException which was already fixed in JDK-8289730
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Include Byte in changes

I see your point about clarity; these snippets are not usage examples, but are showing how the method could be implemented. I'd lean toward the auto-boxing technique to keep the example to a minimum.

Since you are updating the example, perhaps they should use `@snippet lang="java" { .... }` instead of the @code and blockquote markup.

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

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


More information about the core-libs-dev mailing list