RFR: 8369517: Compilation mismatch for equivalent lambda and method reference [v2]
Vicente Romero
vromero at openjdk.org
Thu Oct 9 23:33:43 UTC 2025
> 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:
fixing issues
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27737/files
- new: https://git.openjdk.org/jdk/pull/27737/files/8005b675..41783b0f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27737&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27737&range=00-01
Stats: 8 lines in 4 files changed: 4 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/27737.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27737/head:pull/27737
PR: https://git.openjdk.org/jdk/pull/27737
More information about the compiler-dev
mailing list