[9, 8u40] RFR (XXS): 8066746: MHs.explicitCastArguments does incorrect type checks for VarargsCollector

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Mon Dec 8 23:47:34 UTC 2014


Recent changes (8057656 [1]) broke MHs.explicitCastArguments for 
VarargsCollector case. It introduced an equivalence check between 
MHs.explicitCastArguments and MethodHandle.asType() which doesn't work 
for VarargsCollector case as expected.

VarargsCollector has special asType() implementation, which supports 
collecting any number of trailing positional arguments into an array 
argument. It doesn't play well with MHs.explicitCastArguments, because 
the latter is meant to be a pairwise argument and return type conversion.

The fix is to ensure that adapted method handle has fixed arity.

Testing: regression test, jck (api/java_lang/invoke), jdk/java/lang/invoke


Best regards,
Vladimir Ivanov

[1] https://bugs.openjdk.java.net/browse/JDK-8057656

More information about the core-libs-dev mailing list