-
Sub-task
-
Resolution: Fixed
-
P3
-
None
-
9
-
None
According to documentation,
The implementation of this method is equivalent to:
MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
MethodHandle returnVar = dropArguments(identity(init.type().returnType()), 0, int.class, int.class);
// assume MH_increment and MH_lessThan are handles to x+1 and x<y of type int
MethodHandle[]
indexVar = {start, MH_increment}, // i = start; i = i+1
loopLimit = {end, null, MH_lessThan, returnVar }, // i<end
bodyClause = {init, dropArguments(body, 1, int.class)}; // v = body(i, v);
return loop(indexVar, loopLimit, bodyClause);
}
Please, observe attached example. In this example handles for 'x+1' and 'x+y' was created as f(x) and f(x,y). In the case of 'prohibited' functions combination, they throws IAE. But these exceptions have slightly different messages:
found non-effectively identical parameter type lists:
step: [MethodHandle(int,int)int, null, MethodHandle(Lambdaman,int,int)String]
pred: [null, MethodHandle(int,int)boolean, null]
fini: [null, MethodHandle(int,int,String)String, null] (common parameter sequence: [int, int, class java.lang.String, class java.lang.String])
and
found non-effectively identical parameter type lists:
step: [MethodHandle(int)int, null, MethodHandle(Lambdaman,int,int)String]
pred: [null, MethodHandle(int,int)boolean, null]
The difference is in the first argument list of 'step'.
Current jdk9 implementation reference to 'x+1' is f(x,limit)=x+1. It seems this is the origin of difference.
So, 'implementation requirements' code is not equals to jdk9 implementation.
Was found on jdk9b108, jdk9b109, jdk9b110.
Test development in progress, tck_red will be added after test development is completed.
Example is in attachment.
The implementation of this method is equivalent to:
MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
MethodHandle returnVar = dropArguments(identity(init.type().returnType()), 0, int.class, int.class);
// assume MH_increment and MH_lessThan are handles to x+1 and x<y of type int
MethodHandle[]
indexVar = {start, MH_increment}, // i = start; i = i+1
loopLimit = {end, null, MH_lessThan, returnVar }, // i<end
bodyClause = {init, dropArguments(body, 1, int.class)}; // v = body(i, v);
return loop(indexVar, loopLimit, bodyClause);
}
Please, observe attached example. In this example handles for 'x+1' and 'x+y' was created as f(x) and f(x,y). In the case of 'prohibited' functions combination, they throws IAE. But these exceptions have slightly different messages:
found non-effectively identical parameter type lists:
step: [MethodHandle(int,int)int, null, MethodHandle(Lambdaman,int,int)String]
pred: [null, MethodHandle(int,int)boolean, null]
fini: [null, MethodHandle(int,int,String)String, null] (common parameter sequence: [int, int, class java.lang.String, class java.lang.String])
and
found non-effectively identical parameter type lists:
step: [MethodHandle(int)int, null, MethodHandle(Lambdaman,int,int)String]
pred: [null, MethodHandle(int,int)boolean, null]
The difference is in the first argument list of 'step'.
Current jdk9 implementation reference to 'x+1' is f(x,limit)=x+1. It seems this is the origin of difference.
So, 'implementation requirements' code is not equals to jdk9 implementation.
Was found on jdk9b108, jdk9b109, jdk9b110.
Test development in progress, tck_red will be added after test development is completed.
Example is in attachment.