From 2f15177e56d6fff79a84f178bfb0b33c926ddece Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 9 Oct 2024 01:41:30 +0200 Subject: [PATCH] UploadPack: suppress resource warning for DepthWalk.RevWalk which borrows the ObjectReader from `walk` which is closed by UploadPack#close. Change-Id: Idb91f025c2872421702034381bb55d292d0e74ed --- .../src/org/eclipse/jgit/transport/UploadPack.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 3772c00819..8945f6e67f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -2369,7 +2369,8 @@ public class UploadPack implements Closeable { : req.getDepth() - 1; pw.setShallowPack(req.getDepth(), unshallowCommits); - // Ownership is transferred below + // dw borrows the reader from walk which is closed by #close + @SuppressWarnings("resource") DepthWalk.RevWalk dw = new DepthWalk.RevWalk( walk.getObjectReader(), walkDepth); dw.setDeepenSince(req.getDeepenSince()); -- 2.39.5