On Thu, 22 Jun 2023 12:18:21 GMT, ExE Boss <d...@openjdk.org> wrote: >> 温绍锦 has updated the pull request incrementally with one additional commit >> since the last revision: >> >> use ByteArray.setInt & setLong > > src/java.base/share/classes/java/lang/Long.java line 527: > >> 525: buf[70 + off] = (byte) i15; >> 526: >> 527: return new String(buf, UTF16); > > Maybe restore the `else` block? > Suggestion: > > } else { > byte[] buf = new byte[72]; > int off = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN ? 1 : 0; > > buf[0 + off] = (byte) (i0 >> 8); > buf[2 + off] = (byte) i0; > buf[4 + off] = (byte) (i1 >> 8); > buf[6 + off] = (byte) i1; > buf[8 + off] = (byte) (i2 >> 8); > buf[10 + off] = (byte) i2; > buf[12 + off] = (byte) (i3 >> 8); > buf[14 + off] = (byte) i3; > buf[16 + off] = '-'; > buf[18 + off] = (byte) (i4 >> 8); > buf[20 + off] = (byte) i4; > buf[22 + off] = (byte) (i5 >> 8); > buf[24 + off] = (byte) i5; > buf[26 + off] = '-'; > buf[28 + off] = (byte) (i6 >> 8); > buf[30 + off] = (byte) i6; > buf[32 + off] = (byte) (i7 >> 8); > buf[34 + off] = (byte) i7; > buf[36 + off] = '-'; > buf[38 + off] = (byte) (i8 >> 8); > buf[40 + off] = (byte) i8; > buf[42 + off] = (byte) (i9 >> 8); > buf[44 + off] = (byte) i9; > buf[46 + off] = '-'; > buf[48 + off] = (byte) (i10 >> 8); > buf[50 + off] = (byte) i10; > buf[52 + off] = (byte) (i11 >> 8); > buf[54 + off] = (byte) i11; > buf[56 + off] = (byte) (i12 >> 8); > buf[58 + off] = (byte) i12; > buf[60 + off] = (byte) (i13 >> 8); > buf[62 + off] = (byte) i13; > buf[64 + off] = (byte) (i14 >> 8); > buf[66 + off] = (byte) i14; > buf[68 + off] = (byte) (i15 >> 8); > buf[70 + off] = (byte) i15; > > return new String(buf, UTF16); > }
We should avoid extra indentation when possible. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1238503236