[jdk19] RFR: 8290417: CDS cannot archive lamda proxy with useImplMethodHandle [v4]

Ioi Lam iklam at openjdk.org
Mon Jul 18 19:01:28 UTC 2022


> 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 tier4 failure with hotspot_appcds_dynamic testing

-------------

Changes:
  - all: https://git.openjdk.org/jdk19/pull/146/files
  - new: https://git.openjdk.org/jdk19/pull/146/files/6736b66b..67d153ab

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk19&pr=146&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk19&pr=146&range=02-03

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk19/pull/146.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/146/head:pull/146

PR: https://git.openjdk.org/jdk19/pull/146


More information about the core-libs-dev mailing list