From 1ed38b81be368465f86c0f02113a5ec06d3cac96 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Fri, 26 Apr 2024 14:04:08 -0700 Subject: [PATCH] PackIndex: Make #getOffset protected to allow out-of-package subclasses PackIndex#getOffset is abstract and package-private, limiting subclasses to the same package. Given than the class and all other relevant methods are public, this looks like an oversight and it should be ok to write subclasses in other packages. Make the method protected, allowing to write PackIndex subclasses in other packages. Change-Id: I7d3762b0a6c0681c29bd827bbaf094f1ee4583d2 --- .../src/org/eclipse/jgit/internal/storage/file/PackIndex.java | 2 +- .../src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java index c42d1c8866..c2c3775d67 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java @@ -228,7 +228,7 @@ public abstract class PackIndex * etc. Positions past 2**31-1 are negative, but still valid. * @return the offset in a pack for the corresponding entry. */ - abstract long getOffset(long nthPosition); + protected abstract long getOffset(long nthPosition); /** * Locate the file offset position for the requested object. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java index 4563c9039c..5180df46bf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java @@ -118,7 +118,7 @@ class PackIndexV1 extends PackIndex { } @Override - long getOffset(long nthPosition) { + protected long getOffset(long nthPosition) { final int levelOne = findLevelOne(nthPosition); final int levelTwo = getLevelTwo(nthPosition, levelOne); final int p = (4 + Constants.OBJECT_ID_LENGTH) * levelTwo; -- 2.39.5