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"<david.hol...@oracle.com>;
*发送时间:* 2019年9月5日(星期四) 下午2:00
*收件人:* "未来阳光"<2217232...@qq.com>;"core-libs-dev"<core-libs- 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"<david.hol...@oracle.com>;
 > *发送时间:* 2019年9月5日(星期四) 中午1:44
 > *收件人:* "未来阳光"<2217232...@qq.com>;"core-libs-dev"<core-libs-
 > 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&nbsp;my name has
 > been listed on&nbsp;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
 >  >
 >  >
 >  >
 >  >
 >  >
 >  > ------------------&nbsp;原始邮件&nbsp;------------------
 >  > 发件人:&nbsp;"Bug Report
 > Notification"<bug-report-daemon...@oracle.com&gt;;
 >  > 发送时间:&nbsp;2019年9月5日(星期四) 凌晨3:33
 >  > 收件人:&nbsp;"未来阳光"<2217232...@qq.com&gt;;
 >  >
 >  > 主题:&nbsp;Update Notification: Bug Report  - JDK-8230557
 >  >
 >  >
 >  >
 >  >
 >                            [This is an automated response. Please do not
 > reply.]
 >  > Dear Java Developer,
 >  > We have finished evaluating your report and have assigned it a Bug
 > ID: JDK-8230557. The issue is visible on bugs.java.com at the following
 > url JDK-8230557.
 >  >                   To provide more information about this issue,
 > click  here.
 >  >                  We work to resolve the issues that are submitted to
 > us according to their impact to the community as a whole, and make no
 > promises as to the time or release in which a bug might be fixed. If
 > this issue has a significant impact on your project you may want to
 > consider using one of the technical support offerings available at
 > Oracle Support.
 >  >                               Regards,
 >  >                                       Java Developer Support
 >  >
 >  >
 >  >
 >  >
 >  >
 >  > Java SE
 >  >                   Java SE Documentation
 >  >                   Java SE Downloads
 >  >                   Java Developer Forums
 >  >                   Oracle Java SE Advanced
 >  >                   Bug Database
 >  >
 >                                              Copyright © Oracle and/or
 > its affiliates. All rights reserved.
 >  >
 >                                    Terms of Use |                 Privacy
 >  >

Reply via email to