RFR: 8315134: javac inference seems to be capturing types incorrectly
Vicente Romero
vromero at openjdk.org
Tue Aug 29 03:27:49 UTC 2023
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
-------------
Commit messages:
- 8315134: javac inference seems to be capturing types incorrectly
Changes: https://git.openjdk.org/jdk/pull/15463/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15463&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8315134
Stats: 46 lines in 4 files changed: 43 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/15463.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15463/head:pull/15463
PR: https://git.openjdk.org/jdk/pull/15463
More information about the compiler-dev
mailing list