RFR 8167974 MethodHandles.iteratedLoop(...) fails with CCE in the case of iterating over array
paul.sandoz at oracle.com
Mon Oct 31 21:47:06 UTC 2016
And… 8167966 MethodHandles.iteratedLoop fails with IAE in the case of correct arguments.
The two issues are closely intertwined in terms of the fix. Please review:
This is cleaning up previous specification and implementation assumptions when a null iterator method handle is passed to MethodHandles.iteratedLoop.
The specification states that an Iterator type *or* array type is supported. Originally I think the intention was to support the equivalent of Java for-each loops, but the implementation only supports Iterator. We can revisit this in the next release if necessary.
The implementation checking the constraints on the iterator loop method handles required some reorgnaization to clearly differentiate the checks performed if the iterator method handle is non-null or null, since it currently does not fully differentiate between the two cases leading to incorrect exceptions when the handle is non-null.
More information about the core-libs-dev