- 
    Enhancement 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    16
- 
    None
- 
        b23
                    Add a method to MethodHandles, like:
public static MethodHandle dropReturn(MethodHandle target)
That can be used to drop the return value of a MethodHandle.
Doing this is currently already possible with the following code:
MethodHandle target = ...;
Class<?> targetReturnType = target.type().returnType();
if (targetReturnType == void.class)
return target;
return filterReturnValue(target, empty(methodType(void.class, targetReturnType)));
But, a combinator can be provided as a short-hand.
public static MethodHandle dropReturn(MethodHandle target)
That can be used to drop the return value of a MethodHandle.
Doing this is currently already possible with the following code:
MethodHandle target = ...;
Class<?> targetReturnType = target.type().returnType();
if (targetReturnType == void.class)
return target;
return filterReturnValue(target, empty(methodType(void.class, targetReturnType)));
But, a combinator can be provided as a short-hand.
- csr for
- 
                    JDK-8255398 Add a dropReturn MethodHandle combinator -           
- Closed
 
-         
 
        