daniel.smith at oracle.com
Fri Nov 22 20:02:23 UTC 2019
> On Nov 22, 2019, at 12:22 PM, Leonid Kuskov <Leonid.Kuskov at Oracle.com> wrote:
> So specification allows RI to mark final fields associated with components and some methods by ACC_MANDATED flag (0x8000). The latest JVMS specification (https://docs.oracle.com/javase/specs/jvms/se13/html/index.html) permits this flag only for 2 attributes: MethodParameters_attribute, Module_attribute . The flag is not mentioned in both tables: Table 4.5-A. "Field access and property flags", Table 4.6-A. "Method access and property flags".
> 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.)
> Now names of methods are removed and the more loose statement "mandated members of enums and records" is used. Does it mean that spec won't enumerate "mandated" methods anymore? And the setting of this flag will be implementation-specific? From my point of view, it might break the unambiguity of the signature tests.
I don't like putting highly specific compilation details in the JVMS description of an attribute. I don't think it's the appropriate place for those kinds of rules.
I *do* think we have a reasonable definition of "mandated" based on the specification of the flag, combined with what the JLS has to say about implicit declarations (see, for example, JLS 8.9.3).
(JLS doesn't use that particular term, so depending on the answer to your first question, maybe it makes sense to rephrase this rule to talk about "implicit" members rather than "mandated" members.)
More information about the compiler-dev