RFR: 8334248: Invalid error for early construction local class constructor method reference [v7]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Oct 3 12:07:45 UTC 2024


On Thu, 3 Oct 2024 10:08:02 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Tweak comments
>
> test/langtools/tools/javac/LocalFreeVarStaticInstantiate.java line 19:
> 
>> 17:             }
>> 18:         }
>> 19:     }
> 
> I wonder if the test case should be enhanced with something like:
> 
>     Runnable r = () -> {
>         Object there = "";
>         class Local {
>             {
>                 there.hashCode();
>             }
>             static {
>                 new Local();    // can't get there from here
>             }
>         }
>     };
> 
> 
> It works currently, as lambdas get a fake method owner if needed, so it would be just to make sure it remains working even if the handling of the lambdas changes.

I've beefed up the test. While doing so I realized that the generated diagnostic was suboptimal, so I've fixed that too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19904#discussion_r1786104947


More information about the compiler-dev mailing list