@@ -129,7 +129,7 @@ public Timeout asTimeout() {
129129     * timeout {@link #isInfinite()} before calling. 
130130     */ 
131131    private  long  remaining (final  TimeUnit  unit ) {
132-         if  (nanos  ==  null ) {
132+         if  (isInfinite () ) {
133133            throw  new  AssertionError ("Infinite TimePoints have infinite remaining time" );
134134        }
135135        long  remaining  = nanos  - currentNanos ();
@@ -146,7 +146,7 @@ private long remaining(final TimeUnit unit) {
146146     * @see #durationSince(TimePoint) 
147147     */ 
148148    public  Duration  elapsed () {
149-         if  (nanos  ==  null ) {
149+         if  (isInfinite () ) {
150150            throw  new  AssertionError ("No time can elapse since an infinite TimePoint" );
151151        }
152152        return  Duration .ofNanos (currentNanos () - nanos );
@@ -160,13 +160,13 @@ public Duration elapsed() {
160160     * @see #elapsed() 
161161     */ 
162162    Duration  durationSince (final  TimePoint  t ) {
163-         if  (nanos  ==  null ) {
163+         if  (this . isInfinite () ) {
164164            throw  new  AssertionError ("this timepoint is infinite, with no duration since" );
165165        }
166-         if  (t .nanos  ==  null ) {
166+         if  (t .isInfinite () ) {
167167            throw  new  AssertionError ("the other timepoint is infinite, with no duration until" );
168168        }
169-         return  Duration .ofNanos (nanos  - t .nanos );
169+         return  Duration .ofNanos (nanos  - assertNotNull ( t .nanos ) );
170170    }
171171
172172    /** 
@@ -189,7 +189,7 @@ public TimePoint timeoutAfterOrInfiniteIfNegative(final long timeoutValue, final
189189     * @param duration A duration that may also be {@linkplain Duration#isNegative() negative}. 
190190     */ 
191191    TimePoint  add (final  Duration  duration ) {
192-         if  (nanos  ==  null ) {
192+         if  (isInfinite () ) {
193193            throw  new  AssertionError ("No time can be added to an infinite TimePoint" );
194194        }
195195        long  durationNanos  = duration .toNanos ();
@@ -205,12 +205,12 @@ TimePoint add(final Duration duration) {
205205    public  int  compareTo (final  TimePoint  t ) {
206206        if  (Objects .equals (nanos , t .nanos )) {
207207            return  0 ;
208-         } else  if  (nanos  ==  null ) {
208+         } else  if  (this . isInfinite () ) {
209209            return  1 ;
210-         } else  if  (t .nanos  ==  null ) {
210+         } else  if  (t .isInfinite () ) {
211211            return  -1 ;
212212        }
213-         return  Long .signum (nanos  - t .nanos );
213+         return  Long .signum (nanos  - assertNotNull ( t .nanos ) );
214214    }
215215
216216    @ Override 
@@ -232,9 +232,9 @@ public int hashCode() {
232232
233233    @ Override 
234234    public  String  toString () {
235-         long  remainingMs  = nanos  ==  null 
236-                 ? - 1 
237-                 : TimeUnit .MILLISECONDS .convert (currentNanos () - nanos , NANOSECONDS );
235+         String  remainingMs  = isInfinite () 
236+                 ? "infinite" 
237+                 : ""  +  TimeUnit .MILLISECONDS .convert (currentNanos () - nanos , NANOSECONDS );
238238        return  "TimePoint{" 
239239                + "nanos="  + nanos 
240240                + "remainingMs="  + remainingMs 
0 commit comments