Spec: ACC_MANDATED

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Nov 22 20:13:35 UTC 2019



On 11/22/2019 12:11 PM, Alex Buckley wrote:
> (Removing compiler-dev. Cross-posting to *-dev and *-spec-experts list 
> is wrong. We're discussing a question driven mainly by Records, so 
> let's treat it as Amber spec territory.)
>
> On 11/22/2019 12:02 PM, Dan Smith wrote:
>>> On Nov 22, 2019, at 12:22 PM, Leonid Kuskov
>>> <Leonid.Kuskov at Oracle.com> wrote:
>>> Does it make sense to add a definition of ACC_MANDATED to the
>>> tables?
>>
>> To clarify: are you saying javac is using the 0x8000 flags on fields
>> and methods, despite this flag being undefined in these contexts? Or
>> are you saying that you think we should *start* using the flag on
>> fields and methods, with supporting changes to the spec?
>>
>> (The first would be a bug, the second would be a minor new feature.)
>
> Leonid is asking for the second. Have I forgotten a discussion how 
> enum/records' mandated members are represented in the class file? I 
> see internal Slack questions every week about mandated members and 
> reflection, but there's nothing in the JVMS draft to set expectations. 
> (If we decided NOT to define ACC_MANDATED in 
> {field_info,method_info}.access_flags, then the JVMS should discuss 
> that in a note in 4.7.8, since "mandated members" are indicated there.)
>
> Alex
>

Note that this potentially bubbles up into 
javax.lang.model.util.Elements::getOrigin().

https://docs.oracle.com/en/java/javase/13/docs/api/java.compiler/javax/lang/model/util/Elements.html#getOrigin(javax.lang.model.element.Element)
https://docs.oracle.com/en/java/javase/13/docs/api/java.compiler/javax/lang/model/util/Elements.Origin.html
https://docs.oracle.com/en/java/javase/13/docs/api/java.compiler/javax/lang/model/util/Elements.Origin.html#MANDATED

-- Jon


More information about the amber-spec-observers mailing list