author | mcimadamore |
Mon, 03 May 2010 17:12:59 -0700 | |
changeset 5492 | 515e4b33b335 |
permissions | -rw-r--r-- |
5492
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
1 |
/* |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
3 |
* @bug 6943289 |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
4 |
* |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
5 |
* @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
6 |
* @author mcimadamore |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
7 |
* @compile/fail/ref=Neg04.out -XDrawDiagnostics Neg04.java |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
8 |
* |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
9 |
*/ |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
10 |
|
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
11 |
class Neg04 { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
12 |
static class A extends Exception {} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
13 |
static class B extends Exception {} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
14 |
|
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
15 |
void test() throws B { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
16 |
try { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
17 |
if (true) { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
18 |
throw new A(); |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
19 |
} else if (false) { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
20 |
throw new B(); |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
21 |
} else { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
22 |
throw (Throwable)new Exception(); |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
23 |
} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
24 |
} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
25 |
catch (A e) {} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
26 |
catch (final Exception e) { |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
27 |
throw e; |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
28 |
} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
29 |
catch (Throwable t) {} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
30 |
} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
diff
changeset
|
31 |
} |