--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Wed Jul 05 18:20:00 2017 +0200
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Fri Aug 17 13:42:25 2012 -0700
@@ -1876,6 +1876,17 @@
return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
}
+ // FIXME: Make this public in M1.
+ /*non-public*/ static
+ MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle collector) {
+ MethodType targetType = target.type();
+ MethodType filterType = collector.type();
+ if (filterType.returnType() != void.class &&
+ filterType.returnType() != targetType.parameterType(pos))
+ throw newIllegalArgumentException("target and filter types do not match", targetType, filterType);
+ return MethodHandleImpl.makeCollectArguments(target, collector, pos, false);
+ }
+
/**
* Adapts a target method handle by post-processing
* its return value (if any) with a filter (another method handle).