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

23 lines
521 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8075793
* @summary Capture variable as an inference lower bound followed by an array write
* @compile/fail/ref=CaptureLowerBoundArray.out -XDrawDiagnostics CaptureLowerBoundArray.java
* @compile -Xlint:-options -source 7 CaptureLowerBoundArray.java
*/
class CaptureLowerBoundArray {
interface I<T> {
T[] getArray();
}
<T> T[] m(T[] arg) { return null; }
void test(I<? extends Exception> i) {
m(i.getArray())[0] = new Exception();
}
}