Using unsigned library work in the JDK

Joseph Darcy joe.darcy at oracle.com
Thu Jan 26 21:37:57 UTC 2012


Hello,

On 1/26/2012 9:13 AM, Ulf Zibis wrote:
> Am 26.01.2012 17:11, schrieb Roger Riggs:
>

[snip]

>
>> Its unfortunate that between the method name and need to qualify
>> with the class (or use static imports) that the code is longer and 
>> not always clearer.
> +1
> - static import could become ambiguous using Byte.toUnsignedInt() + 
> Short.toUnsignedInt() at same time.
> + The shortest I can think:
> Short.unsigned(byte)
> Integer.unsigned(short)
> Long.unsigned(int)
> BigInteger.unsigned(long)
> + Nothing would be ambiguous, using static import.

That style of design was considered for

4504839 Java libraries should provide support for unsigned integer 
arithmetic

However, at least for now, we choose the other approach.

-Joe



More information about the core-libs-dev mailing list