mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8299498: Usage of constructors of primitive wrapper classes should be avoided in java.lang API docs
Reviewed-by: naoto, darcy, rriggs, mchung, lancea
This commit is contained in:
parent
437d69a220
commit
d663b5da10
7 changed files with 22 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -951,7 +951,7 @@ public final class Integer extends Number
|
|||
* object equal to the value of:
|
||||
*
|
||||
* <blockquote>
|
||||
* {@code new Integer(Integer.parseInt(s, radix))}
|
||||
* {@code Integer.valueOf(Integer.parseInt(s, radix))}
|
||||
* </blockquote>
|
||||
*
|
||||
* @param s the string to be parsed.
|
||||
|
@ -979,7 +979,7 @@ public final class Integer extends Number
|
|||
* object equal to the value of:
|
||||
*
|
||||
* <blockquote>
|
||||
* {@code new Integer(Integer.parseInt(s))}
|
||||
* {@code Integer.valueOf(Integer.parseInt(s))}
|
||||
* </blockquote>
|
||||
*
|
||||
* @param s the string to be parsed.
|
||||
|
@ -1286,14 +1286,14 @@ public final class Integer extends Number
|
|||
* equal to the value of:
|
||||
*
|
||||
* <blockquote>
|
||||
* {@code getInteger(nm, new Integer(val))}
|
||||
* {@code getInteger(nm, Integer.valueOf(val))}
|
||||
* </blockquote>
|
||||
*
|
||||
* but in practice it may be implemented in a manner such as:
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* Integer result = getInteger(nm, null);
|
||||
* return (result == null) ? new Integer(val) : result;
|
||||
* return (result == null) ? Integer.valueOf(val) : result;
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* to avoid the unnecessary allocation of an {@code Integer}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue