RFR: 8204610: Compiler confused by parenthesized "this" in final fields assignments

Liam Miller-Cushon cushon at google.com
Tue Jun 12 02:41:37 UTC 2018


On Mon, Jun 11, 2018 at 2:35 PM Alex Buckley <alex.buckley at oracle.com>
wrote:

> All that said, if you can count the qualified-`this` names used in your
> codebase to (i, RHS) access a variable's value, and (ii, LHS) denote the
> variable to assign to, then it would be interesting info.
>

I found about 3200 occurrences of (i) and 7100 occurrences of (ii).

That's not a large absolute number. (As expected, it's a small fraction of
unqualified this accesses.)

I take the point that handling arbitrarily complex expressions that result
in blank final access is both impossible and not a path we want to go very
far down. For what it's worth, though, I think qualified this (even if the
type name is fully-qualified) is less obscure than the other examples that
have come up. Treating equivalent unqualified and qualified this accesses
differently feels surprising to me in a way that, say, treating
`(true?this:this).x` and `this.x` differently doesn't.

On Mon, Jun 11, 2018 at 6:00 PM Tagir Valeev <amaembo at gmail.com> wrote:

>
>
> вт, 12 июня 2018 г., 2:57 Liam Miller-Cushon <cushon at google.com>:
>
>> Where does qualified 'this' fit in here (e.g. `TypeName.this.x = 1`)?
>> Should it be handled similarly?
>>
>
> I think that the programmer can always cheat. E. g. how about
> (true?this:this).x? Or ((TypeName)this).x. So there's no point to
> overcomplicate the compiler further to handle more cases as something will
> still be unsupported. After all one can always declare instance method like
> TypeName getThis() { return this;} and use getThis().x.
>
> With best regards,
> Tagir Valeev
>
>
>> Related: JDK-8193904
>>
>> On Mon, Jun 11, 2018 at 12:43 PM Alex Buckley <alex.buckley at oracle.com>
>> wrote:
>>
>>> A finger-in-the-air guess the impact of this source-incompatible change:
>>> 1/4 the impact of banning `_` as a variable name.
>>>
>>
>> I'd be happy to help measure the impact of that change once there's a
>> prototype.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180611/0a0207e9/attachment-0001.html>


More information about the compiler-dev mailing list