test/tools/javac/TryWithResources/TwrMultiCatch.java

changeset 840
7f8794f9cc14
parent 609
13354e1abba7
child 2525
2eb010b6cb22
     1.1 --- a/test/tools/javac/TryWithResources/TwrMultiCatch.java	Mon Jan 24 16:38:56 2011 -0800
     1.2 +++ b/test/tools/javac/TryWithResources/TwrMultiCatch.java	Tue Jan 25 17:02:56 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,7 +23,7 @@
    1.11  
    1.12  /*
    1.13   * @test
    1.14 - * @bug 6911256 6964740
    1.15 + * @bug 6911256 6964740 7013420
    1.16   * @author Joseph D. Darcy
    1.17   * @summary Test that TWR and multi-catch play well together
    1.18   * @compile TwrMultiCatch.java
    1.19 @@ -48,9 +48,9 @@
    1.20  
    1.21      private static void test(TwrMultiCatch twrMultiCatch,
    1.22                       Class<? extends Exception> expected) {
    1.23 -        try(twrMultiCatch) {
    1.24 -            System.out.println(twrMultiCatch.toString());
    1.25 -        } catch (final CustomCloseException1 |
    1.26 +        try(TwrMultiCatch tmc = twrMultiCatch) {
    1.27 +            System.out.println(tmc.toString());
    1.28 +        } catch (CustomCloseException1 |
    1.29                   CustomCloseException2 exception) {
    1.30              if (!exception.getClass().equals(expected) ) {
    1.31                  throw new RuntimeException("Unexpected catch!");
    1.32 @@ -68,7 +68,7 @@
    1.33  
    1.34          try {
    1.35              throw t;
    1.36 -        } catch (final CustomCloseException1 |
    1.37 +        } catch (CustomCloseException1 |
    1.38                   CustomCloseException2 exception) {
    1.39              throw exception;
    1.40          } catch (Throwable throwable) {

mercurial