On Mon, 29 Apr 2024 17:09:24 GMT, ExE Boss <d...@openjdk.org> wrote: >> Adam Sotona has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update >> src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java >> >> Co-authored-by: Mandy Chung <mandy.ch...@oracle.com> > > This doesn’t fix the case where the lambda is created from an instance > method, e.g.: > > > import java.util.function.Supplier; > > public class HiddenLambda implements HiddenTest { > public String test() { > Supplier<String> s = this::toString; > return s.get(); > } > > public String toString() { > return getClass().getName(); > } > }
@ExE-Boss This patch intentionally does not support the said case. Reason being that an instance method will require a hidden class receiver, yet this receiver cannot be represented as part of a method type from the constant pool; so even if you grab the MH from condy, you still cannot `invokeExact` in bytecode, but have to perform an `asType` conversion first (or just use plain `invoke`) ------------- PR Comment: https://git.openjdk.org/jdk/pull/18810#issuecomment-2083259410