RFR: 8311170: Simplify and modernize equals and hashCode in security area [v4]

Pavel Rappo prappo at openjdk.org
Wed Jul 5 20:55:54 UTC 2023


On Wed, 5 Jul 2023 19:35:23 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/util/BitArray.java line 72:
>> 
>>> 70:      * specified byte array. The most significant bit of {@code a[0]} gets
>>> 71:      * index zero in the BitArray. The array must be large enough to specify
>>> 72:      * a value for every bit of the BitArray, i.e. {@code 8*a.length >= length}.
>> 
>> The original `<=` was correct, the number of bits in the input array must be less than the requested length of the BitArray.  The constructors also describe the length using `<=`; they all should be consistent.
>
> Are you sure? I just checked lines 91-92 and I'd say the change looks correct.

> The original `<=` was correct, the number of bits in the input array must be less than the requested length of the BitArray. The constructors also describe the length using `<=`; they all should be consistent.

Hm... My reading is that those "i.e." parts state preconditions for the constructors to return successfully, not preconditions for them to throw an exception.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14738#discussion_r1253635237


More information about the security-dev mailing list