From c64bc936938b1388065be1c89eb929278b505a87 Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Wed, 13 Nov 2024 11:58:06 -0800 Subject: [PATCH] SystemReader: Give a default implementation to #getTimezoneAt() This abstract method forces subclasses (e.g. DelegateSystemReader in gerrit) to update their code, but there is no strong reason to make it abstract (subclasses can override it if needed). Make the method concrete using the current default implementation (which is the same in the mock). Change-Id: Id1df0d71cab1d86879adf48e782f0050d3abcfa9 --- .../src/org/eclipse/jgit/junit/MockSystemReader.java | 5 ----- .../src/org/eclipse/jgit/util/SystemReader.java | 9 +++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java index b0365aa7e1..b0a1827265 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java @@ -244,11 +244,6 @@ public class MockSystemReader extends SystemReader { return getTimeZone().getOffset(when) / (60 * 1000); } - @Override - public ZoneOffset getTimeZoneAt(Instant when) { - return getTimeZoneId().getRules().getOffset(when); - } - @Override public TimeZone getTimeZone() { return TimeZone.getTimeZone("GMT-03:30"); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java index 7150e471bc..18b0e152c9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java @@ -178,11 +178,6 @@ public abstract class SystemReader { public int getTimezone(long when) { return getTimeZone().getOffset(when) / (60 * 1000); } - - @Override - public ZoneOffset getTimeZoneAt(Instant when) { - return getTimeZoneId().getRules().getOffset(when); - } } /** @@ -569,7 +564,9 @@ public abstract class SystemReader { * @return the local time zone * @since 7.1 */ - public abstract ZoneOffset getTimeZoneAt(Instant when); + public ZoneOffset getTimeZoneAt(Instant when) { + return getTimeZoneId().getRules().getOffset(when); + } /** * Get system time zone, possibly mocked for testing -- 2.39.5