test/tools/javac/TryWithResources/DuplicateResource.java

changeset 840
7f8794f9cc14
parent 609
13354e1abba7
child 1013
8eb952f43b11
     1.1 --- a/test/tools/javac/TryWithResources/DuplicateResource.java	Mon Jan 24 16:38:56 2011 -0800
     1.2 +++ b/test/tools/javac/TryWithResources/DuplicateResource.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,9 +23,9 @@
    1.11  
    1.12  /*
    1.13   * @test
    1.14 - * @bug 6911256 6964740 6965277
    1.15 + * @bug 6911256 6964740 6965277 7013420
    1.16   * @author Maurizio Cimadamore
    1.17 - * @summary Check that lowered arm block does not end up creating resource twice
    1.18 + * @summary Check that lowered try-with-resources block does not end up creating resource twice
    1.19   */
    1.20  
    1.21  import java.util.ArrayList;
    1.22 @@ -45,7 +45,7 @@
    1.23      static ArrayList<TestResource> resources = new ArrayList<TestResource>();
    1.24  
    1.25      public static void main(String[] args) {
    1.26 -        try(new TestResource()) {
    1.27 +        try(TestResource tr = new TestResource()) {
    1.28             //do something
    1.29          } catch (Exception e) {
    1.30              throw new AssertionError("Shouldn't reach here", e);
    1.31 @@ -59,7 +59,7 @@
    1.32         }
    1.33         TestResource resource = resources.get(0);
    1.34         if (!resource.isClosed) {
    1.35 -           throw new AssertionError("Resource used in ARM block has not been automatically closed");
    1.36 +           throw new AssertionError("Resource used in try-with-resources block has not been automatically closed");
    1.37         }
    1.38      }
    1.39  }

mercurial