access control for withfield bytecode, compared to putfield
Dan Smith
daniel.smith at oracle.com
Mon Jun 8 23:29:33 UTC 2020
> On Apr 8, 2020, at 11:29 PM, John Rose <john.r.rose at oracle.com> wrote:
>
> To summarize: The simplest rule for access checking a
> withfield instruction is to say, “pretend the field was
> declared private, and perform access checks”. That’s
> it; the rest follows from the rules we have already laid
> down.
Just had a chance to read this old mail...
FWIW, this *is* the specified behavior in the most recent JVMS iteration:
http://cr.openjdk.java.net/~dlsmith/lw2/lw2-20190628/specs/inline-classes-jvms.html#jvms-6.5.withfield
I agree, private access seems to be the right model. (Plus, maybe at some point, giving the class file the ability to express a 'withfield' access restriction as one of { public, protected, package, private }.)
More information about the valhalla-spec-experts
mailing list