RFR: 8204610: Compiler confused by parenthesized "this" in final fields assignments
Alex Buckley
alex.buckley at oracle.com
Mon Jun 11 19:42:26 UTC 2018
On 6/11/2018 3:34 AM, Maurizio Cimadamore wrote:
> On 09/06/18 01:17, Alex Buckley wrote:
>> On 6/8/2018 6:55 AM, Maurizio Cimadamore wrote:
>>> Basically, javac does not consistently skip parenthesis when enforcing
>>> foward refs and DA/DU rules.
>>
>> I want to check that javac skips parentheses for `x` and `this.x` in
>> DA/DU rules, but only for `x` in a forward field reference. At this
>> time, JLS 8.3.3 detects a forward field reference only if made with a
>> simple name; it's a bit late to expand that for JLS11, so I'm a bit
>> alarmed by this unified treatment of variable access:
> Javac is still implementing the same rule for forward references. E.g. a
> forward reference is treated as such only if it's unqualified (e.g. in
> the 'x' form); qualified access (this.x) will be allowed, as before.
Thanks for clarifying. I filed
https://bugs.openjdk.java.net/browse/JDK-8204693 to track the possible
tightening of forward field reference (disallow `this.x`) in JLS 8.3.3.
A finger-in-the-air guess the impact of this source-incompatible change:
1/4 the impact of banning `_` as a variable name.
Alex
More information about the compiler-dev
mailing list