On Thu, 18 Apr 2024 05:54:17 GMT, Adam Sotona <asot...@openjdk.org> wrote:
>> Current implementation of `LambdaMetafactory` does not allow to use lambdas >> in hidden classes. Invocation throws `NoClassDefFoundError` instead. >> >> This patch includes lambda implementation in a hidden class under the >> special handling of `useImplMethodHandle`. >> The patch also fixes `j/l/i/defineHiddenClass/BasicTest::testLambda` to >> correctly cover this test case. >> >> Please review. >> >> Thanks, >> Adam > > 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::toString` references the hidden class by name [1] which fails to be resolved. The code needs to ensure that hidden class's name is not referenced for example by casting to a supertype whose is a normal class: HiddenTest o = this; Supplier<String> s = o::toString; [1] https://download.java.net/java/early_access/jdk23/docs/api/java.base/java/lang/Class.html#hiddenClasses ------------- PR Comment: https://git.openjdk.org/jdk/pull/18810#issuecomment-2083336824