Re: Reply: what to do next to fix JDK-8230557. thanks

2019-09-05 Thread Ivan Gerasimov

Hi Peter!

On 9/5/19 7:24 AM, Peter Levart wrote:

Hi Ivan,

On 9/5/19 11:22 AM, Ivan Gerasimov wrote:

Hello!

BitSet is known to be flawed in many ways:?0?2 its size(), length(), 
cardinality() and nextClearBit?6?7() can return meaningless negative 
values.


I was thinking about disallowing setting any index greater than 
(Integer.MAX_VALUE - 63), for example by throwing OutOfMemoryError.


An index of Integer.MAX_VALUE - 64 would be the greatest index then, 
an index of Integer.MAX_VALUE - 63 already needs an array of longs of 
length 2^25 which results in BitSet size() of 2^31 ...




We could do it without changing the specification.


The calls to: new BitSet(Integer.MAX_VALUE - 63) ... new 
BitSet(Integer.MAX_VALUE) would also have to throw then.
BitSet.valueOf(...) methods don't even check the passed in arguments 
lengths, so size() can really return a meaningless negative or 
positive number. They all would have to throw if the passed-in length 
of array/buffer is too large.


So would you not specify when those methods throw?

Yes.?0?2 My point was that any method that requires memory allocation 
should be expected to possibly throw OOM, so we don't have to specify it 
explicitly.


A similar thing happened with compact Strings, for example.?0?2 When the 
internal storage was changed to byte[] array, all of a sudden, it became 
impossible to create UTF16 Strings (or StringBuilders) of length > 
(Integer.MAX_VALUE / 2).


W.r.t. BitSet, personally, I would rather not fix its current behavior 
unless there is a very strong demand for the change.


Just wanted to mention one approach, which would limit usage of this 
class to the boundaries it was originally designed for.


With kind regards,

Ivan



Regards, Peter



With kind regards,

Ivan


On 9/5/19 1:16 AM,  wrote:

Hi, Peter.


I understand your point, but I think it's unreasonable for the 
reason that source code compatibility problem, it's really a bug.



User can't understand why the size method return a negative number.



 


Best, lamber-ken




--  --
??: "Peter Levart"??: ""<2217232...@qq.com>;"core-libs-dev"

: "David Holmes"indexes is: 0 ... 2^31 - 1 (0 ... Integer.MAX_VALUE). The maximum 
"size"

of BitSet is therefore 2^31. Unfortunately, this value can't be
"corectly" represented with signed 32 bit integer (int). Only in this
corner case, - 2^31 (Integer.MIN_VALUE) is the interpreted value
returned from size(). If one would interpret it as unsigned 32 bit
integer value, it is entirely correct. For example, this holds:

Integer.toUnsignedLong(new BitSet(Integer.MAX_VALUE).size()) == 1L 
<< 31


It is also always true what javadoc says about size(): "The maximum
element in the set is the size - 1st element"

The following holds also for this corner case:

new BitSet(Integer.MAX_VALUE).size() - 1 == Integer.MAX_VALUE;

So perhaps, the fix could be just to describe this corner case in the
spec. And perhaps, to support the following use case in the corner 
case:


BitSet set1 = ...
...

BitSet set2 = new BitSet(set1.size());

... by modifying the BitSet constructor to accept the Integer.MIN_VALUE
in addition to all the non-negative values as the 'nbits' parameter.

What do you think?

Regards, Peter

On 9/5/19 8:31 AM, David Holmes wrote:
> Hi,
>
> On 5/09/2019 4:11 pm,  wrote:
>>
>> Thanks very much.
>>
>> *BUG-LINK:* https://bugs.openjdk.java.net/browse/JDK-8230557
>>
>> *Describe: *
>> the return type of the method BitSet#size is int, so the 
method may

>> return a negative value in some case, for example, will return
>> -2147483648.
>> ```
>> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>>  bitSet.set(i);
>> }
>> System.out.println(bitSet.size());
>> ```
>> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>>
>> *FIX*
>> I have put the patch in the attachment of the mail.
>
> In case the attachment got stripped form the mailing list the 
proposed

