RFR: 8316150: Refactor get chars and string size
ExE Boss
duke at openjdk.org
Mon Oct 16 16:18:15 UTC 2023
On Wed, 13 Sep 2023 01:24:05 GMT, Shaojin Wen <duke at openjdk.org> wrote:
> 1. Reduce duplicate stringSize code
> 2. Move java.lang.StringLatin1.getChars to jdk.internal.util.DecimalDigits::getCharLatin1,not only java.lang, other packages also need to use this method
The `throws Throwable` declarations are no longer needed, as the prependers no longer depend on `MethodHandle`s.
src/java.base/share/classes/java/util/FormatItem.java line 66:
> 64:
> 65: private static long stringPrepend(long lengthCoder, byte[] buffer,
> 66: String value) throws Throwable {
Suggestion:
private static long stringPrepend(long lengthCoder, byte[] buffer, String value) {
src/java.base/share/classes/java/util/FormatItem.java line 131:
> 129:
> 130: @Override
> 131: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 139:
> 137: }
> 138:
> 139: private long prependLatin1(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
private long prependLatin1(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 180:
> 178: }
> 179:
> 180: private long prependUTF16(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
private long prependUTF16(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 250:
> 248:
> 249: @Override
> 250: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 258:
> 256: }
> 257:
> 258: protected long prependLatin1(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
protected long prependLatin1(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 271:
> 269: }
> 270:
> 271: protected long prependUTF16(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
protected long prependUTF16(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 277:
> 275: this.hasPrefix = hasPrefix;
> 276: this.value = value;
> 277: this.length = HexDigits.INSTANCE.size(value);
Suggestion:
this.length = OctalDigits.INSTANCE.size(value);
src/java.base/share/classes/java/util/FormatItem.java line 318:
> 316:
> 317: @Override
> 318: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 326:
> 324: }
> 325:
> 326: protected long prependLatin1(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
protected long prependLatin1(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 343:
> 341: }
> 342:
> 343: protected long prependUTF16(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
protected long prependUTF16(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 383:
> 381:
> 382: @Override
> 383: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 412:
> 410:
> 411: @Override
> 412: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 524:
> 522:
> 523: @Override
> 524: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 559:
> 557:
> 558: @Override
> 559: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
src/java.base/share/classes/java/util/FormatItem.java line 597:
> 595:
> 596: @Override
> 597: public long prepend(long lengthCoder, byte[] buffer) throws Throwable {
Suggestion:
public long prepend(long lengthCoder, byte[] buffer) {
-------------
PR Review: https://git.openjdk.org/jdk/pull/15699#pullrequestreview-1640929916
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047834
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048116
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048122
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048144
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048153
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048157
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048166
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1334053601
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047918
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047924
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047939
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047966
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047973
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047980
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335047986
PR Review Comment: https://git.openjdk.org/jdk/pull/15699#discussion_r1335048008
More information about the core-libs-dev
mailing list