base, core: remove all references to java.util.Date

This also removes deprecated members.
This commit is contained in:
Andreas Schildbach 2023-03-10 11:56:16 +01:00
parent 34627259df
commit c43ef27167
14 changed files with 0 additions and 104 deletions

View File

@ -24,7 +24,6 @@ import org.junit.Test;
import java.time.Duration;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

View File

@ -42,7 +42,6 @@ import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
@ -1066,12 +1065,6 @@ public abstract class AbstractBlockChain {
}
}
/** @deprecated use {@link #estimateBlockTimeInstant(int)} */
@Deprecated
public Date estimateBlockTime(int height) {
return Date.from(estimateBlockTimeInstant(height));
}
/**
* Returns a future that completes when the block chain has reached the given height. Yields the
* {@link StoredBlock} of the block that reaches that height first. The future completes on a peer thread.

View File

@ -48,7 +48,6 @@ import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
@ -739,15 +738,6 @@ public class Block extends BaseMessage {
return time.getEpochSecond();
}
/**
* Returns the time at which the block was solved and broadcast, according to the clock of the solving node.
* @deprecated use {@link #time()}
*/
@Deprecated
public Date getTime() {
return Date.from(time());
}
// For testing only
void setTime(Instant time) {
unCacheHeader();

View File

@ -59,7 +59,6 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@ -569,12 +568,6 @@ public class Transaction extends BaseMessage {
return Optional.ofNullable(updateTime);
}
/** @deprecated use {@link #updateTime()} */
@Deprecated
public Date getUpdateTime() {
return Date.from(updateTime().orElse(Instant.EPOCH));
}
/**
* Sets the update time of this transaction.
* @param updateTime update time
@ -590,15 +583,6 @@ public class Transaction extends BaseMessage {
this.updateTime = null;
}
/** @deprecated use {@link #setUpdateTime(Instant)} or {@link #clearUpdateTime()} */
@Deprecated
public void setUpdateTime(Date updateTime) {
if (updateTime != null && updateTime.getTime() > 0)
setUpdateTime(updateTime.toInstant());
else
clearUpdateTime();
}
/**
* These constants are a part of a scriptSig signature on the inputs. They define the details of how a
* transaction can be redeemed, specifically, they control how the hash of the transaction is calculated.
@ -1737,12 +1721,6 @@ public class Transaction extends BaseMessage {
((TimeLock) locktime).timestamp();
}
/** @deprecated use {@link #estimateUnlockTime(AbstractBlockChain)} */
@Deprecated
public Date estimateLockTime(AbstractBlockChain chain) {
return Date.from(estimateUnlockTime(chain));
}
/**
* Returns the purpose for which this transaction was created. See the javadoc for {@link Purpose} for more
* information on the point of this field and what it can be.

View File

@ -30,7 +30,6 @@ import org.bitcoinj.wallet.Wallet;
import javax.annotation.Nullable;
import java.time.Instant;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
import java.util.Objects;
@ -347,13 +346,6 @@ public class TransactionConfidence {
return Optional.ofNullable(lastBroadcastTime);
}
/** @deprecated use {@link #getLastBroadcastTime()} */
@Deprecated
@Nullable
public Date getLastBroadcastedAt() {
return lastBroadcastTime != null ? Date.from(lastBroadcastTime) : null;
}
/**
* Set the time the transaction was last announced to us.
* @param lastBroadcastTime time the transaction was last announced to us
@ -362,12 +354,6 @@ public class TransactionConfidence {
this.lastBroadcastTime = Objects.requireNonNull(lastBroadcastTime);
}
/** @deprecated use {@link #setLastBroadcastTime(Instant)} */
@Deprecated
public void setLastBroadcastedAt(Date lastBroadcastedAt) {
setLastBroadcastTime(lastBroadcastedAt.toInstant());
}
@Override
public synchronized String toString() {
StringBuilder builder = new StringBuilder();

View File

@ -27,7 +27,6 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.time.Instant;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

View File

@ -45,7 +45,6 @@ import java.net.URL;
import java.security.KeyStoreException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@ -261,12 +260,6 @@ public class PaymentSession {
return Instant.ofEpochSecond(paymentDetails.getTime());
}
/** @deprecated use {@link #time()} */
@Deprecated
public Date getDate() {
return Date.from(time());
}
/**
* Returns the expires time of the payment request, or empty if none.
*/
@ -277,15 +270,6 @@ public class PaymentSession {
return Optional.empty();
}
/** @deprecated use {@link #expires()} */
@Nullable
@Deprecated
public Date getExpires() {
return expires()
.map(Date::from)
.orElse(null);
}
/**
* This should always be called before attempting to call sendPayment.
*/

View File

@ -24,7 +24,6 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;

View File

@ -118,7 +118,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@ -3885,13 +3884,6 @@ public class Wallet extends BaseTaggableObject
return lastBlockSeenTime().map(Instant::getEpochSecond).orElse((long) 0);
}
/** @deprecated use {@link #lastBlockSeenTime()} */
@Deprecated
@Nullable
public Date getLastBlockSeenTime() {
return lastBlockSeenTime().map(Date::from).orElse(null);
}
/**
* Returns the height of the last seen best-chain block. Can be 0 if a wallet is brand new or -1 if the wallet
* is old and doesn't have that data.
@ -5684,15 +5676,6 @@ public class Wallet extends BaseTaggableObject
setKeyRotationTime(Instant.ofEpochSecond(timeSecs));
}
/** @deprecated use {@link #setKeyRotationTime(Instant)} */
@Deprecated
public void setKeyRotationTime(@Nullable Date time) {
if (time == null)
setKeyRotationTime((Instant) null);
else
setKeyRotationTime(Instant.ofEpochMilli(time.getTime()));
}
/**
* Returns the key rotation time, or empty if unconfigured. See {@link #setKeyRotationTime(Instant)} for a description
* of the field.
@ -5701,16 +5684,6 @@ public class Wallet extends BaseTaggableObject
return Optional.ofNullable(vKeyRotationTime);
}
/** @deprecated use {@link #keyRotationTime()} */
@Deprecated
public @Nullable Date getKeyRotationTime() {
Instant keyRotationTime = vKeyRotationTime;
if (keyRotationTime != null)
return Date.from(keyRotationTime);
else
return null;
}
/** Returns whether the keys creation time is before the key rotation time, if one was set. */
public boolean isKeyRotating(ECKey key) {
Instant keyRotationTime = vKeyRotationTime;

View File

@ -30,7 +30,6 @@ import java.io.IOException;
import java.sql.Time;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledThreadPoolExecutor;

View File

@ -60,7 +60,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;

View File

@ -47,7 +47,6 @@ import java.nio.ByteBuffer;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.SortedSet;

View File

@ -44,7 +44,6 @@ import java.net.URL;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

View File

@ -35,7 +35,6 @@ import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;