java-topology/test/langtools/tools/javac/conditional/8064464/T8064464.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

23 lines
614 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8064464
* @summary regression with type inference of conditional expression
* @compile/fail/ref=T8064464.out -XDrawDiagnostics T8064464.java
*/
import java.util.List;
class T8064464 {
String f(Object o) { return null; }
Integer f(int i) { return null; }
<X extends Integer> X id() { return null; }
void m(List<Integer> lx) {
Integer i1 = f(!lx.isEmpty() ? 0 : lx.get(0)); //ok --> f(int)
Integer i2 = f(!lx.isEmpty() ? lx.get(0) : 0); //ok --> f(int)
f(!lx.isEmpty() ? id() : 0); // ambiguous
f(!lx.isEmpty() ? 0 : id()); // ambiguous
}
}