On Mon, 26 Oct 2020 15:45:34 GMT, Jorn Vernee <jver...@openjdk.org> wrote:
>> 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: > > Fix bug id referenced in test LGTM, pending CSR. A minor simplification suggested inline. src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 5225: > 5223: MethodType newType = oldType.changeReturnType(void.class); > 5224: BoundMethodHandle result = target.rebind(); > 5225: LambdaForm lform = result.form; Suggestion: LambdaForm lform = result.editor().filterReturnForm(V_TYPE, true); src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 5226: > 5224: BoundMethodHandle result = target.rebind(); > 5225: LambdaForm lform = result.form; > 5226: lform = lform.editor().filterReturnForm(V_TYPE, true); Suggestion: ------------- Marked as reviewed by redestad (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/866