java-topology/test/langtools/tools/javac/patterns/T8329115.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

20 lines
547 B
Java

/**
* @test /nodynamiccopyright/
* @bug 8329115
* @summary Crash involving return from inner switch
* @compile/fail/ref=T8329115.out -XDrawDiagnostics -XDdev T8329115.java
*/
public class T8329115 {
record R1() {}
record R2() {}
int test() {
return switch (new R1()) {
case R1() -> {
return switch (new R2()) { // crashes, instead it should just be the error: attempt to return out of a switch expression
case R2() -> 1;
};
}
};
}
}