RFR: 8318160: javac does not reject private method reference with type-variable receiver [v6]

Vicente Romero vromero at openjdk.org
Tue Oct 17 23:24:45 UTC 2023


On Tue, 17 Oct 2023 13:13:29 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Not sure... if you have:
>> 
>> class Foo<X> {
>>    X get()
>> }
>> 
>> And then:
>> 
>> 
>> static Function<?, String> m2(Foo<? extends Test> foo) {
>>         return foo.get()::asString2;
>>     }
>>  ```
>>  
>>  Don't you end up with a similar issue?
>
> right nice example thanks

I made several experiments and decided for the approach in the last commit pushed. We will need an additional field in class `MethodResolutionContext` basically pointing to the current `LookupHelper` which can now decide if a symbol is inherited at a given site or not. Semantically there are not changes for any other method the only semantic change will be when we are looking for the method in a method reference.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16210#discussion_r1362919699


More information about the compiler-dev mailing list