jdk-24/langtools/test/tools/javac/generics/inference/CaptureLowerBoundDeref.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

24 lines
582 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8075793
* @summary Capture variable as an inference lower bound followed by a member reference
* @compile/fail/ref=CaptureLowerBoundDeref.out -XDrawDiagnostics CaptureLowerBoundDeref.java
* @compile -Xlint:-options -source 7 CaptureLowerBoundDeref.java
*/
class CaptureLowerBoundDeref {
interface Wrapper<T> {
I<T> get();
}
interface I<T> {}
interface K<T> { void take(T arg); }
<T> K<T> m(I<? extends T> arg) { return null; }
void test(Wrapper<?> w) {
m(w.get()).take(new Object());
}
}