java-topology/test/langtools/tools/javac/generics/wildcards/T6450290.java
russell@unturf.com 0a580b313d undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
2026-03-26 17:11:57 -04:00

21 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
}
}