blob: 4fe59d73bbc885411f675b72ef296e16e9d4324a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import java.io.*;
public class TryResourcesAspect {
}
aspect Foo {
before(): execution(* *(..)) {
String src = "foo.txt";
String dest = "foocopy.txt";
try (
// InputStream in = new FileInputStream(src);
// OutputStream out = new FileOutputStream(dest))
MyCustomInputStream is = new MyCustomInputStream(src))
{
// code
}
}
static class MyCustomInputStream implements Closeable {
MyCustomInputStream(String src) {}
public void close() throws IOException {
}
}
}
|