Skip to content

Commit cd10c72

Browse files
justin-curtis-lunaotoj
authored andcommittedJan 9, 2023
8299500: Usage of constructors of primitive wrapper classes should be avoided in java.text API docs
Reviewed-by: naoto, lancea
1 parent bfd5971 commit cd10c72

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed
 

‎src/java.base/share/classes/java/text/ChoiceFormat.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -108,7 +108,7 @@
108108
* pattform.setFormats(testFormats);
109109
* Object[] testArgs = {null, "ADisk", null};
110110
* for (int i = 0; i < 4; ++i) {
111-
* testArgs[0] = new Integer(i);
111+
* testArgs[0] = Integer.valueOf(i);
112112
* testArgs[2] = testArgs[0];
113113
* System.out.println(pattform.format(testArgs));
114114
* }

‎src/java.base/share/classes/java/text/MessageFormat.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -249,7 +249,7 @@
249249
* <blockquote><pre>
250250
* int fileCount = 1273;
251251
* String diskName = "MyDisk";
252-
* Object[] testArgs = {new Long(fileCount), diskName};
252+
* Object[] testArgs = {Long.valueOf(fileCount), diskName};
253253
*
254254
* MessageFormat form = new MessageFormat(
255255
* "The disk \"{1}\" contains {0} file(s).");
@@ -275,7 +275,7 @@
275275
*
276276
* int fileCount = 1273;
277277
* String diskName = "MyDisk";
278-
* Object[] testArgs = {new Long(fileCount), diskName};
278+
* Object[] testArgs = {Long.valueOf(fileCount), diskName};
279279
*
280280
* System.out.println(form.format(testArgs));
281281
* </pre></blockquote>
@@ -307,12 +307,11 @@
307307
* will be the final result of the parsing. For example,
308308
* <blockquote><pre>
309309
* MessageFormat mf = new MessageFormat("{0,number,#.##}, {0,number,#.#}");
310-
* Object[] objs = {new Double(3.1415)};
310+
* Object[] objs = {Double.valueOf(3.1415)};
311311
* String result = mf.format( objs );
312312
* // result now equals "3.14, 3.1"
313-
* objs = null;
314313
* objs = mf.parse(result, new ParsePosition(0));
315-
* // objs now equals {new Double(3.1)}
314+
* // objs now equals {Double.valueOf(3.1)}
316315
* </pre></blockquote>
317316
*
318317
* <p>

3 commit comments

Comments
 (3)

openjdk-notifier[bot] commented on Jan 9, 2023

@openjdk-notifier[bot]

justin-curtis-lu commented on Jan 13, 2023

@justin-curtis-lu
MemberAuthor

/backport jdk20

openjdk[bot] commented on Jan 13, 2023

@openjdk[bot]

@justin-curtis-lu the backport was successfully created on the branch justin-curtis-lu-backport-cd10c727 in my personal fork of openjdk/jdk20. To create a pull request with this backport targeting openjdk/jdk20:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit cd10c727 from the openjdk/jdk repository.

The commit being backported was authored by Justin Lu on 9 Jan 2023 and was reviewed by Naoto Sato and Lance Andersen.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk20:

$ git fetch https://github.com/openjdk-bots/jdk20 justin-curtis-lu-backport-cd10c727:justin-curtis-lu-backport-cd10c727
$ git checkout justin-curtis-lu-backport-cd10c727
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk20 justin-curtis-lu-backport-cd10c727
Please sign in to comment.