aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
diff options
context:
space:
mode:
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();
+ }
}