author | sogoel |
Thu, 05 Jun 2014 10:57:10 -0700 | |
changeset 24797 | 850ebd4d80a7 |
parent 21714 | f5b7edec4304 |
child 27844 | 8b5d79870a2f |
permissions | -rw-r--r-- |
21714
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
1 |
/* |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
3 |
* @bug 8025113 |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
4 |
* @author sogoel |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
5 |
* @summary Resources cannot be declared outside t-w-r block |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
6 |
* @compile/fail/ref=ResDeclOutsideTry.out -XDrawDiagnostics ResDeclOutsideTry.java |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
7 |
*/ |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
8 |
|
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
9 |
public class ResDeclOutsideTry implements AutoCloseable { |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
10 |
ResDeclOutsideTry tr1; |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
11 |
ResDeclOutsideTry tr2 = new ResDeclOutsideTry(); |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
12 |
|
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
13 |
String test1() { |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
14 |
try (tr1 = new ResDeclOutsideTry(); tr2;) { |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
15 |
} |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
16 |
} |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
17 |
} |
f5b7edec4304
8025113: Convert 7 tools TryWithResources tests to jtreg format
sogoel
parents:
diff
changeset
|
18 |