On Mon, 18 Jul 2022 04:14:03 GMT, Ioi Lam <ik...@openjdk.org> wrote: >> Since the impact of this bug can be big, and the fix is simple and low risk >> (just avoids doing optimizations), I'd like to put this into JDK 19 before >> RDP2 (Jul 21). >> >> CDS cannot handle Lambda proxy classes that are generated in the >> useImplMethodHandle mode. This could happen with classfiles generated by JDK >> 8 or JDK 11 that access protected methods in a base class from a different >> package. E.g., >> >> >> class pkg1.Base { >> protected void doit(String s) { >> System.out.println(s); >> } >> } >> class pkg2.Child extends pkg1.Base { >> void test() { >> Optional<String> opt = Optional.of("foo"); >> opt.ifPresent(this::doit); >> } >> } >> >> >> More details of useImplMethodHandle can be found here: >> https://github.com/openjdk/jdk/blob/522b65743ca10fcba0a27d25b8fa11319999e228/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java#L183-L191 >> >> More details about the condition that triggers the error can be found in the >> test file Child.jcod. > > Ioi Lam has updated the pull request incrementally with one additional commit > since the last revision: > > fixed typo
Looks good. Just couple of nits. test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicLambdaWithUseImplMethodHandle.java line 41: > 39: > 40: import jdk.test.lib.cds.CDSOptions; > 41: import jdk.test.lib.cds.CDSTestUtils; Extra import statements? test/hotspot/jtreg/runtime/cds/appcds/test-classes/pkg2/Child.jcod line 59: > 57: // > 58: // Javac in JDK 17 generates a public method for accessing the protected > method > 59: // in the base class. As a result, InnerClassLambdaMetafactory will no > generate typo no -> not? ------------- Marked as reviewed by ccheung (Reviewer). PR: https://git.openjdk.org/jdk19/pull/146