-
Bug
-
Resolution: Fixed
-
P2
-
9
-
b143
-
Verified
Please, observe MethodHandles.iteratedLoop(...) constraints for iterator, init and body.
According to these constraints, three MethodHandle with following signatures should be accepted in abovementioned method :
iterator=()Iterator
init=()I
body=(I,Object,I)I
Let's look on their types. First I is locals state, Object is T, and second I is single loop argument. Init's parameter list should be effectively identical to loop parameter list (it is 'I'). The same requirements for iterator handle. However, following exception occurs:
>> Exception in thread "main" java.lang.IllegalArgumentException: inferred first loop argument must be an array or inherit from Iterable: int
Observing last constraint you can find constraint (first argument must be Iterable or array) in the case iterator=null. Here iterator is not null, so it is inapplicable.
You can find complete code in Example0.java
Was found on jdk9b140
According to these constraints, three MethodHandle with following signatures should be accepted in abovementioned method :
iterator=()Iterator
init=()I
body=(I,Object,I)I
Let's look on their types. First I is locals state, Object is T, and second I is single loop argument. Init's parameter list should be effectively identical to loop parameter list (it is 'I'). The same requirements for iterator handle. However, following exception occurs:
>> Exception in thread "main" java.lang.IllegalArgumentException: inferred first loop argument must be an array or inherit from Iterable: int
Observing last constraint you can find constraint (first argument must be Iterable or array) in the case iterator=null. Here iterator is not null, so it is inapplicable.
You can find complete code in Example0.java
Was found on jdk9b140
- relates to
-
JDK-8151179 address issues raised by JCK team on JEP 274 API
-
- Closed
-