jdk-24/test/langtools/tools/javac/generics/wildcards/T6450290.java
2023-01-17 04:43:40 +00:00

22 lines
581 B
Java

/*
* @test /nodynamiccopyright/
* @bug 6450290
* @summary Capture of nested wildcards causes type error
* @author Maurizio Cimadamore
* @compile/fail/ref=T6450290.out -XDrawDiagnostics T6450290.java
*/
public class T6450290 {
static class Box<X extends Box<?,?>, T extends X> {
T value;
Box<X, T> same;
}
static class A extends Box<A,A> {}
static class B extends Box<B,B> {}
public static void meth() {
Box<?,?> b = new Box<Box<A,A>,Box<A,A>>();
b.value.same = new Box<B,B>(); //javac misses this bad assignment
}
}