----- Mail original ----- > De: "Jorn Vernee" <jver...@openjdk.java.net> > À: "core-libs-dev" <core-libs-dev@openjdk.java.net> > Envoyé: Lundi 26 Octobre 2020 16:37:20 > Objet: RFR: 8255398: Add a dropReturn MethodHandle combinator
> 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. As i said in the JBS issue, it's not just a short hand, it also the semantics of the POP/POP2 bytecode, remove the return value on top of the stack. > > Thanks, > Jorn regards, Rémi > > ------------- > > Commit messages: > - Add a dropReturn method handle combinator > > Changes: https://git.openjdk.java.net/jdk/pull/866/files > Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=866&range=00 > Issue: https://bugs.openjdk.java.net/browse/JDK-8255398 > Stats: 92 lines in 2 files changed: 92 ins; 0 del; 0 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