1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.coding.onestatementperline;
10
11 import java.io.IOException;
12 import java.io.PipedOutputStream;
13 import java.io.OutputStream;
14
15
16
17
18 public class InputOneStatementPerLineTryWithResources {
19
20 void method() throws IOException {
21 OutputStream s1 = new PipedOutputStream();
22 OutputStream s2 = new PipedOutputStream();
23 try (s1; s2; OutputStream s3 = new PipedOutputStream();) {
24 }
25 try (s1; OutputStream s4 = new PipedOutputStream(); s2;) {
26 }
27 try (s1; s2; OutputStream s5 = new PipedOutputStream()) {
28 }
29 try (s1; OutputStream s6 = new PipedOutputStream(); s2) {
30 }
31 try (
32 OutputStream s7 = new PipedOutputStream();OutputStream s8 = new PipedOutputStream();
33 s2;
34 ) {}
35 try (
36 OutputStream s9=new PipedOutputStream();s2;OutputStream s10 = new PipedOutputStream())
37 {}
38 try (s1; OutputStream s11 = new PipedOutputStream();
39 s2;) {
40 }
41 try (OutputStream
42 s12 = new PipedOutputStream();s1;OutputStream s3 = new PipedOutputStream()
43 ;s2;) {
44 }
45 try (OutputStream
46 s12 = new PipedOutputStream();s1;OutputStream s3
47 = new PipedOutputStream()) {}
48 try (s1; s2; OutputStream stream3 =
49 new PipedOutputStream()) {}
50 try (OutputStream s10 = new PipedOutputStream();
51 OutputStream s11 = new PipedOutputStream(); s2;) {
52 }
53 }
54
55 void testNestedInLambda() {
56 Runnable r = () -> {
57 try (OutputStream s1 = new PipedOutputStream();
58 OutputStream s2 = new PipedOutputStream();) {
59 }
60 catch (IOException e) {
61 }
62 };
63 }
64 }