RFR: 8338526: Don't store abstract and interface Klasses in class metaspace

Coleen Phillimore coleenp at openjdk.org
Wed Aug 21 21:20:06 UTC 2024


On Wed, 21 Aug 2024 21:02:50 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java line 279:
>> 
>>> 277:         clb.withMethod(invokerName, invokerDesc, ACC_STATIC, config);
>>> 278:     }
>>> 279: 
>> 
>> There's probably not much value in using ACC_FINAL here anyway.  We are only using these classes to create static methods, right?  I think ACC_INTERFACE would work here too.
>
> Note that JVMS 4.1 requires `ACC_ABSTRACT` to be also set when `ACC_INTERFACE` is set. Also note that some classes capture class data to refer to hidden classes and method handles or lambda forms, so those fields' generation need to add `ACC_PUBLIC` flag to be usable in interfaces.

I feel like making it ACC_INTERFACE might cause some error if there are no public nonstatic methods, which is the case with this class. I don't know what @liach your comment means, but this code got more complicated than it was with the first version of this change.  When I talked to @rose00 he thought ACC_ABSTRACT would be okay for this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19157#discussion_r1725764671


More information about the core-libs-dev mailing list