RFR: 8325859: potential information loss during type inference [v3]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu May 15 15:28:53 UTC 2025
On Thu, 15 May 2025 15:17:44 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> If you can find a case w/o `void` that exhibits the same issue, we can certainly look into that more.
Uhmmm. This:
static class Generic {
public static void main(String... args) {
Integer i = null;
runT(() -> supplyNull(i));
}
static <R, X> R supplyNull(X... varargs) {
System.out.println(varargs.getClass().getComponentType());
return null;
}
static <T> void runT(Supplier<T> runnable) { runnable.get(); }
}
Seems to exhibit same incorrect behavior. Inference goes a bit further (I see R being replaced, but not X).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25011#issuecomment-2884233369
More information about the compiler-dev
mailing list