Skip to content

Commit

Permalink
Restore "FieldCanBeFinal" errorprone check (#287)
Browse files Browse the repository at this point in the history
This was turned off a number of months ago because of long build times.
However it appears either because of code structure changes or fixed
errorprone that this finishes in a reasonable time now.

Code that violated this check is also fixed.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
  • Loading branch information
shemnon authored Jan 2, 2020
1 parent dfad8bf commit e493b91
Show file tree
Hide file tree
Showing 95 changed files with 374 additions and 339 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

public class Amount {

private BigDecimal value;
private Unit unit;
private final BigDecimal value;
private final Unit unit;

private Amount(final BigDecimal value, final Unit unit) {
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public class ExpectedBlockHasProposer implements Condition {
private final EthTransactions eth;
private Address proposer;
private final Address proposer;

public ExpectedBlockHasProposer(final EthTransactions eth, final Address proposer) {
this.eth = eth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class EthSignerConfig implements Config {
private final Level logLevel;
private final String downstreamHttpHost;
private final Integer downStreamHttpPort;
private Duration downstreamHttpRequestTimeout;
private final Duration downstreamHttpRequestTimeout;
private final String httpListenHost;
private final Integer httpListenPort;
private final ChainIdProvider chainId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class Cluster implements AutoCloseable {
private final NetConditions net;
private final ClusterConfiguration clusterConfiguration;
private List<? extends RunnableNode> originalNodes = emptyList();
private List<URI> bootnodes = new ArrayList<>();
private final List<URI> bootnodes = new ArrayList<>();

public Cluster(final NetConditions net) {
this(new ClusterConfigurationBuilder().build(), net, BesuNodeRunner.instance());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public class BesuNodeConfigurationBuilder {
private boolean devMode = true;
private GenesisConfigurationProvider genesisConfigProvider = ignore -> Optional.empty();
private Boolean p2pEnabled = true;
private NetworkingConfiguration networkingConfiguration = NetworkingConfiguration.create();
private final NetworkingConfiguration networkingConfiguration = NetworkingConfiguration.create();
private boolean discoveryEnabled = true;
private boolean bootnodeEligible = true;
private boolean revertReasonEnabled = false;
private List<String> plugins = new ArrayList<>();
private List<String> extraCLIOptions = new ArrayList<>();
private final List<String> plugins = new ArrayList<>();
private final List<String> extraCLIOptions = new ArrayList<>();
private List<String> staticNodes = new ArrayList<>();

public BesuNodeConfigurationBuilder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class LoadPrivateSmartContractTransaction<T extends Contract> implements
private final long chainId;
private final Base64String privateFrom;
private final List<Base64String> privateFor;
private String contractAddress;
private final String contractAddress;

public LoadPrivateSmartContractTransaction(
final String contractAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.web3j.utils.Base64String;

public class FindPrivacyGroupTransaction implements Transaction<List<PrivacyGroup>> {
private List<Base64String> nodes;
private final List<Base64String> nodes;

public FindPrivacyGroupTransaction(final List<String> nodeEnclaveKeys) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.io.IOException;

public class PrivDistributeTransactionTransaction implements Transaction<String> {
private String signedPrivateTransaction;
private final String signedPrivateTransaction;

public PrivDistributeTransactionTransaction(final String signedPrivateTransaction) {
this.signedPrivateTransaction = signedPrivateTransaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,41 +75,41 @@ public class CrossContractReader extends Contract {

@Deprecated
protected CrossContractReader(
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
final String contractAddress,
final Web3j web3j,
final Credentials credentials,
final BigInteger gasPrice,
final BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}

protected CrossContractReader(
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
final String contractAddress,
final Web3j web3j,
final Credentials credentials,
final ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}

@Deprecated
protected CrossContractReader(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
final String contractAddress,
final Web3j web3j,
final TransactionManager transactionManager,
final BigInteger gasPrice,
final BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}

protected CrossContractReader(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
final String contractAddress,
final Web3j web3j,
final TransactionManager transactionManager,
final ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}

public RemoteFunctionCall<TransactionReceipt> remoteDestroy(String crossAddress) {
public RemoteFunctionCall<TransactionReceipt> remoteDestroy(final String crossAddress) {
final Function function =
new Function(
FUNC_REMOTEDESTROY,
Expand All @@ -118,7 +118,7 @@ public RemoteFunctionCall<TransactionReceipt> remoteDestroy(String crossAddress)
return executeRemoteCallTransaction(function);
}

public RemoteFunctionCall<TransactionReceipt> deployRemote(String crossAddress) {
public RemoteFunctionCall<TransactionReceipt> deployRemote(final String crossAddress) {
final Function function =
new Function(
FUNC_DEPLOYREMOTE,
Expand All @@ -140,7 +140,7 @@ public RemoteFunctionCall<TransactionReceipt> destroy() {
return executeRemoteCallTransaction(function);
}

public RemoteFunctionCall<BigInteger> read(String emitter_address) {
public RemoteFunctionCall<BigInteger> read(final String emitter_address) {
final Function function =
new Function(
FUNC_READ,
Expand All @@ -156,7 +156,7 @@ public RemoteFunctionCall<TransactionReceipt> increment() {
return executeRemoteCallTransaction(function);
}

public RemoteFunctionCall<TransactionReceipt> incrementRemote(String crossAddress) {
public RemoteFunctionCall<TransactionReceipt> incrementRemote(final String crossAddress) {
final Function function =
new Function(
FUNC_INCREMENTREMOTE,
Expand All @@ -166,7 +166,7 @@ public RemoteFunctionCall<TransactionReceipt> incrementRemote(String crossAddres
}

public List<NewEventEmitterEventResponse> getNewEventEmitterEvents(
TransactionReceipt transactionReceipt) {
final TransactionReceipt transactionReceipt) {
List<Contract.EventValuesWithLog> valueList =
extractEventParametersWithLog(NEWEVENTEMITTER_EVENT, transactionReceipt);
ArrayList<NewEventEmitterEventResponse> responses =
Expand All @@ -180,13 +180,14 @@ public List<NewEventEmitterEventResponse> getNewEventEmitterEvents(
return responses;
}

public Flowable<NewEventEmitterEventResponse> newEventEmitterEventFlowable(EthFilter filter) {
public Flowable<NewEventEmitterEventResponse> newEventEmitterEventFlowable(
final EthFilter filter) {
return web3j
.ethLogFlowable(filter)
.map(
new io.reactivex.functions.Function<Log, NewEventEmitterEventResponse>() {
@Override
public NewEventEmitterEventResponse apply(Log log) {
public NewEventEmitterEventResponse apply(final Log log) {
Contract.EventValuesWithLog eventValues =
extractEventParametersWithLog(NEWEVENTEMITTER_EVENT, log);
NewEventEmitterEventResponse typedResponse = new NewEventEmitterEventResponse();
Expand All @@ -199,73 +200,80 @@ public NewEventEmitterEventResponse apply(Log log) {
}

public Flowable<NewEventEmitterEventResponse> newEventEmitterEventFlowable(
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
final DefaultBlockParameter startBlock, final DefaultBlockParameter endBlock) {
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(NEWEVENTEMITTER_EVENT));
return newEventEmitterEventFlowable(filter);
}

@Deprecated
public static CrossContractReader load(
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
final String contractAddress,
final Web3j web3j,
final Credentials credentials,
final BigInteger gasPrice,
final BigInteger gasLimit) {
return new CrossContractReader(contractAddress, web3j, credentials, gasPrice, gasLimit);
}

@Deprecated
public static CrossContractReader load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
final String contractAddress,
final Web3j web3j,
final TransactionManager transactionManager,
final BigInteger gasPrice,
final BigInteger gasLimit) {
return new CrossContractReader(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}

public static CrossContractReader load(
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
final String contractAddress,
final Web3j web3j,
final Credentials credentials,
final ContractGasProvider contractGasProvider) {
return new CrossContractReader(contractAddress, web3j, credentials, contractGasProvider);
}

public static CrossContractReader load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
final String contractAddress,
final Web3j web3j,
final TransactionManager transactionManager,
final ContractGasProvider contractGasProvider) {
return new CrossContractReader(contractAddress, web3j, transactionManager, contractGasProvider);
}

public static RemoteCall<CrossContractReader> deploy(
Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
final Web3j web3j,
final Credentials credentials,
final ContractGasProvider contractGasProvider) {
return deployRemoteCall(
CrossContractReader.class, web3j, credentials, contractGasProvider, BINARY, "");
}

@Deprecated
public static RemoteCall<CrossContractReader> deploy(
Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
final Web3j web3j,
final Credentials credentials,
final BigInteger gasPrice,
final BigInteger gasLimit) {
return deployRemoteCall(
CrossContractReader.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}

public static RemoteCall<CrossContractReader> deploy(
Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
final Web3j web3j,
final TransactionManager transactionManager,
final ContractGasProvider contractGasProvider) {
return deployRemoteCall(
CrossContractReader.class, web3j, transactionManager, contractGasProvider, BINARY, "");
}

@Deprecated
public static RemoteCall<CrossContractReader> deploy(
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
final Web3j web3j,
final TransactionManager transactionManager,
final BigInteger gasPrice,
final BigInteger gasLimit) {
return deployRemoteCall(
CrossContractReader.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
Expand Down
Loading

0 comments on commit e493b91

Please sign in to comment.