Browse Source

Remove AutoCloseable from internal PackFile and friends

PackFile is held by the block cache and cannot be auto closed in a
try-with-resources statement.  Remove the interface as JGit does
explicit management of the instances.

ObjectDatabase and RefDatabase are internal details of Repository
and are managed with the Repository. Marking them AutoCloseable
provides no value to the library or an application using the API.

Change-Id: Ibee19eadd66233e6666b601583daa1834a7778f1
stable-4.0
Shawn Pearce 10 years ago
parent
commit
7ab6ffdf50
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
  2. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
  3. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
  4. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java

@ -88,7 +88,7 @@ import org.eclipse.jgit.util.LongList;
* delta packed format yielding high compression of lots of object where some * delta packed format yielding high compression of lots of object where some
* objects are similar. * objects are similar.
*/ */
public final class DfsPackFile implements AutoCloseable { public final class DfsPackFile {
/** /**
* File offset used to cache {@link #index} in {@link DfsBlockCache}. * File offset used to cache {@link #index} in {@link DfsBlockCache}.
* <p> * <p>

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java

@ -89,8 +89,7 @@ import org.eclipse.jgit.util.RawParseUtils;
* delta packed format yielding high compression of lots of object where some * delta packed format yielding high compression of lots of object where some
* objects are similar. * objects are similar.
*/ */
public class PackFile implements Iterable<PackIndex.MutableEntry>, public class PackFile implements Iterable<PackIndex.MutableEntry> {
AutoCloseable {
/** Sorts PackFiles to be most recently created to least recently created. */ /** Sorts PackFiles to be most recently created to least recently created. */
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() { public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
public int compare(final PackFile a, final PackFile b) { public int compare(final PackFile a, final PackFile b) {

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java

@ -54,7 +54,7 @@ import org.eclipse.jgit.errors.MissingObjectException;
* An object database stores one or more Git objects, indexed by their unique * An object database stores one or more Git objects, indexed by their unique
* {@link ObjectId}. * {@link ObjectId}.
*/ */
public abstract class ObjectDatabase implements AutoCloseable { public abstract class ObjectDatabase {
/** Initialize a new database instance for access. */ /** Initialize a new database instance for access. */
protected ObjectDatabase() { protected ObjectDatabase() {
// Protected to force extension. // Protected to force extension.

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java

@ -57,7 +57,7 @@ import java.util.Map;
* Every {@link Repository} has a single reference database, mapping names to * Every {@link Repository} has a single reference database, mapping names to
* the tips of the object graph contained by the {@link ObjectDatabase}. * the tips of the object graph contained by the {@link ObjectDatabase}.
*/ */
public abstract class RefDatabase implements AutoCloseable { public abstract class RefDatabase {
/** /**
* Order of prefixes to search when using non-absolute references. * Order of prefixes to search when using non-absolute references.
* <p> * <p>

Loading…
Cancel
Save