Browse Source

SubmoduleWalk#forIndex: Suppress resource warning and update Javadoc

SubmoduleWalk is auto-closeable, and Eclipse warns that is is not
managed by try-with-resource. However in this case the resource should
not be closed, because the caller needs to use it. Instead, it is the
responsibility of the caller to close it after use.

Update the Javadoc to clarify this, and suppress the warning.

Change-Id: Ib7ba349353bfd3341bdcbe4bb19abaeb9f3aeba5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.0
David Pursehouse 7 years ago
parent
commit
6344e7a071
  1. 4
      org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java

4
org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java

@ -115,11 +115,13 @@ public class SubmoduleWalk implements AutoCloseable {
* *
* @param repository * @param repository
* a {@link org.eclipse.jgit.lib.Repository} object. * a {@link org.eclipse.jgit.lib.Repository} object.
* @return generator over submodule index entries * @return generator over submodule index entries. The caller is responsible
* for calling {@link #close()}.
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public static SubmoduleWalk forIndex(Repository repository) public static SubmoduleWalk forIndex(Repository repository)
throws IOException { throws IOException {
@SuppressWarnings("resource") // The caller closes it
SubmoduleWalk generator = new SubmoduleWalk(repository); SubmoduleWalk generator = new SubmoduleWalk(repository);
try { try {
DirCache index = repository.readDirCache(); DirCache index = repository.readDirCache();

Loading…
Cancel
Save