access control for withfield bytecode, compared to putfield

Dan Smith daniel.smith at
Mon Jun 8 23:29:33 UTC 2020

> On Apr 8, 2020, at 11:29 PM, John Rose <john.r.rose at> 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:

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-observers mailing list