java-topology/test/langtools/tools/javac/multicatch/7030606/T7030606.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

57 lines
1 KiB
Java

/*
* @test /nodynamiccopyright/
* @bug 7030606
*
* @summary Project-coin: multi-catch types should be pairwise disjoint
* @compile/fail/ref=T7030606.out -XDrawDiagnostics T7030606.java
*/
class T7030606 {
class E1 extends Exception { }
class E2 extends E1 { }
void e1() throws E1 { }
void e2() throws E2 { }
void m1() {
try {
e1();
e2();
} catch (NonExistentType | E2 | E1 e) { }
}
void m2() {
try {
e1();
e2();
} catch (NonExistentType | E1 | E2 e) { }
}
void m3() {
try {
e1();
e2();
} catch (E2 | NonExistentType | E1 e) { }
}
void m4() {
try {
e1();
e2();
} catch (E1 | NonExistentType | E2 e) { }
}
void m5() {
try {
e1();
e2();
} catch (E2 | E1 | NonExistentType e) { }
}
void m6() {
try {
e1();
e2();
} catch (E1 | E2 | NonExistentType e) { }
}
}