RFR: 8255398: Add a dropReturn MethodHandle combinator [v3]

Jorn Vernee jvernee at openjdk.java.net
Mon Oct 26 16:14:38 UTC 2020


> Hi,
> 
> This patch adds a `dropReturn` combinator to `MethodHandles` that can be used to create a new method handle that drops the return value, from a given method handle. Similar to the following code:
> 
> MethodHandle target = ...;
> Class<?> targetReturnType = target.type().returnType();
> if (targetReturnType != void.class)
>     target = filterReturnValue(target, empty(methodType(void.class, targetReturnType))); 
> // use target
> 
> But as a short-hand.
> 
> Thanks,
> Jorn

Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:

  Collapse lform get and update into single line
  
  Co-authored-by: Claes Redestad <claes.redestad at gmail.com>

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/866/files
  - new: https://git.openjdk.java.net/jdk/pull/866/files/2793ac1b..e392a0f8

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=866&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=866&range=01-02

  Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/866.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/866/head:pull/866

PR: https://git.openjdk.java.net/jdk/pull/866


More information about the core-libs-dev mailing list