On Thu, 2 Nov 2023 14:25:20 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
>> Enhance `java.math.BigInteger` constructors taking a `byte[]` argument by >> improving guarantees of internal invariants. > > Raffaello Giulietti has updated the pull request incrementally with one > additional commit since the last revision: > > Restored ordering of exceptions. src/java.base/share/classes/java/math/BigInteger.java line 344: > 342: * @param len the number of bytes to use. > 343: * @throws NumberFormatException {@code val} is zero bytes long, > 344: * or {@code len} is zero. I would be concerned about the compatibility impact on existing applications. Though (very) uncommon, an existing application be using a non-zero length array and a len of zero to represent zero. With this change it will throw an unexpected exception. src/java.base/share/classes/java/math/BigInteger.java line 4707: > 4705: ++from; > 4706: /* Skip leading -1 bytes. */ > 4707: for (; b == -1 && from < to; b = a[from++]); //empty body The style for an empty body in this file seems to be a ";" on a line by itself. The comment make it explicit but visually it might stand out more on a separate line. (My preferred style is `{}` with enough visual space to make it stand out.) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16449#discussion_r1380843814 PR Review Comment: https://git.openjdk.org/jdk/pull/16449#discussion_r1380839094