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

Further notes on `size()`. See this comment in 
[JDK-4213570](https://bugs.openjdk.org/browse/JDK-4213570?focusedCommentId=12238736&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12238736).
 The size() method was introduced with BitSet itself in JDK 1.0. It was 
probably an error, as in those days people might not have understood the 
importance of APIs separate from implementation. In addition, as noted 
previously, size() has a bunch of bugs. The comment suggests that the length() 
method was introduced as a replacement for size(). The length() method has its 
own bugs, but it's clearly an attempt to provide a better abstraction than 
size(). Also note that the specification for length() describes it as the 
"logical size."

Maybe this means that size() should be deprecated. At least, it might mean that 
we have more of a free hand to remove some of its obvious misbehavior, such as 
what's described in 
[JDK-8230557](https://bugs.openjdk.org/browse/JDK-8230557?focusedCommentId=14573956&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14573956).

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

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

Reply via email to