RFR: 8325859: potential information loss during type inference [v3]

Vicente Romero vromero at openjdk.org
Thu May 15 15:42:55 UTC 2025


On Thu, 15 May 2025 15:24:39 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).

right I was writing a very similar example, and X is not replaced because the minimized inference context doesn't know about X

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

PR Comment: https://git.openjdk.org/jdk/pull/25011#issuecomment-2884281998


More information about the compiler-dev mailing list