Brian Goetz brian.goetz at oracle.com
Fri Nov 22 23:30:58 UTC 2019

The original intent was not to introduce ACC_MANDATED to 
{field,method}_info or apply it to the constructor, field, or accessors; 
we saw no reason to do so other than pedantic-ness.

If javac is generating the flag on fields and methods, I would prefer to 
treat that as a bug.

On 11/22/2019 3:24 PM, Alex Buckley wrote:
> On 11/22/2019 12:10 PM, Jonathan Gibbons wrote:
>> Could someone also specify definitively the behavior when a user 
>> chooses to explicitly define a method, such as `equals` or `hashCode` 
>> for a record.   In other words, just because a method may be mandated 
>> in JLS, I'm expecting that this does not imply the use of 
>> ACC_MANDATED in those situations where the user explicitly defines 
>> the method.
> Right, a "mandated" method is one created by the compiler because the 
> JLS mandated (i.e. forced) the presence of the method if it wasn't 
> explicitly declared in source code. If it was explicitly declared in 
> source code, then it's not created by the compiler and is "just" an 
> ordinary unflagged method (not synthetic, not mandated). This should 
> all follow from 
> http://cr.openjdk.java.net/~gbierman/jep359/jep359-20191121/specs/records-jls.html#jls-13.1 
> ... BTW, I see "Certain private fields and public methods of record 
> types (8.10.3)" are not marked as mandated so I guess we're not 
> introducing ACC_MANDATED to {field_info,method_info}.access_flags 
> after all.
> JCK tests which check the mapping from source code to class file can 
> check that an explicitly declared method is neither ACC_MANDATED nor 
> ACC_SYNTHETIC, and that source code without an explicitly declared 
> method gets a method which is ACC_MANDATED and not ACC_SYNTHETIC.
> Alex

More information about the amber-spec-experts mailing list