Fields and methods of a record are marked MANDATED

Jonathan Gibbons jonathan.gibbons at
Thu Oct 10 18:09:59 UTC 2019


This distinction is covered under javax.lang.model.util.Elements.Origin.

In other words, you should be able to determine if a member was provided 
explicitly in source code, or provided by the compiler.

-- Jon

On 10/10/19 9:09 AM, Brian Goetz wrote:
> Under that interpretation, that leaves record members in a funny place, since a given mandated member (e.g., an accessor for a component) _might_ have been explicit in the source, or might not have been.  Should ACC_MANDATED describe the member descriptor (“spec mandates a member with this descriptor”) or only the implementation (“the source didn’t have it, but its here in the byte code”)?  In the latter interpretation, the presence of ACC_MANDATED on a mandated member would basically be random, based on implementation-of-the-day, which seems wrong.
>> On Oct 10, 2019, at 12:06 PM, Joe Darcy <joe.darcy at> wrote:
>> A mandated construct is one that is mandated by the specification, but not explicitly declared. Constructs of that sort have been in the platform since the beginning, such as default constructors. ACC_MANDATED was added to the platform only more recently and has some exposure through javax.lang.model.
>> I recommend going forward ACC_MANDATED to be used more widely, on all the mandated structures, including the values methods on enum types, etc.
>> Cheers,
>> -Joe
>> On 10/10/2019 8:50 AM, Brian Goetz wrote:
>>> We should match the behavior of methods like `Enum::values`.
>>>> On Oct 10, 2019, at 10:15 AM, Remi Forax <forax at> wrote:
>>>> Hi all,
>>>> fields and methods of a record are marked ACC_MANDATED which contradict JLS 13.1.12 that explains that you can not use ACC_MANDATED on field and method.
>>>> regards,
>>>> Rémi

More information about the amber-spec-experts mailing list