> fix is:
>
> -    public int size() {
> -    return words.length 
* BITS_PER_WORD;

> +    public long size() {
> +    return (long) 
words.length * BITS_PER_WORD;

>
> Unfortunately this simple fix it not possible. You can't just 
change
> the return type of the method to long as that is a 
source-incompatible
> change and would not be approved [1]. Instead the return value 
should
> be capped at Integer.MAX_VALUE - but I'll leave that for 
someone from

> core-libs team to pick up. Also look at the evaluation in:
>
> https://bugs.openjdk.java.net/browse/JDK-4213570
>
> Cheers,
> David
>
> [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>
>
>
>>
>> --  --
>> *??:* "David Holmes">> 
*??:* ""<2217232...@qq.com>;"core-libs-dev"
>> d...@openjdk.java.net>;
>> *:* Re: ?? what to do next to fix JDK-8230557. 
thanks

>>
>> On 5/09/2019 3:46 pm,  wrote:
>>  >
>>  > hi, de

Reply: what to do next to fix JDK-8230557. thanks

2019-09-05 Thread 未来阳光
Hi, can we make `size()` and `length()` as deprecated, then write new methods ?


Best.


-- 原始邮件 --
发件人: "Peter Levart"https://bugs.openjdk.java.net/browse/JDK-8230557
>> >>
>> >> *Describe: *
>> >> the return type of the method BitSet#size is int, so 
the 
>> method may
>> >> return a negative value in some case, for example, 
will return
>> >> -2147483648.
>> >> ```
>> >> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> >> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>> >> 
     bitSet.set(i);
>> >> }
>> >> System.out.println(bitSet.size());
>> >> ```
>> >> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>> >>
>> >> *FIX*
>> >> I have put the patch in the attachment of the mail.
>> >
>> > In case the attachment got stripped form the mailing list the 
>> proposed
>> > fix is:
>> >
>> > -    public int size() {
>> > 
-        return 
words.length 
>> * BITS_PER_WORD;
>> > +    public long size() {
>> > 
+        return 
(long) 
>> words.length * BITS_PER_WORD;
>> >
>> > Unfortunately this simple fix it not possible. You can't just 
>> change
>> > the return type of the method to long as that is a 
>> source-incompatible
>> > change and would not be approved [1]. Instead the return 
value 
>> should
>> > be capped at Integer.MAX_VALUE - but I'll leave that for 
someone 
>> from
>> > core-libs team to pick up. Also look at the evaluation in:
>> >
>> > https://bugs.openjdk.java.net/browse/JDK-4213570
>> >
>> > Cheers,
>> > David
>> >
>> > [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>> >
>> >
>> >
>> >>
>> >> 
-- 原始邮件 --
>> >> *发件人:* "David 
Holmes"http://openjdk.java.net/contribute/
>> >>  >
>> >>  > and you would seem to be up to 
step 2. :)
>> >>  >
>> >>  > Cheers,
>> >>  > David
>> >>  >
>> >>  >  >
>> >>  >  >
>> >>  >  >
>> >>  >  >
>> >>  >  > 
>> [1]https://bugs.openjdk.java.net/browse/JDK-8230557
>> >>  >  >
>> >>  >  > 
[2]http://openjdk.java.net/contribute/
>> >>  >  > 
>> [3]https://www.oracle.com/technetwork/community/oca-486395.html
>> >>  >  >
>> >>  >  >
>> >>  >  >
>> >>  >  >
>> >>  >  >
>> >>  >  > 
>> --&nbsp;原始邮件&nbsp;--
>> >>  >  > 
发件人:&nbsp;"Bug Report
>> >>  > 
>> Notification"

Re: Reply: what to do next to fix JDK-8230557. thanks

2019-09-05 Thread Peter Levart

Hi Ivan,

On 9/5/19 11:22 AM, Ivan Gerasimov wrote:

Hello!

BitSet is known to be flawed in many ways:?0?2 its size(), length(), 
cardinality() and nextClearBit?6?7() can return meaningless negative values.


I was thinking about disallowing setting any index greater than 
(Integer.MAX_VALUE - 63), for example by throwing OutOfMemoryError.


An index of Integer.MAX_VALUE - 64 would be the greatest index then, an 
index of Integer.MAX_VALUE - 63 already needs an array of longs of 
length 2^25 which results in BitSet size() of 2^31 ...




We could do it without changing the specification.


The calls to: new BitSet(Integer.MAX_VALUE - 63) ... new 
BitSet(Integer.MAX_VALUE) would also have to throw then.
BitSet.valueOf(...) methods don't even check the passed in arguments 
lengths, so size() can really return a meaningless negative or positive 
number. They all would have to throw if the passed-in length of 
array/buffer is too large.


So would you not specify when those methods throw?

Regards, Peter



With kind regards,

Ivan


On 9/5/19 1:16 AM,  wrote:

Hi, Peter.


I understand your point, but I think it's unreasonable for the reason 
that source code compatibility problem, it's really a bug.



User can't understand why the size method return a negative number.



 


Best, lamber-ken




--  --
??: "Peter Levart"??: ""<2217232...@qq.com>;"core-libs-dev"

: "David Holmes"https://bugs.openjdk.java.net/browse/JDK-8230557
>>
>> *Describe: *
>> the return type of the method BitSet#size is int, so the 
method may

>> return a negative value in some case, for example, will return
>> -2147483648.
>> ```
>> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>>  bitSet.set(i);
>> }
>> System.out.println(bitSet.size());
>> ```
>> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>>
>> *FIX*
>> I have put the patch in the attachment of the mail.
>
> In case the attachment got stripped form the mailing list the 
proposed

> fix is:
>
> -    public int size() {
> -    return words.length 
* BITS_PER_WORD;

> +    public long size() {
> +    return (long) 
words.length * BITS_PER_WORD;

>
> Unfortunately this simple fix it not possible. You can't just 
change
> the return type of the method to long as that is a 
source-incompatible
> change and would not be approved [1]. Instead the return value 
should
> be capped at Integer.MAX_VALUE - but I'll leave that for someone 
from

> core-libs team to pick up. Also look at the evaluation in:
>
> https://bugs.openjdk.java.net/browse/JDK-4213570
>
> Cheers,
> David
>
> [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>
>
>
>>
>> --  --
>> *??:* "David Holmes">> 
*??:* ""<2217232...@qq.com>;"core-libs-dev"
>> d...@openjdk.java.net>;
>> *:* Re: ?? what to do next to fix JDK-8230557. 
thanks

>>
>> On 5/09/2019 3:46 pm,  wrote:
>>  >
>>  > hi, developers.
>>  >
>>  > Can someone help me? thanks very much !!
>>
>> Help you how exactly. As I stated your are up to step 2 of 
the how to
>> contribute process. If you have a suggested fix for the bug 
then put

>> that in an email as described.
>>
>> Thanks,
>> David
>>
>>  >
>>  > 
--  --
>>  > *??:* "David 
Holmes"
>>  > *:* 2019??9??5??(??) 1:44
>>  > 
*??:* ""<2217232...@qq.com>;"core-libs-dev"
>>  > d...@openjdk.java.net>;
>>  > *:* Re: what to do next to fix 
JDK-8230557. thanks

>>  >
>>  > On 5/09/2019 3:35 pm,  wrote:
>>  >  > Hi, leaders.
>>  >
>>  > Hi,
>>  >
>>  > No "leaders" here only developers :)
>>  >
>>  >  >
>>  >  > A few days ago, I report a bug in core 
lib[1]. According to the
>>  > contribute document[2], I had send oca to oracle 
and my name has

>>  > been listed on oca[3].
>>  >
>>  > Welcome aboard!
>>  >
>>  >  > But I still can't push my changes to 
jdk, can someone tell me

>> how to
>>  > do next? thanks very match!!
>>  >
>>  > You can't push anything until you become a 
Committer and before

>> that you
>>  > have to become an Author. The steps for 
contributing are outlined

>> here:
>>  >
>>  > http://openjdk.java.net/contribute/
>>  >
>>  > and you would seem to be up to step 2. :)
>>  >
>>  > Cheers,
>>  > David
>>  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
[1]https://bugs.openjdk.java.net/browse/JDK-8230557

>>  >  >
>>  >  > [2]http://openjdk.java.net/contribute/
>>  >  > 
[3]https://www.oracle.com/technetwork/community/oca-486395.html

>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
--  --

>>  >  > ??: "Bug Report
>>  > 
Notification">>  >  > : 2019??9??5??(??) 
3:33
>>  >  > 
??: ""<2217232...@qq.com>;

>>  >  >
>>  >  > : Update Notification: Bug 
Report  - JDK-8230557


Re: Reply: what to do next to fix JDK-8230557. thanks

2019-09-05 Thread Peter Levart

Hi ,

On 9/5/19 10:16 AM,  wrote:


Hi, Peter.

I understand your point, but I think it's unreasonable for the reason 
that source code compatibility problem, it's really a bug.


Unfortunately, when such bug is out in the wild for so long, it becomes 
a feature. It would be unreasonable to fix it the way you propose now, 
because all programs that use BitSet.size() method would break by such 
fix. It is not only source incompatible fix, but binary incompatible too.




User can't understand why the size method return a negative number.


Perhaps, if the javadoc of the method described this corner case, he/she 
would understand?


Regards, Peter




Best, lamber-ken


--?0?2?0?2--
*??:*?0?2"Peter Levart";
*:*?0?22019??9??5??(??) 3:51
*??:*?0?2""<2217232...@qq.com>;"core-libs-dev";
*:*?0?2"David Holmes";
*:*?0?2Re: ?? ?? what to do next to fix JDK-8230557. thanks

Hi ,

As David has pointed out, your proposed fix would break binary and
source compatibility of BitSet.size() method, so it is not acceptable.

BitSet API allows addressing individual bits using non-negative 'int'
typed indexes (analogous to indexes of Java arrays). The range of
indexes is: 0 ... 2^31 - 1 (0 ... Integer.MAX_VALUE). The maximum "size"
of BitSet is therefore 2^31. Unfortunately, this value can't be
"corectly" represented with signed 32 bit integer (int). Only in this
corner case, - 2^31 (Integer.MIN_VALUE) is the interpreted value
returned from size(). If one would interpret it as unsigned 32 bit
integer value, it is entirely correct. For example, this holds:

Integer.toUnsignedLong(new BitSet(Integer.MAX_VALUE).size()) == 1L << 31

It is also always true what javadoc says about size(): "The maximum
element in the set is the size - 1st element"

The following holds also for this corner case:

new BitSet(Integer.MAX_VALUE).size() - 1 == Integer.MAX_VALUE;

So perhaps, the fix could be just to describe this corner case in the
spec. And perhaps, to support the following use case in the corner case:

BitSet set1 = ...
...

BitSet set2 = new BitSet(set1.size());

... by modifying the BitSet constructor to accept the Integer.MIN_VALUE
in addition to all the non-negative values as the 'nbits' parameter.

What do you think?

Regards, Peter

On 9/5/19 8:31 AM, David Holmes wrote:
> Hi,
>
> On 5/09/2019 4:11 pm,  wrote:
>>
>> Thanks very much.
>>
>> *BUG-LINK:* https://bugs.openjdk.java.net/browse/JDK-8230557
>>
>> *Describe: *
>> the return type of the method BitSet#size is int, so the method may
>> return a negative value in some case, for example, will return
>> -2147483648.
>> ```
>> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>> ?0?2?0?2?0?2?0?2?0?2bitSet.set(i);
>> }
>> System.out.println(bitSet.size());
>> ```
>> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>>
>> *FIX*
>> I have put the patch in the attachment of the mail.
>
> In case the attachment got stripped form the mailing list the proposed
> fix is:
>
> -?0?2?0?2?0?2 public int size() {
> -?0?2?0?2?0?2?0?2?0?2?0?2?0?2 return words.length * BITS_PER_WORD;
> +?0?2?0?2?0?2 public long size() {
> +?0?2?0?2?0?2?0?2?0?2?0?2?0?2 return (long) words.length * BITS_PER_WORD;
>
> Unfortunately this simple fix it not possible. You can't just change
> the return type of the method to long as that is a source-incompatible
> change and would not be approved [1]. Instead the return value should
> be capped at Integer.MAX_VALUE - but I'll leave that for someone from
> core-libs team to pick up. Also look at the evaluation in:
>
> https://bugs.openjdk.java.net/browse/JDK-4213570
>
> Cheers,
> David
>
> [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>
>
>
>>
>> --?0?2?0?2--
>> *??:*?0?2"David Holmes";
>> *:*?0?22019??9??5??(??) 2:00
>> *??:*?0?2""<2217232...@qq.com>;"core-libs-dev"> d...@openjdk.java.net>;
>> *:*?0?2Re: ?? what to do next to fix JDK-8230557. thanks
>>
>> On 5/09/2019 3:46 pm,  wrote:
>> ?0?2>
>> ?0?2> hi, developers.
>> ?0?2>
>> ?0?2> Can someone help me? thanks very much !!
>>
>> Help you how exactly. As I stated your are up to step 2 of the how to
>> contribute process. If you have a suggested fix for the bug then put
>> that in an email as described.
>>
>> Thanks,
>> David
>>
>> ?0?2>
>> ?0?2> --?0?2?0?2--
>> ?0?2> *??:*?0?2"David Holmes";
>> ?0?2> *:*?0?22019??9??5??(??) 1:44
>> ?0?2> *??:*?0?2""<2217232...@qq.com>;"core-libs-dev"> ?0?2> d...@openjdk.java.net>;
>> ?0?2> *:*?0?2Re: what to do next to fix JDK-8230557. thanks
>> ?0?2>
>> ?0?2> On 5/09/2019 3:35 pm,  wrote:
>> ?0?2>?0?2 > Hi, leaders.
>> ?0?2>
>> ?0?2> Hi,
>> ?0?2>
>> ?0?2> No "leaders" here only developers :)
>> ?0?2>
>> ?0?2>?0?2 >
>> ?0?2>?0?2 > A few day

Re: Reply: what to do next to fix JDK-8230557. thanks

2019-09-05 Thread Ivan Gerasimov

Hello!

BitSet is known to be flawed in many ways:?0?2 its size(), length(), 
cardinality() and nextClearBit?6?7() can return meaningless negative values.


I was thinking about disallowing setting any index greater than 
(Integer.MAX_VALUE - 63), for example by throwing OutOfMemoryError.


We could do it without changing the specification.

With kind regards,

Ivan


On 9/5/19 1:16 AM,  wrote:

Hi, Peter.


I understand your point, but I think it's unreasonable for the reason that 
source code compatibility problem, it's really a bug.


User can't understand why the size method return a negative number.



 


Best, lamber-ken




--  --
??: "Peter Levart"https://bugs.openjdk.java.net/browse/JDK-8230557
>>
>> *Describe: *
>> the return type of the method BitSet#size is int, so the method may
>> return a negative value in some case, for example, will return
>> -2147483648.
>> ```
>> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>>  bitSet.set(i);
>> }
>> System.out.println(bitSet.size());
>> ```
>> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>>
>> *FIX*
>> I have put the patch in the attachment of the mail.
>
> In case the attachment got stripped form the mailing list the proposed
> fix is:
>
> -    public int size() {
> -    return words.length * 
BITS_PER_WORD;
> +    public long size() {
> +    return (long) words.length * 
BITS_PER_WORD;
>
> Unfortunately this simple fix it not possible. You can't just change
> the return type of the method to long as that is a source-incompatible
> change and would not be approved [1]. Instead the return value should
> be capped at Integer.MAX_VALUE - but I'll leave that for someone from
> core-libs team to pick up. Also look at the evaluation in:
>
> https://bugs.openjdk.java.net/browse/JDK-4213570
>
> Cheers,
> David
>
> [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>
>
>
>>
>> --  --
>> *??:* "David Holmes"http://openjdk.java.net/contribute/
>>  >
>>  > and you would seem to be up to step 2. :)
>>  >
>>  > Cheers,
>>  > David
>>  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
[1]https://bugs.openjdk.java.net/browse/JDK-8230557
>>  >  >
>>  >  > [2]http://openjdk.java.net/contribute/
>>  >  > 
[3]https://www.oracle.com/technetwork/community/oca-486395.html
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
--  --
>>  >  > ??: "Bug Report
>>  > Notification"

--
With kind regards,
Ivan Gerasimov



Reply?? what to do next to fix JDK-8230557. thanks

2019-09-05 Thread ????????
Hi, Peter.


the length method return a negative number too



 


Best, lamber-ken




--  --
??: "Peter Levart"https://bugs.openjdk.java.net/browse/JDK-8230557
>>
>> *Describe: *
>> the return type of the method BitSet#size is int, so the method may 
>> return a negative value in some case, for example, will return 
>> -2147483648.
>> ```
>> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>>  bitSet.set(i);
>> }
>> System.out.println(bitSet.size());
>> ```
>> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>>
>> *FIX*
>> I have put the patch in the attachment of the mail.
>
> In case the attachment got stripped form the mailing list the proposed 
> fix is:
>
> -    public int size() {
> -    return words.length * BITS_PER_WORD;
> +    public long size() {
> +    return (long) words.length * 
BITS_PER_WORD;
>
> Unfortunately this simple fix it not possible. You can't just change 
> the return type of the method to long as that is a source-incompatible 
> change and would not be approved [1]. Instead the return value should 
> be capped at Integer.MAX_VALUE - but I'll leave that for someone from 
> core-libs team to pick up. Also look at the evaluation in:
>
> https://bugs.openjdk.java.net/browse/JDK-4213570
>
> Cheers,
> David
>
> [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>
>
>
>>
>> --  --
>> *??:* "David Holmes"http://openjdk.java.net/contribute/
>>  >
>>  > and you would seem to be up to step 2. :)
>>  >
>>  > Cheers,
>>  > David
>>  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
[1]https://bugs.openjdk.java.net/browse/JDK-8230557
>>  >  >
>>  >  > [2]http://openjdk.java.net/contribute/
>>  >  > 
[3]https://www.oracle.com/technetwork/community/oca-486395.html
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
--  --
>>  >  > ??: "Bug Report
>>  > Notification"

Reply?? what to do next to fix JDK-8230557. thanks

2019-09-05 Thread ????????
Hi, Peter.


I understand your point, but I think it's unreasonable for the reason that 
source code compatibility problem, it's really a bug.


User can't understand why the size method return a negative number.



 


Best, lamber-ken




--  --
??: "Peter Levart"https://bugs.openjdk.java.net/browse/JDK-8230557
>>
>> *Describe: *
>> the return type of the method BitSet#size is int, so the method may 
>> return a negative value in some case, for example, will return 
>> -2147483648.
>> ```
>> BitSet bitSet = new BitSet(Integer.MAX_VALUE);
>> for (int i = 0; i < Integer.MAX_VALUE - 1000; i++) {
>>  bitSet.set(i);
>> }
>> System.out.println(bitSet.size());
>> ```
>> EXPECTED: 2147483648, but ACTUAL: -2147483648.
>>
>> *FIX*
>> I have put the patch in the attachment of the mail.
>
> In case the attachment got stripped form the mailing list the proposed 
> fix is:
>
> -    public int size() {
> -    return words.length * 
BITS_PER_WORD;
> +    public long size() {
> +    return (long) words.length * 
BITS_PER_WORD;
>
> Unfortunately this simple fix it not possible. You can't just change 
> the return type of the method to long as that is a source-incompatible 
> change and would not be approved [1]. Instead the return value should 
> be capped at Integer.MAX_VALUE - but I'll leave that for someone from 
> core-libs team to pick up. Also look at the evaluation in:
>
> https://bugs.openjdk.java.net/browse/JDK-4213570
>
> Cheers,
> David
>
> [1] https://wiki.openjdk.java.net/display/csr/CSR+FAQs
>
>
>
>>
>> --  --
>> *??:* "David Holmes"http://openjdk.java.net/contribute/
>>  >
>>  > and you would seem to be up to step 2. :)
>>  >
>>  > Cheers,
>>  > David
>>  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
[1]https://bugs.openjdk.java.net/browse/JDK-8230557
>>  >  >
>>  >  > [2]http://openjdk.java.net/contribute/
>>  >  > 
[3]https://www.oracle.com/technetwork/community/oca-486395.html
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  >
>>  >  > 
--  --
>>  >  > ??: "Bug Report
>>  > Notification"