3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 02:35:52 +00:00

remove redundant modifiers

This commit is contained in:
Carsten Otto 2015-07-04 18:24:09 +02:00
parent 25c4554760
commit b736b4f7b0
24 changed files with 89 additions and 85 deletions

View File

@ -31,7 +31,7 @@ public interface PeerEventListener {
*
* @param peerAddresses the set of discovered {@link PeerAddress}es
*/
public void onPeersDiscovered(Set<PeerAddress> peerAddresses);
void onPeersDiscovered(Set<PeerAddress> peerAddresses);
// TODO: Fix the Block/FilteredBlock type hierarchy so we can avoid the stupid typeless API here.
/**
@ -45,7 +45,7 @@ public interface PeerEventListener {
* @param filteredBlock if non-null, the object that wraps the block header passed as the block param.
* @param blocksLeft the number of blocks left to download
*/
public void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft);
void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft);
/**
* Called when a download is started with the initial number of blocks to be downloaded.
@ -53,7 +53,7 @@ public interface PeerEventListener {
* @param peer the peer receiving the block
* @param blocksLeft the number of blocks left to download
*/
public void onChainDownloadStarted(Peer peer, int blocksLeft);
void onChainDownloadStarted(Peer peer, int blocksLeft);
/**
* Called when a peer is connected. If this listener is registered to a {@link Peer} instead of a {@link PeerGroup},
@ -62,7 +62,7 @@ public interface PeerEventListener {
* @param peer
* @param peerCount the total number of connected peers
*/
public void onPeerConnected(Peer peer, int peerCount);
void onPeerConnected(Peer peer, int peerCount);
/**
* Called when a peer is disconnected. Note that this won't be called if the listener is registered on a
@ -73,7 +73,7 @@ public interface PeerEventListener {
* @param peer
* @param peerCount the total number of connected peers
*/
public void onPeerDisconnected(Peer peer, int peerCount);
void onPeerDisconnected(Peer peer, int peerCount);
/**
* <p>Called when a message is received by a peer, before the message is processed. The returned message is
@ -84,12 +84,12 @@ public interface PeerEventListener {
* <p>Note that this will never be called if registered with any executor other than
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
*/
public Message onPreMessageReceived(Peer peer, Message m);
Message onPreMessageReceived(Peer peer, Message m);
/**
* Called when a new transaction is broadcast over the network.
*/
public void onTransaction(Peer peer, Transaction t);
void onTransaction(Peer peer, Transaction t);
/**
* <p>Called when a peer receives a getdata message, usually in response to an "inv" being broadcast. Return as many
@ -99,5 +99,5 @@ public interface PeerEventListener {
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
*/
@Nullable
public List<Message> getData(Peer peer, GetDataMessage m);
List<Message> getData(Peer peer, GetDataMessage m);
}

View File

@ -28,7 +28,7 @@ public interface PeerFilterProvider {
* Blocks with timestamps before this time will only have headers downloaded. 0 requires that all blocks be
* downloaded, and thus this should default to {@link System#currentTimeMillis()}/1000.
*/
public long getEarliestKeyCreationTime();
long getEarliestKeyCreationTime();
/**
* Called on all registered filter providers before getBloomFilterElementCount and getBloomFilter are called.
@ -37,23 +37,23 @@ public interface PeerFilterProvider {
* all of them will be specified. So the provider must use consistent state. There is guaranteed to be a matching
* call to endBloomFilterCalculation that can be used to e.g. unlock a lock.
*/
public void beginBloomFilterCalculation();
void beginBloomFilterCalculation();
/**
* Gets the number of elements that will be added to a bloom filter returned by
* {@link PeerFilterProvider#getBloomFilter(int, double, long)}
*/
public int getBloomFilterElementCount();
int getBloomFilterElementCount();
/**
* Gets a bloom filter that contains all the necessary elements for the listener to receive relevant transactions.
* Default value should be an empty bloom filter with the given size, falsePositiveRate, and nTweak.
*/
public BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak);
BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak);
/** Whether this filter provider depends on the server updating the filter on all matches */
public boolean isRequiringUpdateAllBloomFilter();
boolean isRequiringUpdateAllBloomFilter();
public void endBloomFilterCalculation();
void endBloomFilterCalculation();
}

