RFR: 8294960: Convert java.base/java.lang.invoke package to use the Classfile API to generate lambdas and method handles [v25]

ExE Boss duke at openjdk.org
Fri May 16 01:56:12 UTC 2025


On Wed, 19 Jun 2024 09:08:35 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> java.base java.lang.invoke package heavily uses ASM to generate lambdas and method handles.
>> 
>> This patch converts ASM calls to Classfile API.
>> 
>> This PR is continuation of https://github.com/openjdk/jdk/pull/12945
>> 
>> Any comments and suggestions are welcome.
>> 
>> Please review.
>> 
>> Thank you,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - removed empty line
>  - problem-listed runtime/ClassInitErrors/TestStackOverflowDuringInit.java

Changes requested by ExE-Boss at github.com (no known OpenJDK username).

src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java line 562:

> 560:     private static byte[] generateCodeBytesForLFs(String className, String[] names, LambdaForm[] forms) {
> 561:         return ClassFile.of().build(ClassDesc.ofInternalName(className), clb -> {
> 562:             clb.withFlags(ACC_PRIVATE | ACC_FINAL | ACC_SUPER)

`ACC_PRIVATE` is not a valid access flag for a class, those only allow public or package access[^1]:
Suggestion:

            clb.withFlags(ACC_FINAL | ACC_SUPER)


[^1]: See **JVMS** [Table 4.1‑B](https://docs.oracle.com/javase/specs/jvms/se24/html/jvms-4.html#jvms-4.1-200-E.1)

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

PR Review: https://git.openjdk.org/jdk/pull/17108#pullrequestreview-2845315645
PR Review Comment: https://git.openjdk.org/jdk/pull/17108#discussion_r2092193712


More information about the core-libs-dev mailing list