-
Bug
-
Resolution: Fixed
-
P3
-
17, 18, 19, 20
-
b32
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8290683 | 20 | Ioi Lam | P3 | Resolved | Fixed | b07 |
JDK-8291440 | 19.0.2 | Ioi Lam | P3 | Resolved | Fixed | b01 |
JDK-8291321 | 19.0.1 | Ioi Lam | P3 | Resolved | Fixed | b04 |
JDK-8290904 | 17.0.5-oracle | Ioi Lam | P3 | Resolved | Fixed | b04 |
JDK-8291547 | 17.0.5 | Yuri Nesterenko | P3 | Resolved | Fixed | b01 |
JDK-8291886 | 15.0.9 | Dmitry Cherepanov | P3 | Resolved | Fixed | b03 |
$ java17 -showversion -cp test.jar -XX:ArchiveClassesAtExit=test.jsa \
-Djdk.internal.lambda.dumpProxyClasses=DUMP_CLASS_FILES \
-Xlog:cds Test
$ java17 -showversion -cp test.jar -XX:SharedArchiveFile=test.jsa -Xlog:cds Test
[....]
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at Tester.test(Unknown Source)
at Test.main(Unknown Source)
=========================================
Note that the generated lambd proxy class used "ldc ... Dynamic" for getting a MethodHandle to Base::provideDownstreamSubscription, because the target method is a protected method in a different package. While this method is accessible from Tester (it's from a super type of Tester), it's not accessible from the lambda proxy class.
See here for more info: https://github.com/openjdk/jdk/blob/522b65743ca10fcba0a27d25b8fa11319999e228/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java#L183-L191
$ find DUMP_CLASS_FILES | grep Tester
DUMP_CLASS_FILES/Tester$$Lambda$1.class
$ javap -c -private 'DUMP_CLASS_FILES/Tester$$Lambda$1.class'
final class Tester$$Lambda$1 implements java.util.function.Consumer {
private final Tester arg$1;
private Tester$$Lambda$1(Tester);
Code:
0: aload_0
1: invokespecial #13 // Method java/lang/Object."<init>":()V
4: aload_0
5: aload_1
6: putfield #15 // Field arg$1:LTester;
9: return
public void accept(java.lang.Object);
Code:
0: ldc #28 // Dynamic #0:_:Ljava/lang/invoke/MethodHandle;
2: aload_0
3: getfield #15 // Field arg$1:LTester;
6: aload_1
7: checkcast #30 // class java/lang/String
10: invokevirtual #36 // Method java/lang/invoke/MethodHandle.invokeExact:(LTester;Ljava/lang/String;)V
13: return
}
- backported by
-
JDK-8290683 CDS cannot archive lamda proxy with useImplMethodHandle
- Resolved
-
JDK-8290904 CDS cannot archive lamda proxy with useImplMethodHandle
- Resolved
-
JDK-8291321 CDS cannot archive lamda proxy with useImplMethodHandle
- Resolved
-
JDK-8291440 CDS cannot archive lamda proxy with useImplMethodHandle
- Resolved
-
JDK-8291547 CDS cannot archive lamda proxy with useImplMethodHandle
- Resolved
-
JDK-8291886 CDS cannot archive lamda proxy with useImplMethodHandle
- Resolved
- relates to
-
JDK-8290707 runtime/cds/appcds/dynamicArchive/DynamicLambdaWithUseImplMethodHandle.java fails with "Can't find sun.hotspot.whitebox"
- Resolved
- links to
-
Commit openjdk/jdk15u-dev/b176776d
-
Commit openjdk/jdk17u-dev/27ffd83f
-
Commit openjdk/jdk19/4dc421ca
-
Review openjdk/jdk15u-dev/251
-
Review openjdk/jdk17u-dev/575
-
Review openjdk/jdk19/146