Alex Buckley alex.buckley at oracle.com
Fri Nov 22 20:24:21 UTC 2019

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 
... 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.


More information about the amber-spec-experts mailing list