On Wed, 19 Jun 2024 09:08:35 GMT, Adam Sotona <asot...@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-b...@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

Reply via email to