Skip to content
Snippets Groups Projects
Commit c6739356 authored by Ivan Frade's avatar Ivan Frade
Browse files

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
parent bb1f95e5
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Duration; import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.HashMap; import java.util.HashMap;
...@@ -204,11 +203,6 @@ public long getCurrentTime() { ...@@ -204,11 +203,6 @@ public long getCurrentTime() {
return now; return now;
} }
@Override
public Instant now() {
return Instant.ofEpochMilli(now);
}
@Override @Override
public MonotonicClock getClock() { public MonotonicClock getClock() {
return () -> { return () -> {
......
...@@ -532,7 +532,11 @@ private void updateAll(Config config) ...@@ -532,7 +532,11 @@ private void updateAll(Config config)
* *
* @since 7.1 * @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. * Get clock instance preferred by this system.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment