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
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Duration;
-import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.HashMap;
return now;
}
- @Override
- public Instant now() {
- return Instant.ofEpochMilli(now);
- }
-
@Override
public MonotonicClock getClock() {
return () -> {
*
* @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.