RFR: 8312019: Simplify and modernize java.util.BitSet.equals

Martin Buchholz martin at openjdk.org
Wed Jul 19 21:08:39 UTC 2023


On Thu, 13 Jul 2023 10:50:30 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> Please review this PR to use modern APIs and language features to simplify equals for BitSet. 
> 
> I couldn't see how to refactor hashCode using Arrays utility methods in a way that preserves its specification. So, aside from refactoring its doc comment and annotating it with `@Overrides`, I left it intact.

Performance of core classes is very important, - I am willing to have less elegant code with better performance.
Most users would also prefer faster code "for free".
I would prefer to comment out the checkInvariants() and to not introduce new checks.
I don't trust the VM to optimize away all the trivially true checks.

But I've seen other maintainers opt for elegant cleaner slower code instead, and I've tried not to complain!

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

PR Comment: https://git.openjdk.org/jdk/pull/14868#issuecomment-1642759544


More information about the core-libs-dev mailing list