blob: 3d9b0a2fd8112889f8b6d49907b33682b201b1c6 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package com.siyeh.igtest.abstraction.weaken_type;
public class AutoClosableTest
{
public static class Foo
{
public void go() {}
}
public static class Bar extends Foo implements AutoCloseable
{
@Override
public void close() {}
}
public static void test()
{
try (Bar bar = new Bar()) {
bar.go();
}
}
}
class AutoClosableTest2
{
public static class Foo implements AutoCloseable
{
public void close() {}
public void go() {}
}
public static class Bar extends Foo {}
public static void test() {
try (Bar bar = new Bar()) {
bar.go();
}
}
void dodo() throws java.io.IOException {
try (java.io.Reader reader = new java.io.FileReader("/home/steve/foo.txt")) {
System.out.println(reader);
}
}
}
|