Review request: JDK-8157246 MHs.arrayLength, arrayElementGetter/Setter, arrayConstructor need to specify invocation-time behavior

mandy chung mandy.chung at
Wed Nov 8 23:52:13 UTC 2017

Hi Roger,

Updated version:

On 11/8/17 11:37 AM, Roger Riggs wrote:
> Hi Mandy,
> A few editorial suggestions:
> 891: "accepts**a** zero-length trailing array argument

> 895: "if **the* *{@code array} does"

{@code array} is referred to the parameter name where I don't use 
article.  I drop the {@code...} and change it to "If the array".

> 667:  hard to follow indentation; perhaps adding the "else" will help.

I revised it to the following:

         if (av == null && n == 0) {
         } else if (av == null) {
             throw new NullPointerException("null array reference");

> 2517: "Produces a method handle *for* constructing arrays..."

It reads fine without "for" and the other arrayXXX factory methods are 
similar.  I leave it for the original author to follow up.

> 2523: "array size, *a* {@code NegativeArraySizeException} will be 
> thrown."
> 2550: "array reference, *a* {@code NullPointerPointer} exception will 
> be thrown."
> 2573 & 2598 & 2641: "*A* {@code NullPointerPointer} *exception* will 
> be thrown if the array reference
> Is there a test for asSpreader(null, 0) and asSpreader(null, 1)? (The 
> new exception thrown at MethodHandleImpl:667)

The new exception is thrown when the MethodHandle returned by 
MethodHandle::asSpreader.  The test cases are covered by the new 
InvokeMethodHandleWithBadArgument test.

asSpreader(null, 0) and asSpreader(null, 1) are not related to this 
issue.  The check is done by MethodHandle::asSpreaderChecks. Since this 
gets my attention, I add the test cases in an existing test


More information about the core-libs-dev mailing list