From 6344e7a0718f722b5b4f9f72b2ea83c0c4dc892b Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Tue, 13 Mar 2018 20:31:38 +0900 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/submodule/SubmoduleWalk.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 0fc11f697..211bbe8e5 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();