On Tue, 21 Nov 2023 10:38:36 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

>> Look at the spec https://bugs.openjdk.org/browse/JDK-8319252 under 7.3 
>> Compilation Units.
>> 
>> - It is not abstract (8.1.1.1 ⇗).
>> - It is final (8.1.1.2 ⇗).
>> - It is a member of an unnamed package (7.4.2 ⇗) and **has package access**. 
>> Its direct superclass is Object (8.1.4 ⇗).
>> - It does not have any direct superinterfaces (8.1.5 ⇗).
>> - The body of the class contains every ClassMemberDeclaration (these are 
>> declarations of fields (8.3 ⇗), methods (8.4 ⇗), member classes (8.5 ⇗), and 
>> member interfaces (9.1.1.3 ⇗)) from the simple compilation unit. It is not 
>> possible for a simple compilation unit to declare an instance initializer 
>> (8.6 ⇗), static initializer (8.7 ⇗), or constructor (8.8 ⇗).
>> -It has an implicitly declared default constructor (8.8.9 ⇗).
>
> @JimLaskey, in my experiments for JDK-8308715 (Create a mechanism for 
> Implicitly Declared Class javadoc), I found that 
> `javax.lang.model.util.Elements.getOrigin` reports `Origin.EXPLICIT` for the 
> implicitly declared class and `Origin.MANDATED` for that class' constructor. 
> Shouldn't they both be `Origin.MANDATED` because the elements are created 
> from source, not class files, which have some limitations on `ACC_MANDATED`?

@pavelrappo Classes can’t be MANDATED. Looking at the code I see that EXPLICIT 
is the default return value when no other conditions apply.

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

PR Comment: https://git.openjdk.org/jdk/pull/16461#issuecomment-1820879428

Reply via email to