View File

@ -1056,7 +1056,7 @@ public class PeerGroup implements TransactionBroadcaster {
}
}
public static enum FilterRecalculateMode {
public enum FilterRecalculateMode {
SEND_IF_CHANGED,
FORCE_SEND_FOR_REFRESH,
DONT_SEND,

View File

@ -26,7 +26,7 @@ public class RejectMessage extends Message {
private static final long serialVersionUID = -5246995579800334336L;
private String message, reason;
public static enum RejectCode {
public enum RejectCode {
/** The message was not able to be parsed */
MALFORMED((byte) 0x01),
/** The message described an invalid object */

View File

@ -26,17 +26,17 @@ import java.util.Map;
*/
public interface TransactionBag {
/** Returns true if this wallet contains a public key which hashes to the given hash. */
public boolean isPubKeyHashMine(byte[] pubkeyHash);
boolean isPubKeyHashMine(byte[] pubkeyHash);
/** Returns true if this wallet is watching transactions for outputs with the script. */
public boolean isWatchedScript(Script script);
boolean isWatchedScript(Script script);
/** Returns true if this wallet contains a keypair with the given public key. */
public boolean isPubKeyMine(byte[] pubkey);
boolean isPubKeyMine(byte[] pubkey);
/** Returns true if this wallet knows the script corresponding to the given hash. */
public boolean isPayToScriptHashMine(byte[] payToScriptHash);
boolean isPayToScriptHashMine(byte[] payToScriptHash);
/** Returns transactions from a specific pool. */
public Map<Sha256Hash, Transaction> getTransactionPool(WalletTransaction.Pool pool);
Map<Sha256Hash, Transaction> getTransactionPool(WalletTransaction.Pool pool);
}

View File

@ -22,5 +22,5 @@ package org.bitcoinj.core;
*/
public interface TransactionBroadcaster {
/** Broadcast the given transaction on the network */
public TransactionBroadcast broadcastTransaction(final Transaction tx);
TransactionBroadcast broadcastTransaction(final Transaction tx);
}

View File

@ -160,7 +160,7 @@ public class TransactionConfidence implements Serializable {
*/
public interface Listener {
/** An enum that describes why a transaction confidence listener is being invoked (i.e. the class of change). */
public enum ChangeReason {
enum ChangeReason {
/**
* Occurs when the type returned by {@link org.bitcoinj.core.TransactionConfidence#getConfidenceType()}
* has changed. For example, if a PENDING transaction changes to BUILDING or DEAD, then this reason will
@ -182,7 +182,7 @@ public class TransactionConfidence implements Serializable {
*/
SEEN_PEERS,
}
public void onConfidenceChanged(TransactionConfidence confidence, ChangeReason reason);
void onConfidenceChanged(TransactionConfidence confidence, ChangeReason reason);
}
// This is used to ensure that confidence objects which aren't referenced from anywhere but which have an event

View File

@ -28,17 +28,17 @@ package org.bitcoinj.core;
*/
public interface WalletExtension {
/** Returns a Java package/class style name used to disambiguate this extension from others. */
public String getWalletExtensionID();
String getWalletExtensionID();
/**
* If this returns true, the mandatory flag is set when the wallet is serialized and attempts to load it without
* the extension being in the wallet will throw an exception. This method should not change its result during
* the objects lifetime.
*/
public boolean isWalletExtensionMandatory();
boolean isWalletExtensionMandatory();
/** Returns bytes that will be saved in the wallet. */
public byte[] serializeWalletExtension();
byte[] serializeWalletExtension();
/** Loads the contents of this object from the wallet. */
public void deserializeWalletExtension(Wallet containingWallet, byte[] data) throws Exception;
void deserializeWalletExtension(Wallet containingWallet, byte[] data) throws Exception;
}

View File

@ -27,17 +27,19 @@ import javax.annotation.Nullable;
*/
public interface EncryptableItem {
/** Returns whether the item is encrypted or not. If it is, then {@link #getSecretBytes()} will return null. */
public boolean isEncrypted();
boolean isEncrypted();
/** Returns the raw bytes of the item, if not encrypted, or null if encrypted or the secret is missing. */
@Nullable public byte[] getSecretBytes();
@Nullable
byte[] getSecretBytes();
/** Returns the initialization vector and encrypted secret bytes, or null if not encrypted. */
@Nullable public EncryptedData getEncryptedData();
@Nullable
EncryptedData getEncryptedData();
/** Returns an enum constant describing what algorithm was used to encrypt the key or UNENCRYPTED. */
public Protos.Wallet.EncryptionType getEncryptionType();
Protos.Wallet.EncryptionType getEncryptionType();
/** Returns the time in seconds since the UNIX epoch at which this encryptable item was first created/derived. */
public long getCreationTimeSeconds();
long getCreationTimeSeconds();
}

View File

@ -39,7 +39,7 @@ public interface KeyCrypter extends Serializable {
* Return the EncryptionType enum value which denotes the type of encryption/ decryption that this KeyCrypter
* can understand.
*/
public EncryptionType getUnderstoodEncryptionType();
EncryptionType getUnderstoodEncryptionType();
/**
* Create a KeyParameter (which typically contains an AES key)
@ -47,14 +47,14 @@ public interface KeyCrypter extends Serializable {
* @return KeyParameter The KeyParameter which typically contains the AES key to use for encrypting and decrypting
* @throws KeyCrypterException
*/
public KeyParameter deriveKey(CharSequence password) throws KeyCrypterException;
KeyParameter deriveKey(CharSequence password) throws KeyCrypterException;
/**
* Decrypt the provided encrypted bytes, converting them into unencrypted bytes.
*
* @throws KeyCrypterException if decryption was unsuccessful.
*/
public byte[] decrypt(EncryptedData encryptedBytesToDecode, KeyParameter aesKey) throws KeyCrypterException;
byte[] decrypt(EncryptedData encryptedBytesToDecode, KeyParameter aesKey) throws KeyCrypterException;
/**
* Encrypt the supplied bytes, converting them into ciphertext.
@ -62,5 +62,5 @@ public interface KeyCrypter extends Serializable {
* @return encryptedPrivateKey An encryptedPrivateKey containing the encrypted bytes and an initialisation vector.
* @throws KeyCrypterException if encryption was unsuccessful
*/
public EncryptedData encrypt(byte[] plainBytes, KeyParameter aesKey) throws KeyCrypterException;
EncryptedData encrypt(byte[] plainBytes, KeyParameter aesKey) throws KeyCrypterException;
}

View File

@ -32,12 +32,12 @@ import java.security.KeyStoreException;
* Windows, etc.
*/
public interface TrustStoreLoader {
public KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException;
KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException;
public static final String DEFAULT_KEYSTORE_TYPE = KeyStore.getDefaultType();
public static final String DEFAULT_KEYSTORE_PASSWORD = "changeit";
String DEFAULT_KEYSTORE_TYPE = KeyStore.getDefaultType();
String DEFAULT_KEYSTORE_PASSWORD = "changeit";
public class DefaultTrustStoreLoader implements TrustStoreLoader {
class DefaultTrustStoreLoader implements TrustStoreLoader {
@Override
public KeyStore getKeyStore() throws FileNotFoundException, KeyStoreException {
@ -96,7 +96,7 @@ public interface TrustStoreLoader {
}
}
public class FileTrustStoreLoader implements TrustStoreLoader {
class FileTrustStoreLoader implements TrustStoreLoader {
private final File path;
public FileTrustStoreLoader(@Nonnull File path) throws FileNotFoundException {

View File

@ -51,11 +51,11 @@ public class ProtobufParser<MessageType extends MessageLite> extends AbstractTim
*/
public interface Listener<MessageType extends MessageLite> {
/** Called when a new protobuf is received from the remote side. */
public void messageReceived(ProtobufParser<MessageType> handler, MessageType msg);
void messageReceived(ProtobufParser<MessageType> handler, MessageType msg);
/** Called when the connection is opened and available for writing data to. */
public void connectionOpen(ProtobufParser<MessageType> handler);
void connectionOpen(ProtobufParser<MessageType> handler);
/** Called when the connection is closed and no more data should be provided. */
public void connectionClosed(ProtobufParser<MessageType> handler);
void connectionClosed(ProtobufParser<MessageType> handler);
}
// The callback listener

View File

@ -28,5 +28,6 @@ public interface StreamParserFactory {
* @param inetAddress The client's (IP) address
* @param port The remote port on the client side
*/
@Nullable public StreamParser getNewParser(InetAddress inetAddress, int port);
@Nullable
StreamParser getNewParser(InetAddress inetAddress, int port);
}

View File

@ -132,7 +132,7 @@ public interface IPaymentChannelClient {
* @param expireTime The time, in seconds, when this channel will be closed by the server. Note this is in absolute time, i.e. seconds since 1970-01-01T00:00:00.
* @return <code>true</code> if the proposed time is acceptable <code>false</code> otherwise.
*/
public boolean acceptExpireTime(long expireTime);
boolean acceptExpireTime(long expireTime);
/**
* <p>Indicates the channel has been successfully opened and

View File

@ -75,7 +75,7 @@ public class PaymentChannelServer {
*
* <p>Called while holding a lock on the {@link PaymentChannelServer} object - be careful about reentrancy</p>
*/
public void sendToClient(Protos.TwoWayChannelMessage msg);
void sendToClient(Protos.TwoWayChannelMessage msg);
/**
* <p>Requests that the connection to the client be closed</p>
@ -85,7 +85,7 @@ public class PaymentChannelServer {
* @param reason The reason for the closure, see the individual values for more details.
* It is usually safe to ignore this value.
*/
public void destroyConnection(CloseReason reason);
void destroyConnection(CloseReason reason);
/**
* <p>Triggered when the channel is opened and payments can begin</p>
@ -94,7 +94,7 @@ public class PaymentChannelServer {
*
* @param contractHash A unique identifier which represents this channel (actually the hash of the multisig contract)
*/
public void channelOpen(Sha256Hash contractHash);
void channelOpen(Sha256Hash contractHash);
/**
* <p>Called when the payment in this channel was successfully incremented by the client</p>
@ -107,7 +107,7 @@ public class PaymentChannelServer {
* @return A future that completes with the ack message that will be included in the PaymentAck message to the client. Use null for no ack message.
*/
@Nullable
public ListenableFuture<ByteString> paymentIncrease(Coin by, Coin to, @Nullable ByteString info);
ListenableFuture<ByteString> paymentIncrease(Coin by, Coin to, @Nullable ByteString info);
}
private final ServerConnection conn;

View File

@ -58,12 +58,13 @@ public class PaymentChannelServerListener {
/**
* A factory which generates connection-specific event handlers.
*/
public static interface HandlerFactory {
public interface HandlerFactory {
/**
* Called when a new connection completes version handshake to get a new connection-specific listener.
* If null is returned, the connection is immediately closed.
*/
@Nullable public ServerConnectionEventHandler onNewConnection(SocketAddress clientAddress);
@Nullable
ServerConnectionEventHandler onNewConnection(SocketAddress clientAddress);
}
private class ServerHandler {

View File

@ -38,7 +38,7 @@ public interface TransactionSigner {
* This class wraps transaction proposed to complete keeping a metadata that may be updated, used and effectively
* shared by transaction signers.
*/
public class ProposedTransaction {
class ProposedTransaction {
public final Transaction partialTx;
@ -57,7 +57,7 @@ public interface TransactionSigner {
}
}
public static class MissingSignatureException extends RuntimeException {
class MissingSignatureException extends RuntimeException {
}
/**

View File

@ -32,5 +32,5 @@ public interface TaggableObject {
void setTag(String tag, ByteString value);
/** Returns a copy of all the tags held by this object. */
public Map<String, ByteString> getTags();
Map<String, ByteString> getTags();
}

View File

@ -17,5 +17,5 @@ public interface CoinSelector {
* this call and can be edited freely. See the docs for CoinSelection to learn more, or look a the implementation
* of {@link DefaultCoinSelector}.
*/
public CoinSelection select(Coin target, List<TransactionOutput> candidates);
CoinSelection select(Coin target, List<TransactionOutput> candidates);
}

View File

@ -33,19 +33,19 @@ public interface EncryptableKeyChain extends KeyChain {
*
* @return The derived key, in case you wish to cache it for future use.
*/
public EncryptableKeyChain toEncrypted(CharSequence password);
EncryptableKeyChain toEncrypted(CharSequence password);
/**
* Returns a new keychain holding identical/cloned keys to this chain, but encrypted under the given key.
* Old keys and keychains remain valid and so you should ensure you don't accidentally hold references to them.
*/
public EncryptableKeyChain toEncrypted(KeyCrypter keyCrypter, KeyParameter aesKey);
EncryptableKeyChain toEncrypted(KeyCrypter keyCrypter, KeyParameter aesKey);
/**
* Decrypts the key chain with the given password. See {@link #toDecrypted(org.spongycastle.crypto.params.KeyParameter)}
* for details.
*/
public EncryptableKeyChain toDecrypted(CharSequence password);
EncryptableKeyChain toDecrypted(CharSequence password);
/**
* Decrypt the key chain with the given AES key and whatever {@link KeyCrypter} is already set. Note that if you
@ -56,12 +56,12 @@ public interface EncryptableKeyChain extends KeyChain {
* create from a password)
* @throws KeyCrypterException Thrown if the wallet decryption fails. If so, the wallet state is unchanged.
*/
public EncryptableKeyChain toDecrypted(KeyParameter aesKey);
EncryptableKeyChain toDecrypted(KeyParameter aesKey);
public boolean checkPassword(CharSequence password);
public boolean checkAESKey(KeyParameter aesKey);
boolean checkPassword(CharSequence password);
boolean checkAESKey(KeyParameter aesKey);
/** Returns the key crypter used by this key chain, or null if it's not encrypted. */
@Nullable
public KeyCrypter getKeyCrypter();
KeyCrypter getKeyCrypter();
}

View File

@ -32,7 +32,7 @@ public interface KeyBag {
* @return ECKey object or null if no such key was found.
*/
@Nullable
public ECKey findKeyFromPubHash(byte[] pubkeyHash);
ECKey findKeyFromPubHash(byte[] pubkeyHash);
/**
* Locates a keypair from the keychain given the raw public key bytes.
@ -40,7 +40,7 @@ public interface KeyBag {
* @return ECKey or null if no such key was found.
*/
@Nullable
public ECKey findKeyFromPubKey(byte[] pubkey);
ECKey findKeyFromPubKey(byte[] pubkey);
/**
* Locates a redeem data (redeem script and keys) from the keychain given the hash of the script.
@ -50,6 +50,6 @@ public interface KeyBag {
* Returns RedeemData object or null if no such data was found.
*/
@Nullable
public RedeemData findRedeemDataFromScriptHash(byte[] scriptHash);
RedeemData findRedeemDataFromScriptHash(byte[] scriptHash);
}

View File

@ -35,9 +35,9 @@ import java.util.concurrent.Executor;
*/
public interface KeyChain {
/** Returns true if the given key is in the chain. */
public boolean hasKey(ECKey key);
boolean hasKey(ECKey key);
public enum KeyPurpose {
enum KeyPurpose {
RECEIVE_FUNDS,
CHANGE,
REFUND,
@ -45,38 +45,38 @@ public interface KeyChain {
}
/** Obtains a number of key/s intended for the given purpose. The chain may create new key/s, derive, or re-use an old one. */
public List<? extends ECKey> getKeys(KeyPurpose purpose, int numberOfKeys);
List<? extends ECKey> getKeys(KeyPurpose purpose, int numberOfKeys);
/** Obtains a key intended for the given purpose. The chain may create a new key, derive one, or re-use an old one. */
public ECKey getKey(KeyPurpose purpose);
ECKey getKey(KeyPurpose purpose);
/** Returns a list of keys serialized to the bitcoinj protobuf format. */
public List<Protos.Key> serializeToProtobuf();
List<Protos.Key> serializeToProtobuf();
/** Adds a listener for events that are run when keys are added, on the user thread. */
public void addEventListener(KeyChainEventListener listener);
void addEventListener(KeyChainEventListener listener);
/** Adds a listener for events that are run when keys are added, on the given executor. */
public void addEventListener(KeyChainEventListener listener, Executor executor);
void addEventListener(KeyChainEventListener listener, Executor executor);
/** Removes a listener for events that are run when keys are added. */
public boolean removeEventListener(KeyChainEventListener listener);
boolean removeEventListener(KeyChainEventListener listener);
/** Returns the number of keys this key chain manages. */
public int numKeys();
int numKeys();
/**
* Returns the number of elements this chain wishes to insert into the Bloom filter. The size passed to
* {@link #getFilter(int, double, long)} should be at least this large.
*/
public int numBloomFilterEntries();
int numBloomFilterEntries();
/**
* <p>Returns the earliest creation time of keys in this chain, in seconds since the epoch. This can return zero
* if at least one key does not have that data (was created before key timestamping was implemented). If there
* are no keys in the wallet, {@link Long#MAX_VALUE} is returned.</p>
*/
public long getEarliestKeyCreationTime();
long getEarliestKeyCreationTime();
/**
* <p>Gets a bloom filter that contains all of the public keys from this chain, and which will provide the given
@ -90,5 +90,5 @@ public interface KeyChain {
* <p>See the docs for {@link org.bitcoinj.core.BloomFilter#BloomFilter(int, double, long)} for a brief
* explanation of anonymity when using bloom filters, and for the meaning of these parameters.</p>
*/
public BloomFilter getFilter(int size, double falsePositiveRate, long tweak);
BloomFilter getFilter(int size, double falsePositiveRate, long tweak);
}

View File

@ -32,15 +32,15 @@ import java.util.List;
* <p>A factory interface is provided. The wallet will use this to analyze new pending transactions.</p>
*/
public interface RiskAnalysis {
public enum Result {
enum Result {
OK,
NON_FINAL,
NON_STANDARD
}
public Result analyze();
Result analyze();
public interface Analyzer {
public RiskAnalysis create(Wallet wallet, Transaction tx, List<Transaction> dependencies);
interface Analyzer {
RiskAnalysis create(Wallet wallet, Transaction tx, List<Transaction> dependencies);
}
}

View File

@ -58,12 +58,12 @@ public class WalletFiles {
* Called on the auto-save thread when a new temporary file is created but before the wallet data is saved
* to it. If you want to do something here like adjust permissions, go ahead and do so.
*/
public void onBeforeAutoSave(File tempFile);
void onBeforeAutoSave(File tempFile);
/**
* Called on the auto-save thread after the newly created temporary file has been filled with data and renamed.
*/
public void onAfterAutoSave(File newlySavedFile);
void onAfterAutoSave(File newlySavedFile);
}
public WalletFiles(final Wallet wallet, File file, long delay, TimeUnit delayTimeUnit) {