Shortcut for obtaining a MethodHandle for an anonymous code fragment

Florian Weimer fw at deneb.enyo.de
Sun Jan 10 16:44:33 UTC 2021


Is it true that there is no shortcut for obtaining a method handle for
some code fragment?

That is, there is no way to write something like this?

  MethodHandle repeatIt = (String x) -> x + x;

Instead it's necessary to give the expression a name and put it into a
static method somewhere, and obtain a MethodHandle for it using
MethodHandles.lookup().


More information about the mlvm-dev mailing list