From: David Pursehouse Date: Tue, 13 Mar 2018 11:31:38 +0000 (+0900) Subject: SubmoduleWalk#forIndex: Suppress resource warning and update Javadoc X-Git-Tag: v5.0.0.201805151920-m7~82 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F119313%2F4;p=jgit.git 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 --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java index 0fc11f697c..211bbe8e54 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java @@ -115,11 +115,13 @@ public class SubmoduleWalk implements AutoCloseable { * * @param repository * 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 */ public static SubmoduleWalk forIndex(Repository repository) throws IOException { + @SuppressWarnings("resource") // The caller closes it SubmoduleWalk generator = new SubmoduleWalk(repository); try { DirCache index = repository.readDirCache();