diff options
author | Ivan Frade <ifrade@google.com> | 2024-11-13 16:25:42 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2024-11-14 08:52:21 -0800 |
commit | c67393562be7e3db0e39cb2d3ff5f8192e2f2cd5 (patch) | |
tree | eff0e1ab28afc13b125c57f8a92fb0f854c50865 /org.eclipse.jgit | |
parent | bb1f95e5652969f649bb9092cde6c256ae2cb46a (diff) | |
download | jgit-c67393562be7e3db0e39cb2d3ff5f8192e2f2cd5.tar.gz jgit-c67393562be7e3db0e39cb2d3ff5f8192e2f2cd5.zip |
SystemReader#now: make it a concrete method
Abstract methods break subclasses (e.g. DelegateSystemReader in
gerrit). Updating jgit and gerrit is simpler if we do not add them. I
am not sure why some methods are abstract and others dont, but now()
can be a concrete method.
Make now() concrete. Implement it by default based on
getCurrentTime(), so subclasses overriding that method get the same
value.
Change-Id: I697749f8cba698c5388ed13ebdc2b238d6259358
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java | 6 |
1 files changed, 5 insertions, 1 deletions
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 18b0e152c9..7cdf0ee1a2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java @@ -532,7 +532,11 @@ public abstract class SystemReader { * * @since 7.1 */ - public abstract Instant now(); + public Instant now() { + // Subclasses overriding getCurrentTime should keep working + // TODO(ifrade): Once we remove getCurrentTime, use Instant.now() + return Instant.ofEpochMilli(getCurrentTime()); + } /** * Get clock instance preferred by this system. |