On Fri, 23 Jan 2026 15:30:46 GMT, Vicente Romero <[email protected]> wrote:

>> According to spec bugs: JDK-8373719 and JDK-8373721:
>> 
>> In JLS 6.5.6.1, references to fields are subject to a handful of 
>> restrictions if they refer to instance fields. In 15.8 and 15.11, 'this.x' 
>> and 'super.x' are intended to be viewed as instance field references, and 
>> subject to the same restrictions.
>> 
>> So the following code should fail to compile:
>> 
>> class Test {
>>     static final boolean check = true;
>>     Test(int a) {
>>         boolean b = Test.this.check; //compilation error expected here
>>         this();
>>     }
>> }
>> 
>> However, javac is currently accepting it
>
> Vicente Romero has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains three additional 
> commits since the last revision:
> 
>  - adding test case
>  - Merge branch 'lworld' into JDK-8373916
>  - 8373916: [lworld] TypeName.this.FieldName should be restricted in early 
> construction context

Looks good

-------------

Marked as reviewed by mcimadamore (Committer).

PR Review: 
https://git.openjdk.org/valhalla/pull/1899#pullrequestreview-3746890710

Reply via email to