[External] : Re: RFR: 8193904: Uninitialized final field access and qualified this

Archie Cobbs archie.cobbs at gmail.com
Wed Nov 2 21:28:58 UTC 2022


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

> DU/DA analysis is about whether names have bindings. `x.foo` and `new
> C().foo` and `m().foo` are expressions, not names, so we don't attempt
> the analysis on them. As Jan points out [1], access via expressions is
> hard to track. `this.foo` is an expression, but a very easy one, so we
> treat it like the name `foo` and do the analysis. `A.B.C.this.foo` is an
> expression with a qualified-this subexpression and now you need a bunch
> of analysis to figure out whether it means the same as the name `foo`.
>

Gotcha. And so my patch is therefore purporting to do "a bunch of
analysis"... which of course it may very well be doing incorrectly...

If so I'd be interested to know that. Do you mind taking a look at
TreeInfo.isThisReference() to see if it looks correct?

Of course because "this" is special we don't need to do a full blown
expression analysis... e.g., you can't ever say "myMethod().this" in Java.

Thanks,
-Archie

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


More information about the compiler-dev mailing list