JDK-4816253 : (spec) BitSet.nextClearBit missing spec for case when index is outside int range
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.2.1,1.4.1
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_7,windows_xp
  • CPU: x86,sparc
  • Submitted: 2003-02-10
  • Updated: 2014-04-17
Related Reports
Relates :  
Description

Name: rmT116609			Date: 02/10/2003


DESCRIPTION OF THE PROBLEM :
The java doc for java.util.BitSet's nextClearBit doesn't include the case where there is no nextClearBit.  Recall that in Java, int's are finite.  Presumably, the behavior is like nextSetBit and returns -1 in that case.

This bug was found in writing a JML specification for the method.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Open your browser on the javadoc for java.util.BitSet
2. Look at the nextClearBit method's description.
3. Compare to the description for nextSetBit.

REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 181012) 
======================================================================

Comments
EVALUATION Conceptually nextClearBit is somewhat different than nextSetBit, in that there is always a nextClearBit but there is not always a nextSetBit. However, the spec should be clear on what happens when the nextClearBit is at an index out of the range of an int's representable values. ###@###.### 2003-02-20 This appears to be an issue only the bitset contains a set bit at Integer.MAX_VALUE. Don't do that. That would be terribly inefficient anyways, so it's probably not a real-world usage problem. This is really really obscure; probably not worth fixing. ###@###.### 2005-2-09 20:30:45 GMT
09-02-2005