RFR: 8315134: javac inference seems to be capturing types incorrectly

Vicente Romero vromero at openjdk.org
Tue Aug 29 16:20:22 UTC 2023


On Tue, 29 Aug 2023 03:20:52 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> this code:
> 
> 
> import java.util.*;
> 
> public class Test {
>     private static <T> void arrayMethod(List<? super T>[] args) {
>         listMethod(Arrays.asList(args));
>     }
> 
>     private static <T> void listMethod(List<List<? super T>> list) {}
> }
> 
> 
> is being rejected by the compiler. This code should be accepted according to the spec. The compiler is doing a capture conversion that is not mentioned in the spec while reducing subtyping constraints during type inference. This fix is syncing the compiler with the spec.
> 
> TIA

the issue is a duplicate of [JDK-8206142](https://bugs.openjdk.org/browse/JDK-8206142) at that instance we decided to wait for the related spec to be finished. Closing this PR as this is a known issue we won't fix for the time being

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

PR Comment: https://git.openjdk.org/jdk/pull/15463#issuecomment-1697764600


More information about the compiler-dev mailing list