RFR: 8369517: Compilation mismatch for equivalent lambda and method reference [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Oct 10 18:40:02 UTC 2025


On Fri, 10 Oct 2025 15:43:18 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Given the following test case:
>> 
>> 
>> import java.util.function.Supplier;
>> interface Main {
>>     interface X<T> {
>>         X<T> self();
>>     }
>> 
>>     static X<?> makeX() {return null;}
>> 
>>     static <R> X<R> create(Supplier<? extends R> supplier) {return null;}
>> 
>>     static X<X<?>> methodRef() {
>>         return create(Main::makeX).self();
>>     }
>> 
>>     static X<X<?>> lambda() {
>>         return create(() -> makeX()).self();
>>     }
>> }
>> 
>> 
>> javac reports an error for the method reference but not for the lambda. There should be no difference here (error in both cases)
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   updating test

Marked as reviewed by mcimadamore (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/27737#pullrequestreview-3325361885


More information about the compiler-dev mailing list