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

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

The `size()` call is rather odd, as it's mainly about the implementation and is 
not considered part of the actual value of the BitSet. I note that `equals()` 
is specified not to include the size.  BitSet is a very old API, dating back to 
1.0, so perhaps it was felt that implementation-level information would be 
important to users, or perhaps the notion of keeping implementation details out 
of the APIs hadn't been fully developed yet. (There are other 1.0-era APIs that 
have similar characteristics.) Note that the specs do say that the size can 
change with the implementation, so there's some flexibility here. That said, 
it's not clear to me how a user of BitSet can actually use `size()` effectively.

A comprehensive fix to the BitSet implementation and specs should probably 
address the proper return value of `size()`, but I think it can considered 
somewhat independently of other methods, which have thorny semantic issues 
regarding what happens at MAX_VALUE.

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

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

Reply via email to