RFR 8154556: Use java.nio.ByteOrder instead of boolean value

Alan Bateman Alan.Bateman at oracle.com
Thu Apr 21 14:43:54 UTC 2016



On 21/04/2016 15:34, Paul Sandoz wrote:
> Hi
>
> Please review:
>
>    http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8154556-vh-nio-byteorder/webrev/ <http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8154556-vh-nio-byteorder/webrev/>
>
> This is a small tweak to the VarHandle API. The array and ByteBuffer related factory methods on MethodhHandles now accept a java.no.ByteOrder rather than a boolean value.
>
> Use of java.no.ByteOrder is considered more readable in code that a boolean value, for express big, little or native endianness.
>
The switch the ByteOrder looks okay, just wondering if have to check for 
null and then adjust @throws NPE in the javadoc too.

BTW: Is there a reason for "throws IllegalArgumentException"? This an 
unchecked so I assume not needed there (the @throws in the javadoc 
should be sufficient).

-Alan.



More information about the core-libs-dev mailing list