Integrated: 8369517: Compilation mismatch for equivalent lambda and method reference

Vicente Romero vromero at openjdk.org
Wed Nov 12 14:33:46 UTC 2025


On Thu, 9 Oct 2025 19:26:36 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)

This pull request has now been integrated.

Changeset: e5a272a5
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/e5a272a59058e36136acd6aef635f87136fbb027
Stats:     58 lines in 4 files changed: 56 ins; 0 del; 2 mod

8369517: Compilation mismatch for equivalent lambda and method reference

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.org/jdk/pull/27737


More information about the compiler-dev mailing list