jdk-24/langtools/test/tools/javac/generics/inference/CaptureLowerBoundNeg.java
Dan Smith 3999672b7a 8075793: Source incompatibility for inference using -source 7
In pre-8 sources, avoid capture variables as inference bounds, consistent with old javac behavior

Reviewed-by: vromero, mcimadamore
2016-12-14 17:56:11 -07:00

21 lines
519 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8039214
* @summary Capture variable as an inference variable's lower bound
* @compile/fail/ref=CaptureLowerBoundNeg.out -XDrawDiagnostics CaptureLowerBoundNeg.java
* @compile -Xlint:-options -source 7 CaptureLowerBoundNeg.java
*/
public class CaptureLowerBoundNeg {
static class D<T> {
void take(T arg) {}
static <T> D<T> make(Class<? extends T> c) { return new D<T>(); }
}
void test(Object o) {
D.make(o.getClass()).take(o);
}
}