RFR: 8305734: BitSet.get(int, int) always returns the empty BitSet when the Integer.MAX VALUE is set

Stuart Marks smarks at openjdk.org
Mon Apr 17 17:28:35 UTC 2023


On Fri, 7 Apr 2023 12:22:03 GMT, Andy-Tatman <duke at openjdk.org> wrote:

> See https://bugs.java.com/bugdatabase/view_bug?bug_id=8305734

The workaround mentioned in JDK-8230557 applies to `size()` and not `length()`. (But `length()` probably has similar behavior to `size()`.) Moreover, this is only a workaround, not an "accepted workaround" that code should be relying upon.

As @AlanBateman said, we probably need to revisit the specs and behaviors comprehensively at some point. This is mostly around behavior and handling of setting and getting the `Integer.MAX_VALUE` bit.

That said, it's probably possible to improve the behavior of `get(int, int)` by writing a new, internal method that inspects the object's state properly and acts on it, instead of relying on the current, bogus behavior of a public method.

There should also be a regression test for such a change.

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

PR Comment: https://git.openjdk.org/jdk/pull/13388#issuecomment-1511782837


More information about the core-libs-dev mailing list