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

25 lines
569 B
Java

/*
* @test /nodynamiccopyright/
* @bug 4630634
* @summary missing warn about exception not thrown in try block if finally can't complete
* @author gafter
*
* @compile/fail/ref=ExceptionalFinally2.out -XDrawDiagnostics ExceptionalFinally2.java
*/
class ExceptionalFinally2 {
static class E extends Exception {}
public void t() throws E {}
void f() {
try {
try {
t();
} finally {
return;
}
} catch (E x) { // error: E can't be thrown in try block
}
}
}