mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 06:44:16 +00:00
Dealt with several compiler notices by verifying and then fixing or suppressing. Reduces compilation output noise.
This commit is contained in:
parent
cc6090af88
commit
c08c68fc5e
@ -664,9 +664,9 @@ public class Peer extends PeerSocketHandler {
|
||||
log.info("{}: Downloading dependencies of {}", getAddress(), tx.getHashAsString());
|
||||
final LinkedList<Transaction> results = new LinkedList<Transaction>();
|
||||
// future will be invoked when the entire dependency tree has been walked and the results compiled.
|
||||
final ListenableFuture future = downloadDependenciesInternal(tx, new Object(), results);
|
||||
final ListenableFuture<Object> future = downloadDependenciesInternal(tx, new Object(), results);
|
||||
final SettableFuture<List<Transaction>> resultFuture = SettableFuture.create();
|
||||
Futures.addCallback(future, new FutureCallback() {
|
||||
Futures.addCallback(future, new FutureCallback<Object>() {
|
||||
public void onSuccess(Object ignored) {
|
||||
resultFuture.set(results);
|
||||
}
|
||||
@ -1083,6 +1083,10 @@ public class Peer extends PeerSocketHandler {
|
||||
* If you want the block right away and don't mind waiting for it, just call .get() on the result. Your thread
|
||||
* will block until the peer answers.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// The 'unchecked conversion' warning being suppressed here comes from the sendSingleGetData() formally returning
|
||||
// ListenableFuture instead of ListenableFuture<Block>. This is okay as sendSingleGetData() actually returns
|
||||
// ListenableFuture<Block> in this context. Note that sendSingleGetData() is also used for Transactions.
|
||||
public ListenableFuture<Block> getBlock(Sha256Hash blockHash) {
|
||||
// This does not need to be locked.
|
||||
log.info("Request to fetch block {}", blockHash);
|
||||
@ -1096,6 +1100,10 @@ public class Peer extends PeerSocketHandler {
|
||||
* retrieved this way because peers don't have a transaction ID to transaction-pos-on-disk index, and besides,
|
||||
* in future many peers will delete old transaction data they don't need.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// The 'unchecked conversion' warning being suppressed here comes from the sendSingleGetData() formally returning
|
||||
// ListenableFuture instead of ListenableFuture<Transaction>. This is okay as sendSingleGetData() actually returns
|
||||
// ListenableFuture<Transaction> in this context. Note that sendSingleGetData() is also used for Blocks.
|
||||
public ListenableFuture<Transaction> getPeerMempoolTransaction(Sha256Hash hash) {
|
||||
// This does not need to be locked.
|
||||
// TODO: Unit test this method.
|
||||
|
@ -122,6 +122,9 @@ public class ProtobufParser<MessageType extends MessageLite> extends AbstractTim
|
||||
|
||||
// Deserializes and provides a listener event (buff must not have the length prefix in it)
|
||||
// Does set the buffers's position to its limit
|
||||
@SuppressWarnings("unchecked")
|
||||
// The warning 'unchecked cast' being suppressed here comes from the build() formally returning
|
||||
// a MessageLite-derived class that cannot be statically guaranteed to be the MessageType.
|
||||
private void deserializeMessage(ByteBuffer buff) throws Exception {
|
||||
MessageType msg = (MessageType) prototype.newBuilderForType().mergeFrom(ByteString.copyFrom(buff)).build();
|
||||
resetTimeout();
|
||||
|
@ -44,10 +44,13 @@ public abstract class ServerConnectionEventHandler {
|
||||
* {@link StoredPaymentChannelServerStates#getChannel(com.google.bitcoin.core.Sha256Hash)} with the id provided in
|
||||
* {@link ServerConnectionEventHandler#channelOpen(com.google.bitcoin.core.Sha256Hash)}</p>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// The warning 'unchecked call to write(MessageType)' being suppressed here comes from the build()
|
||||
// formally returning MessageLite-derived class that cannot be statically guaranteed to be the same MessageType
|
||||
// that is used in connectionChannel.
|
||||
protected final synchronized void closeChannel() {
|
||||
if (connectionChannel == null)
|
||||
throw new IllegalStateException("Channel is not fully initialized/has already been closed");
|
||||
|
||||
connectionChannel.write(Protos.TwoWayChannelMessage.newBuilder()
|
||||
.setType(Protos.TwoWayChannelMessage.MessageType.CLOSE)
|
||||
.build());
|
||||
|
@ -765,7 +765,7 @@ public class PostgresFullPrunedBlockStore implements FullPrunedBlockStore {
|
||||
// Calculate the toAddress (if any)
|
||||
String dbAddress = "";
|
||||
int type = 0;
|
||||
Script outputScript = null;
|
||||
Script outputScript = null;
|
||||
try
|
||||
{
|
||||
outputScript = new Script(out.getScriptBytes());
|
||||
|
@ -335,6 +335,8 @@ public class WalletTest extends TestWithWallet {
|
||||
assertTrue(depthFuture.isDone());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
// Having a test for deprecated method getFromAddress() is no evil so we suppress the warning here.
|
||||
private void basicSanityChecks(Wallet wallet, Transaction t, Address fromAddress, Address destination) throws VerificationException {
|
||||
assertEquals("Wrong number of tx inputs", 1, t.getInputs().size());
|
||||
assertEquals(fromAddress, t.getInputs().get(0).getScriptSig().getFromAddress(params));
|
||||
@ -389,6 +391,8 @@ public class WalletTest extends TestWithWallet {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
// Having a test for deprecated method getFromAddress() is no evil so we suppress the warning here.
|
||||
public void customTransactionSpending() throws Exception {
|
||||
// We'll set up a wallet that receives a coin, then sends a coin of lesser value and keeps the change.
|
||||
BigInteger v1 = Utils.toNanoCoins(3, 0);
|
||||
|
@ -82,7 +82,7 @@ public class PrintPeers {
|
||||
for (final InetAddress addr : addrs) {
|
||||
InetSocketAddress address = new InetSocketAddress(addr, params.getPort());
|
||||
final Peer peer = new Peer(params, new VersionMessage(params, 0), null, new PeerAddress(address));
|
||||
final SettableFuture future = SettableFuture.create();
|
||||
final SettableFuture<Void> future = SettableFuture.create();
|
||||
// Once the connection has completed version handshaking ...
|
||||
peer.addEventListener(new AbstractPeerEventListener() {
|
||||
public void onPeerConnected(Peer p, int peerCount) {
|
||||
|
Loading…
Reference in New Issue
Block a user