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:
Justin Lu 2023-01-11 17:18:39 +00:00 committed by Naoto Sato
parent 437d69a220
commit d663b5da10
7 changed files with 22 additions and 22 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ package java.lang;
* following code generates an {@code ArrayStoreException}: * following code generates an {@code ArrayStoreException}:
* <blockquote><pre> * <blockquote><pre>
* Object x[] = new String[3]; * Object x[] = new String[3];
* x[0] = new Integer(0); * x[0] = Integer.valueOf(0);
* </pre></blockquote> * </pre></blockquote>
* *
* @since 1.0 * @since 1.0

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -233,7 +233,7 @@ public final class Byte extends Number implements Comparable<Byte>, Constable {
* equal to the value of: * equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Byte(Byte.parseByte(s, radix))} * {@code Byte.valueOf(Byte.parseByte(s, radix))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed * @param s the string to be parsed
@ -262,7 +262,7 @@ public final class Byte extends Number implements Comparable<Byte>, Constable {
* equal to the value of: * equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Byte(Byte.parseByte(s))} * {@code Byte.valueOf(Byte.parseByte(s))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed * @param s the string to be parsed

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1260,7 +1260,7 @@ public final class Double extends Number
* of the integer value returned is the same as that of the * of the integer value returned is the same as that of the
* integer that would be returned by the call: * integer that would be returned by the call:
* <pre> * <pre>
* new Double(d1).compareTo(new Double(d2)) * Double.valueOf(d1).compareTo(Double.valueOf(d2))
* </pre> * </pre>
* *
* @param d1 the first {@code double} to compare * @param d1 the first {@code double} to compare

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1218,7 +1218,7 @@ public final class Float extends Number
* of the integer value returned is the same as that of the * of the integer value returned is the same as that of the
* integer that would be returned by the call: * integer that would be returned by the call:
* <pre> * <pre>
* new Float(f1).compareTo(new Float(f2)) * Float.valueOf(f1).compareTo(Float.valueOf(f2))
* </pre> * </pre>
* *
* @param f1 the first {@code float} to compare. * @param f1 the first {@code float} to compare.

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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: * object equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Integer(Integer.parseInt(s, radix))} * {@code Integer.valueOf(Integer.parseInt(s, radix))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed. * @param s the string to be parsed.
@ -979,7 +979,7 @@ public final class Integer extends Number
* object equal to the value of: * object equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Integer(Integer.parseInt(s))} * {@code Integer.valueOf(Integer.parseInt(s))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed. * @param s the string to be parsed.
@ -1286,14 +1286,14 @@ public final class Integer extends Number
* equal to the value of: * equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code getInteger(nm, new Integer(val))} * {@code getInteger(nm, Integer.valueOf(val))}
* </blockquote> * </blockquote>
* *
* but in practice it may be implemented in a manner such as: * but in practice it may be implemented in a manner such as:
* *
* <blockquote><pre> * <blockquote><pre>
* Integer result = getInteger(nm, null); * Integer result = getInteger(nm, null);
* return (result == null) ? new Integer(val) : result; * return (result == null) ? Integer.valueOf(val) : result;
* </pre></blockquote> * </pre></blockquote>
* *
* to avoid the unnecessary allocation of an {@code Integer} * to avoid the unnecessary allocation of an {@code Integer}

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1114,7 +1114,7 @@ public final class Long extends Number
* to the value of: * to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Long(Long.parseLong(s, radix))} * {@code Long.valueOf(Long.parseLong(s, radix))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed * @param s the string to be parsed
@ -1142,7 +1142,7 @@ public final class Long extends Number
* equal to the value of: * equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Long(Long.parseLong(s))} * {@code Long.valueOf(Long.parseLong(s))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed. * @param s the string to be parsed.
@ -1509,14 +1509,14 @@ public final class Long extends Number
* to the value of: * to the value of:
* *
* <blockquote> * <blockquote>
* {@code getLong(nm, new Long(val))} * {@code getLong(nm, Long.valueOf(val))}
* </blockquote> * </blockquote>
* *
* but in practice it may be implemented in a manner such as: * but in practice it may be implemented in a manner such as:
* *
* <blockquote><pre> * <blockquote><pre>
* Long result = getLong(nm, null); * Long result = getLong(nm, null);
* return (result == null) ? new Long(val) : result; * return (result == null) ? Long.valueOf(val) : result;
* </pre></blockquote> * </pre></blockquote>
* *
* to avoid the unnecessary allocation of a {@code Long} object when * to avoid the unnecessary allocation of a {@code Long} object when

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -177,7 +177,7 @@ public final class Short extends Number implements Comparable<Short>, Constable
* equal to the value of: * equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Short(Short.parseShort(s, radix))} * {@code Short.valueOf(Short.parseShort(s, radix))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed * @param s the string to be parsed
@ -206,7 +206,7 @@ public final class Short extends Number implements Comparable<Short>, Constable
* equal to the value of: * equal to the value of:
* *
* <blockquote> * <blockquote>
* {@code new Short(Short.parseShort(s))} * {@code Short.valueOf(Short.parseShort(s))}
* </blockquote> * </blockquote>
* *
* @param s the string to be parsed * @param s the string to be parsed