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

22 lines
458 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
*
*/
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();
}
}