View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
2   
3   import java.io.BufferedReader;
4   import java.io.IOException;
5   
6   class InputRightCurlyTryResource {
7       void test() throws IOException {
8           try (BufferedReader br1 = new BufferedReader(null);
9                   BufferedReader br2 = new BufferedReader(br1)) {
10              ;
11          }
12          catch (IOException e) {
13              ;
14          }
15          try (BufferedReader br1 = new BufferedReader(null);
16                  BufferedReader br2 = new BufferedReader(br1))
17          {
18              ;
19          } catch (IOException e)
20          {
21              ;
22          }
23          try (BufferedReader br1 = new BufferedReader(null);
24                  BufferedReader br2 = new BufferedReader(br1)) { ; }
25          catch (IOException e) { ; }
26          try (BufferedReader br1 = new BufferedReader(null);
27                  BufferedReader br2 = new BufferedReader(br1)) {} catch (IOException e) { ; }
28          try (BufferedReader br1 = new BufferedReader(null);
29                  BufferedReader br2 = new BufferedReader(br1)) {
30              ;
31          }
32          try (BufferedReader br1 = new BufferedReader(null);
33                  BufferedReader br2 = new BufferedReader(br1)) { ; }
34          try (BufferedReader br1 = new BufferedReader(null)) {
35              ; } // violation
36          try (BufferedReader br1 = new BufferedReader(null)) {
37              } int i; // violation
38      }
39  }