test/tools/javac/diags/examples/UnreachableCatch1.java

changeset 990
9a847a77205d
parent 935
5b29f2a85085
child 2525
2eb010b6cb22
equal deleted inserted replaced
989:4c03383f6529 990:9a847a77205d
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 // key: compiler.warn.unreachable.catch.1 24 // key: compiler.warn.unreachable.catch.1
25 25
26 import java.io.*;
27
26 class UnreachableCatch1 { 28 class UnreachableCatch1 {
27 29
28 void test() { 30 void test() {
29 try { 31 try {
30 throw new IllegalArgumentException(); 32 if (true) {
33 throw new FileNotFoundException();
34 }
35 else {
36 throw new EOFException();
37 }
31 } 38 }
32 catch(Error err) { } 39 catch(FileNotFoundException fnf) { }
33 catch(RuntimeException rex) { } 40 catch(EOFException eof) { }
34 catch(Throwable t) { } //unreachable 41 catch(IOException ex) { } //unreachable
35 } 42 }
36 } 43 }

mercurial