From 5a5cd77bac7d73803584c3b5f7071b03739e12f1 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Mon, 30 Nov 2015 19:03:32 -0500 Subject: [PATCH] Temporarily restore Java 6 compatibility 3.6.5 will be the last ProtocolLib release supporting Java 6 --- .../com/comphenix/protocol/utility/Closer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java index cb25d7b5..290e0bee 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/utility/Closer.java @@ -16,6 +16,7 @@ */ package com.comphenix.protocol.utility; +import java.io.Closeable; import java.util.ArrayList; import java.util.List; @@ -23,30 +24,31 @@ import java.util.List; * @author dmulloy2 */ -public class Closer implements AutoCloseable { - private final List list; +// TODO Switch to AutoCloseable w/ Java 7 +public class Closer implements Closeable { + private final List list; private Closer() { - this.list = new ArrayList(); + this.list = new ArrayList(); } public static Closer create() { return new Closer(); } - public C register(C close) { + public C register(C close) { list.add(close); return close; } @Override public void close() { - for (AutoCloseable close : list) { + for (Closeable close : list) { closeQuietly(close); } } - public static void closeQuietly(AutoCloseable close) { + public static void closeQuietly(Closeable close) { try { close.close(); } catch (Throwable ex) { }