RFR: 8369517: Compilation mismatch for equivalent lambda and method reference [v4]
Vicente Romero
vromero at openjdk.org
Tue Nov 11 02:47:49 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge branch 'master' into JDK-8369517
- updating test
- fixing issues
- 8369517: Compilation mismatch for equivalent lambda and method reference
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27737/files
- new: https://git.openjdk.org/jdk/pull/27737/files/53f7d475..1efd9f87
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27737&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27737&range=02-03
Stats: 270123 lines in 2510 files changed: 172590 ins; 59384 del; 38149 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