On Wed, 17 Apr 2024 08:46:59 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 I wonder if we should only support invokeStatic refs for hidden classes, as instance call lambdas will always require receiver which can't be represented outside of hidden classes. src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 186: > 184: !VerifyAccess.isSamePackage(targetClass, > implInfo.getDeclaringClass())) || > 185: implKind == H_INVOKESPECIAL || > 186: implInfo.getDeclaringClass().isHidden(); Might need to check the difference between `implInfo.getDeclaringClass()` and `implClass` ------------- PR Review: https://git.openjdk.org/jdk/pull/18810#pullrequestreview-2005483864 PR Review Comment: https://git.openjdk.org/jdk/pull/18810#discussion_r1568505421