Skip to content

Commit 5a5cd77

Browse files
committed
Temporarily restore Java 6 compatibility
3.6.5 will be the last ProtocolLib release supporting Java 6
1 parent 1258342 commit 5a5cd77

File tree

1 file changed

+8
-6
lines changed
  • ProtocolLib/src/main/java/com/comphenix/protocol/utility

1 file changed

+8
-6
lines changed

ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,39 @@
1616
*/
1717
package com.comphenix.protocol.utility;
1818

19+
import java.io.Closeable;
1920
import java.util.ArrayList;
2021
import java.util.List;
2122

2223
/**
2324
* @author dmulloy2
2425
*/
2526

26-
public class Closer implements AutoCloseable {
27-
private final List<AutoCloseable> list;
27+
// TODO Switch to AutoCloseable w/ Java 7
28+
public class Closer implements Closeable {
29+
private final List<Closeable> list;
2830

2931
private Closer() {
30-
this.list = new ArrayList<AutoCloseable>();
32+
this.list = new ArrayList<Closeable>();
3133
}
3234

3335
public static Closer create() {
3436
return new Closer();
3537
}
3638

37-
public <C extends AutoCloseable> C register(C close) {
39+
public <C extends Closeable> C register(C close) {
3840
list.add(close);
3941
return close;
4042
}
4143

4244
@Override
4345
public void close() {
44-
for (AutoCloseable close : list) {
46+
for (Closeable close : list) {
4547
closeQuietly(close);
4648
}
4749
}
4850

49-
public static void closeQuietly(AutoCloseable close) {
51+
public static void closeQuietly(Closeable close) {
5052
try {
5153
close.close();
5254
} catch (Throwable ex) { }

0 commit comments

Comments
 (0)