Code Review Request, 8152237 Support BigInteger.TWO

Xuelei Fan xuelei.fan at oracle.com
Wed Mar 23 13:27:10 UTC 2016


Hi Attila,

Good catch about the comparing.  I updated the code in my local
workspace, and I would ask for code review in another enhancement update
soon.

Thanks,
Xuelei

On 3/23/2016 9:15 PM, Attila Szegedi wrote:
> Sorry for beating the dead horse of ObjectIdentifier.java change, but
> I’d suggest that if that code is later revisited, it be changed to
> "first.compareTo(BigInteger.TWO) > 0" instead of “… == 1”.
> 
> Comparing the return value of compareTo to zero (instead of relying on
> specific set of return values) is the “suggested idiom for performing
> these comparisons" as per BigInteger JavaDoc[1] and consistent with the
> contract of Comparable.compareTo (even though same BigInteger JavaDoc
> also explicitly specifies that the return values in this particular case
> are indeed -1, 0, and 1). 
> 
> Attila.
> 
> [1] http://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html#compareTo-java.math.BigInteger-
> 
>> On 23 Mar 2016, at 12:23, Xuelei Fan <xuelei.fan at oracle.com
>> <mailto:xuelei.fan at oracle.com>> wrote:
>>
>> On 3/23/2016 5:44 PM, Wang Weijun wrote:
>>> Then why not fix the 2 bugs in a single changeset?
>>>
>> Both need spec update approval.  As they are completely different spec
>> update, better to update in 2 enhancements.
>>
>> As you have concerns here, I removed ObjectIdentifier.java from this
>> update.  See the new webrev:
>>
>>   http://cr.openjdk.java.net/~xuelei/8152237/webrev.01/
>>
>> Xuelei
>>
>>> --Max
>>>
>>>> 在 2016年3月23日,17:06,Xuelei Fan <xuelei.fan at oracle.com
>>>> <mailto:xuelei.fan at oracle.com>> 写道:
>>>>
>>>>> On 3/23/2016 3:34 PM, Wang Weijun wrote:
>>>>>
>>>>>> On Mar 23, 2016, at 12:48 PM, Xuelei Fan <Xuelei.Fan at Oracle.COM
>>>>>> <mailto:Xuelei.Fan at oracle.com>> wrote:
>>>>>>
>>>>>> On 3/23/2016 12:10 PM, Wang Weijun wrote:
>>>>>>> Only 3 files touched. Are you going to make the
>>>>>>> s/BigInteger.valueOf(2)/BigInteger.TWO/ changes in other files
>>>>>>> with another bug fix?
>>>>>> There are also uses in security components.  I will make the
>>>>>> update in another bug.
>>>>>
>>>>> I see. But why is ObjectIdentifier.java included in this fix?
>>>> It happens that the other bug touch those files, but
>>>> ObjectIdentifier.java is not related to that bug.
>>>>
>>>> Does it make sense?
>>>>
>>>> Thanks,
>>>> Xuelei
>>>>
>>>>> In you only keep BigInteger and BigDecimal, then I have no other
>>>>> comment.
>>>>>
>>>>> Thanks
>>>>> Max
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>> Xuelei
>>>>>>
>>>>>>> Thanks
>>>>>>> Max
>>>>>>>
>>>>>>>> On Mar 23, 2016, at 11:26 AM, Xuelei Fan <xuelei.fan at oracle.com
>>>>>>>> <mailto:xuelei.fan at oracle.com>> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Please review the update for the supporting of BigInteger.TWO:
>>>>>>>>
>>>>>>>> http://cr.openjdk.java.net/~xuelei/8152237/webrev/
>>>>>>>>
>>>>>>>> BigInteger.valueOf(2) is a common BigInteger value used in
>>>>>>>> binary and cryptography operation calculation.  The
>>>>>>>> BigInteger.TWO is not exported, and hence BigInteger.valueOf(2)
>>>>>>>> is used instead in applications and JDK components.  The export
>>>>>>>> of static BigInteger.TWO can improve performance and simplify
>>>>>>>> existing code.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Xuelei
>>>>
>>>
>>
> 



More information about the security-dev mailing list