aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2015-01-27 16:06:38 +0100
committerChristian Halstrick <christian.halstrick@sap.com>2015-02-09 14:11:50 +0100
commit77030a5e94a90cfae223acc477c216603cf3f149 (patch)
treef1e2ee0e77732687633ddf4aac7e60a111956ccb /org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
parent27ae8bc65553879000ae6a687dbe3a888160da98 (diff)
downloadjgit-77030a5e94a90cfae223acc477c216603cf3f149.tar.gz
jgit-77030a5e94a90cfae223acc477c216603cf3f149.zip
Implement AutoClosable interface on classes that used release()
Implement AutoClosable and deprecate the old release() method to give JGit consumers some time to adapt. Bug: 428039 Change-Id: Id664a91dc5a8cf2ac401e7d87ce2e3b89e221458 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
index 5c13ef3548..f05326900c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
@@ -66,7 +66,7 @@ import org.eclipse.jgit.transport.PackParser;
* {@link #release()} or {@link #flush()} prior to updating references or
* otherwise making the returned ObjectIds visible to other code.
*/
-public abstract class ObjectInserter {
+public abstract class ObjectInserter implements AutoCloseable {
/** An inserter that can be used for formatting and id generation only. */
public static class Formatter extends ObjectInserter {
@Override
@@ -420,7 +420,21 @@ public abstract class ObjectInserter {
* Release any resources used by this inserter.
* <p>
* An inserter that has been released can be used again, but may need to be
- * released after the subsequent usage.
+ * released after the subsequent usage. Use {@link #close()} instead
*/
+ @Deprecated
public abstract void release();
+
+ /**
+ * Release any resources used by this inserter.
+ * <p>
+ * An inserter that has been released can be used again, but may need to be
+ * released after the subsequent usage.
+ *
+ * @since 4.0
+ */
+ @Override
+ public void close() {
+ release();
+ }
}