jdk-24/langtools/test/tools/javac/multicatch/Neg01eff_final.java
Maurizio Cimadamore d4d5f60edc 6993963: Project Coin: Use precise exception analysis for effectively final catch parameters
More precise rethrow analysis should be extended to effectively-final exception parameters. Multicatch parameters should be made implicitly final.

Reviewed-by: jjg, darcy
2010-11-04 12:57:48 +00:00

29 lines
722 B
Java

/*
* @test /nodynamiccopyright/
* @bug 6943289
*
* @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
* @author darcy
* @compile/fail/ref=Neg01eff_final.out -XDrawDiagnostics Neg01eff_final.java
* @compile -source 6 -XDrawDiagnostics Neg01eff_final.java
*
*/
class Neg01eff_final {
static class A extends Exception {}
static class B1 extends A {}
static class B2 extends A {}
class Test {
void m() throws A {
try {
throw new B1();
} catch (A ex1) {
try {
throw ex1; // used to throw A, now throws B1!
} catch (B2 ex2) { }//unreachable
}
}
}
}