Tue, 03 Jan 2012 11:37:00 -0800
4881269: improve diagnostic for ill-formed tokens
Reviewed-by: mcimadamore
mcimadamore@935 | 1 | /* |
mcimadamore@935 | 2 | * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
mcimadamore@935 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
mcimadamore@935 | 4 | * |
mcimadamore@935 | 5 | * This code is free software; you can redistribute it and/or modify it |
mcimadamore@935 | 6 | * under the terms of the GNU General Public License version 2 only, as |
mcimadamore@935 | 7 | * published by the Free Software Foundation. |
mcimadamore@935 | 8 | * |
mcimadamore@935 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
mcimadamore@935 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
mcimadamore@935 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mcimadamore@935 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
mcimadamore@935 | 13 | * accompanied this code). |
mcimadamore@935 | 14 | * |
mcimadamore@935 | 15 | * You should have received a copy of the GNU General Public License version |
mcimadamore@935 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
mcimadamore@935 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
mcimadamore@935 | 18 | * |
mcimadamore@935 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
mcimadamore@935 | 20 | * or visit www.oracle.com if you need additional information or have any |
mcimadamore@935 | 21 | * questions. |
mcimadamore@935 | 22 | */ |
mcimadamore@935 | 23 | |
mcimadamore@935 | 24 | // key: compiler.warn.unreachable.catch.1 |
mcimadamore@935 | 25 | |
mcimadamore@990 | 26 | import java.io.*; |
mcimadamore@990 | 27 | |
mcimadamore@935 | 28 | class UnreachableCatch1 { |
mcimadamore@935 | 29 | |
mcimadamore@935 | 30 | void test() { |
mcimadamore@935 | 31 | try { |
mcimadamore@990 | 32 | if (true) { |
mcimadamore@990 | 33 | throw new FileNotFoundException(); |
mcimadamore@990 | 34 | } |
mcimadamore@990 | 35 | else { |
mcimadamore@990 | 36 | throw new EOFException(); |
mcimadamore@990 | 37 | } |
mcimadamore@935 | 38 | } |
mcimadamore@990 | 39 | catch(FileNotFoundException fnf) { } |
mcimadamore@990 | 40 | catch(EOFException eof) { } |
mcimadamore@990 | 41 | catch(IOException ex) { } //unreachable |
mcimadamore@935 | 42 | } |
mcimadamore@935 | 43 | } |