RFR: 8193904: Uninitialized final field access and qualified this

Archie Cobbs archie.cobbs at gmail.com
Wed Nov 2 20:18:16 UTC 2022


On Wed, Nov 2, 2022 at 2:47 PM Alex Buckley <alex.buckley at oracle.com> wrote:

> JLS ch.16 is specific that only `foo` and `this.foo` cause an error. See
> the definition of "access" in the opening paragraphs of the chapter.
>

Thanks for pointing that out, which I forgot to do. The JLS language is:

An access to its value consists of the simple name of the variable (or, for
a field, the simple name of the field qualified by this) occurring anywhere
in an expression except as the left-hand operand of the simple assignment
operator =

In theory one could argue that MyClass.this.foo is also an example of "the
simple name of the field qualified by this" - just look at the latter part,
no?

Regardless, it looks like there needs to be a spec change... right? I'm
assuming we'd rather do that than continue to allow the current behavior.

Thanks,
-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20221102/cc6edeaa/attachment.htm>


More information about the compiler-dev mailing list