RFR: JDK-8315458 Implementation of Implicitly Declared Classes and Instance Main Method (Second Preview) [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Nov 2 11:04:06 UTC 2023
On Wed, 1 Nov 2023 19:14:22 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:
>> Address changes from JEP 445 to JEP 463.
>>
>> - Move from a SYNTHETIC unnamed class to a MANDATED implicit class.
>>
>> - Don't mark class on read.
>>
>> - Remove reflection and annotation processing related to unnamed classes.
>>
>> - Simplify main method search.
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove obsolete tests
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 4057:
> 4055: Name name = names.fromString(simplename);
> 4056: JCModifiers implicitMods = F.at(Position.NOPOS)
> 4057: .Modifiers(Flags.FINAL|Flags.MANDATED|Flags.IMPLICIT_CLASS, List.nil());
I don't think the JVMS allows for a flag to have ACC_MANDATED flags?
It is a limitation of the class file format that only formal parameters and modules can be flagged as ACC_MANDATED ([§4.7.24](https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.24), [§4.7.25](https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.25)) to indicate that, despite being compiler-generated, they are not considered implementation artifacts. There is no way to flag other compiler-generated constructs so that they too are not considered implementation artifacts (JLS §13.1). This limitation means that reflective APIs of the Java SE Platform may not accurately indicate the "mandated" status of such constructs.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16461#discussion_r1379931703
More information about the compiler-dev
mailing list