Thu, 03 Feb 2011 09:36:28 +0000
5017953: spurious cascaded diagnostics when name not found
Summary: when an operator is applied to one or more erroneous operands, spurious diagnostics are generated
Reviewed-by: jjg
darcy@609 | 1 | /* |
darcy@609 | 2 | * @test /nodynamiccopyright/ |
darcy@840 | 3 | * @bug 6911256 6964740 7013420 |
darcy@609 | 4 | * @author Joseph D. Darcy |
darcy@840 | 5 | * @summary Test exception analysis of try-with-resources blocks |
darcy@609 | 6 | * @compile/fail/ref=TwrFlow.out -XDrawDiagnostics TwrFlow.java |
darcy@609 | 7 | */ |
darcy@609 | 8 | |
darcy@609 | 9 | import java.io.IOException; |
darcy@609 | 10 | public class TwrFlow implements AutoCloseable { |
darcy@609 | 11 | public static void main(String... args) { |
darcy@840 | 12 | try(TwrFlow twrFlow = new TwrFlow()) { |
darcy@840 | 13 | System.out.println(twrFlow.toString()); |
darcy@609 | 14 | } catch (IOException ioe) { // Not reachable |
darcy@609 | 15 | throw new AssertionError("Shouldn't reach here", ioe); |
darcy@609 | 16 | } |
darcy@609 | 17 | // CustomCloseException should be caught or added to throws clause |
darcy@609 | 18 | } |
darcy@609 | 19 | |
darcy@609 | 20 | /* |
darcy@609 | 21 | * A close method, but the class is <em>not</em> Closeable or |
darcy@609 | 22 | * AutoCloseable. |
darcy@609 | 23 | */ |
darcy@609 | 24 | public void close() throws CustomCloseException { |
darcy@609 | 25 | throw new CustomCloseException(); |
darcy@609 | 26 | } |
darcy@609 | 27 | } |
darcy@609 | 28 | |
darcy@609 | 29 | class CustomCloseException extends Exception {} |