RFR: 8369517: Compilation mismatch for equivalent lambda and method reference
Vicente Romero
vromero at openjdk.org
Thu Oct 9 19:34:02 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)
-------------
Commit messages:
- 8369517: Compilation mismatch for equivalent lambda and method reference
Changes: https://git.openjdk.org/jdk/pull/27737/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27737&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8369517
Stats: 53 lines in 3 files changed: 52 ins; 0 del; 1 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