Update spotless and google-java-format (#2593)

Update spotless to 5.14.2 and java-google-format to 1.10.0.
Both of these are needed to support Java 16 and Gradle 7.x.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
pull/2600/head
Danno Ferrin 3 years ago committed by GitHub
parent 992c656387
commit fd59570e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/cluster/Cluster.java
  2. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/generated/CrossContractReader.java
  3. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/generated/EventEmitter.java
  4. 8
      besu/src/main/java/org/hyperledger/besu/cli/custom/RpcAuthFileValidator.java
  5. 4
      build.gradle
  6. 2
      container-tests/tests/src/test/java/org/hyperledger/besu/tests/container/ContainerTestBase.java
  7. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java
  8. 7
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugAccountAt.java
  9. 7
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugGetBadBlocks.java
  10. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/JsonRpcMethod.java
  11. 7
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/TraceTransaction.java
  12. 3
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/PrivacyApiGroupJsonRpcMethods.java
  13. 3
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/logs/LogsSubscriptionService.java
  14. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/TransactionReceiptWithMetadata.java
  15. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/LondonGasCalculator.java
  16. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/GasCalculator.java
  17. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/vm/MessageFrame.java
  18. 2
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/ChainHeadPrivateNonceProviderTest.java
  19. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/LegacyForkIdManager.java
  20. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/task/WaitForPeerTaskTest.java
  21. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/task/WaitForPeersTaskTest.java
  22. 2
      ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/network/NetworkRunner.java
  23. 11
      ethereum/permissioning/src/main/java/org/hyperledger/besu/ethereum/permissioning/AllowlistPersistor.java
  24. 8
      ethereum/permissioning/src/main/java/org/hyperledger/besu/ethereum/permissioning/PermissioningConfigurationBuilder.java
  25. 6
      nat/src/main/java/org/hyperledger/besu/nat/kubernetes/KubernetesNatManager.java
  26. 3
      pki/src/main/java/org/hyperledger/besu/pki/crl/CRLUtil.java
  27. 2
      plugin-api/build.gradle
  28. 4
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/SyncStatus.java
  29. 2
      privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/DefaultOnChainPrivacyGroupManagementContract.java
  30. 2
      privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementProxy.java

@ -85,8 +85,7 @@ public class Cluster implements AutoCloseable {
final Optional<? extends RunnableNode> bootnode = selectAndStartBootnode(nodes);
nodes
.parallelStream()
nodes.parallelStream()
.filter(
node -> {
LOG.info("starting non-bootnode {}", node.getName());

@ -71,7 +71,7 @@ public class CrossContractReader extends Contract {
public static final Event NEWEVENTEMITTER_EVENT =
new Event(
"NewEventEmitter", Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));;
"NewEventEmitter", Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
@Deprecated
protected CrossContractReader(

@ -67,7 +67,7 @@ public class EventEmitter extends Contract {
new Event(
"stored",
Arrays.<TypeReference<?>>asList(
new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));;
new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));
@Deprecated
protected EventEmitter(

@ -80,9 +80,7 @@ public class RpcAuthFileValidator {
int configuredUsers = tomlParseResult.getTable("Users").keySet().size();
int usersWithPasswords =
tomlParseResult
.keyPathSet()
.parallelStream()
tomlParseResult.keyPathSet().parallelStream()
.filter(
keySet ->
keySet.contains("Users")
@ -95,9 +93,7 @@ public class RpcAuthFileValidator {
}
private static boolean verifyAllEntriesHaveValues(final TomlParseResult tomlParseResult) {
return tomlParseResult
.dottedKeySet()
.parallelStream()
return tomlParseResult.dottedKeySet().parallelStream()
.filter(keySet -> !keySet.contains("password"))
.allMatch(dottedKey -> verifyEntry(dottedKey, tomlParseResult));
}

@ -20,7 +20,7 @@ import net.ltgt.gradle.errorprone.CheckSeverity
import java.text.SimpleDateFormat
plugins {
id 'com.diffplug.spotless' version '5.9.0'
id 'com.diffplug.spotless' version '5.14.2'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'com.github.hierynomus.license' version '0.15.0'
id 'com.jfrog.artifactory' version '4.20.0'
@ -128,7 +128,7 @@ allprojects {
exclude '**/.gradle/**'
}
removeUnusedImports()
googleJavaFormat('1.7')
googleJavaFormat('1.10.0')
importOrder 'org.hyperledger', 'java', ''
trimTrailingWhitespace()
endWithNewline()

@ -114,7 +114,7 @@ public class ContainerTestBase {
@Rule
public final GenericContainer goQuorumContainer =
buildGoQuorumContainer(ipcDirPath, ipcBindDir, containerIpcPath);;
buildGoQuorumContainer(ipcDirPath, ipcBindDir, containerIpcPath);
@Before
public void setUp() throws IOException, InterruptedException {

@ -45,5 +45,5 @@ public abstract class ApiConfiguration {
@Value.Derived
public double getGasPriceFraction() {
return getGasPricePercentile() / 100.0;
};
}
}

@ -86,9 +86,12 @@ public class DebugAccountAt extends AbstractBlockParameterOrBlockHashMethod {
}
final Optional<TransactionTrace> transactionTrace =
blockTracerSupplier.get()
blockTracerSupplier
.get()
.trace(blockHash, new DebugOperationTracer(new TraceOptions(false, true, true)))
.map(BlockTrace::getTransactionTraces).orElse(Collections.emptyList()).stream()
.map(BlockTrace::getTransactionTraces)
.orElse(Collections.emptyList())
.stream()
.filter(
trxTrace ->
trxTrace

@ -49,8 +49,11 @@ public class DebugGetBadBlocks implements JsonRpcMethod {
@Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final List<BadBlockResult> response =
protocolSchedule.getByBlockNumber(blockchain.headBlockNumber()).getBadBlocksManager()
.getBadBlocks().stream()
protocolSchedule
.getByBlockNumber(blockchain.headBlockNumber())
.getBadBlocksManager()
.getBadBlocks()
.stream()
.map(block -> BadBlockResult.from(blockResultFactory.transactionComplete(block), block))
.collect(Collectors.toList());
return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), response);

@ -50,5 +50,5 @@ public interface JsonRpcMethod {
permissions.add(this.getName().substring(0, this.getName().indexOf('_')) + ":*");
permissions.add(this.getName().replace('_', ':'));
return permissions;
};
}
}

@ -78,9 +78,12 @@ public class TraceTransaction implements JsonRpcMethod {
return emptyResult();
}
final TransactionTrace transactionTrace =
blockTracerSupplier.get()
blockTracerSupplier
.get()
.trace(block, new DebugOperationTracer(new TraceOptions(false, false, true)))
.map(BlockTrace::getTransactionTraces).orElse(Collections.emptyList()).stream()
.map(BlockTrace::getTransactionTraces)
.orElse(Collections.emptyList())
.stream()
.filter(trxTrace -> trxTrace.getTransaction().getHash().equals(transactionHash))
.findFirst()
.orElseThrow();

@ -98,7 +98,8 @@ public abstract class PrivacyApiGroupJsonRpcMethods extends ApiGroupJsonRpcMetho
createPrivateMarkerTransactionFactory();
final PrivacyIdProvider enclavePublicProvider = PrivacyIdProvider.build(privacyParameters);
final PrivacyController privacyController = createPrivacyController();
return create(privacyController, enclavePublicProvider, markerTransactionFactory).entrySet()
return create(privacyController, enclavePublicProvider, markerTransactionFactory)
.entrySet()
.stream()
.collect(
Collectors.toMap(

@ -60,7 +60,8 @@ public class LogsSubscriptionService implements Consumer<LogWithMetadata> {
public void checkPrivateLogs(final BlockAddedEvent event) {
privacyQueries.ifPresent(
pq ->
subscriptionManager.subscriptionsOfType(SubscriptionType.LOGS, LogsSubscription.class)
subscriptionManager
.subscriptionsOfType(SubscriptionType.LOGS, LogsSubscription.class)
.stream()
.filter(PrivateLogsSubscription.class::isInstance)
.map(PrivateLogsSubscription.class::cast)

@ -101,5 +101,5 @@ public class TransactionReceiptWithMetadata {
public Optional<Long> getBaseFee() {
return baseFee;
};
}
}

@ -80,5 +80,5 @@ public class LondonGasCalculator extends BerlinGasCalculator {
@Override
public long getMaxRefundQuotient() {
return NEW_MAX_REFUND_QUOTIENT;
};
}
}

@ -437,7 +437,7 @@ public interface GasCalculator {
default long getMaxRefundQuotient() {
return 2;
};
}
// what would be the gas for a PMT with hash of all non-zeros
Gas getMaximumPmtCost();

@ -328,16 +328,13 @@ public class MessageFrame {
// the warmed up addresses will always be a superset of the address keys in the warmed up
// storage so we can do both warm ups in one pass
accessListWarmAddresses
.parallelStream()
accessListWarmAddresses.parallelStream()
.forEach(
address ->
Optional.ofNullable(worldState.get(address))
.ifPresent(
account ->
warmedUpStorage
.get(address)
.parallelStream()
warmedUpStorage.get(address).parallelStream()
.forEach(
storageKeyBytes ->
account.getStorageValue(

@ -38,7 +38,7 @@ import org.junit.Test;
public class ChainHeadPrivateNonceProviderTest {
private static final Bytes32 PRIVACY_GROUP_ID =
Bytes32.wrap(Bytes.fromBase64String("DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w="));
private static final Address ADDRESS = Address.fromHexString("55");;
private static final Address ADDRESS = Address.fromHexString("55");
private Account account;
private WorldState worldState;

@ -38,7 +38,7 @@ public class LegacyForkIdManager {
this.forks =
forks.stream().filter(fork -> fork > 0).distinct().collect(Collectors.toUnmodifiableList());
createForkIds();
};
}
public List<ForkId> getForkAndHashList() {
return this.forkAndHashList;

@ -32,7 +32,7 @@ import org.junit.Test;
public class WaitForPeerTaskTest {
private EthProtocolManager ethProtocolManager;
private EthContext ethContext;
private final MetricsSystem metricsSystem = new NoOpMetricsSystem();;
private final MetricsSystem metricsSystem = new NoOpMetricsSystem();
@Before
public void setupTest() {

@ -32,7 +32,7 @@ import org.junit.Test;
public class WaitForPeersTaskTest {
private EthProtocolManager ethProtocolManager;
private EthContext ethContext;
private final MetricsSystem metricsSystem = new NoOpMetricsSystem();;
private final MetricsSystem metricsSystem = new NoOpMetricsSystem();
@Before
public void setupTest() {

@ -38,7 +38,7 @@ import org.apache.logging.log4j.Logger;
public class NetworkRunner implements AutoCloseable {
private static final Logger LOG = LogManager.getLogger();
private final CountDownLatch shutdown = new CountDownLatch(1);;
private final CountDownLatch shutdown = new CountDownLatch(1);
private final AtomicBoolean started = new AtomicBoolean(false);
private final AtomicBoolean stopped = new AtomicBoolean(false);

@ -102,9 +102,7 @@ public class AllowlistPersistor {
Collectors.toMap(
o -> o.getKey(),
o ->
o.getValue()
.toList()
.parallelStream()
o.getValue().toList().parallelStream()
.map(Object::toString)
.collect(Collectors.toList())));
}
@ -112,9 +110,7 @@ public class AllowlistPersistor {
@VisibleForTesting
void removeExistingConfigItem(final ALLOWLIST_TYPE allowlistType) throws IOException {
List<String> otherConfigItems =
existingConfigItems(configurationFile.toPath())
.entrySet()
.parallelStream()
existingConfigItems(configurationFile.toPath()).entrySet().parallelStream()
.filter(listType -> !listType.getKey().equals(allowlistType))
.map(keyVal -> valueListToTomlArray(keyVal.getKey(), keyVal.getValue()))
.collect(Collectors.toList());
@ -153,8 +149,7 @@ public class AllowlistPersistor {
return String.format(
"%s=[%s]",
allowlistType.getTomlKey(),
allowlistValues
.parallelStream()
allowlistValues.parallelStream()
.map(uri -> String.format("\"%s\"", uri))
.collect(Collectors.joining(",")));
}

@ -77,9 +77,7 @@ public class PermissioningConfigurationBuilder {
if (nodeAllowlistTomlArray != null) {
List<EnodeURL> nodesAllowlistToml =
nodeAllowlistTomlArray
.toList()
.parallelStream()
nodeAllowlistTomlArray.toList().parallelStream()
.map(Object::toString)
.map(
url ->
@ -114,9 +112,7 @@ public class PermissioningConfigurationBuilder {
if (accountAllowlistTomlArray != null) {
List<String> accountsAllowlistToml =
accountAllowlistTomlArray
.toList()
.parallelStream()
accountAllowlistTomlArray.toList().parallelStream()
.map(Object::toString)
.collect(Collectors.toList());

@ -77,8 +77,10 @@ public class KubernetesNatManager extends AbstractNatManager {
final CoreV1Api api = new CoreV1Api();
// invokes the CoreV1Api client
final V1Service service =
api.listServiceForAllNamespaces(null, null, null, null, null, null, null, null, null)
.getItems().stream()
api
.listServiceForAllNamespaces(null, null, null, null, null, null, null, null, null)
.getItems()
.stream()
.filter(
v1Service -> v1Service.getMetadata().getName().contains(besuServiceNameFilter))
.findFirst()

@ -31,7 +31,8 @@ public class CRLUtil {
try {
final List<X509CRL> crls =
CertificateFactory.getInstance("X509")
.generateCRLs(new FileInputStream(Paths.get(path).toFile())).stream()
.generateCRLs(new FileInputStream(Paths.get(path).toFile()))
.stream()
.map(X509CRL.class::cast)
.collect(Collectors.toList());

@ -64,7 +64,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'HVhl+xNOt6THTZvQNZ9NnOIQB6AkN+wq+1stbnqe6ig='
knownHash = 'jzeZ7YS9/4K+Q4TZMbrUlkDnDce6mCRisy1CoCTxoa8='
}
check.dependsOn('checkAPIChanges')

@ -50,7 +50,7 @@ public interface SyncStatus {
@Unstable
default Optional<Long> getPulledStates() {
return Optional.empty();
};
}
/**
* KnownStates is the number of states the node knows of so far, or empty if this is not known or
@ -61,5 +61,5 @@ public interface SyncStatus {
@Unstable
default Optional<Long> getKnownStates() {
return Optional.empty();
};
}
}

@ -82,7 +82,7 @@ public class DefaultOnChainPrivacyGroupManagementContract extends Contract {
Arrays.<TypeReference<?>>asList(
new TypeReference<Bool>() {},
new TypeReference<Bytes32>() {},
new TypeReference<Utf8String>() {}));;
new TypeReference<Utf8String>() {}));
@Deprecated
protected DefaultOnChainPrivacyGroupManagementContract(

@ -83,7 +83,7 @@ public class OnChainPrivacyGroupManagementProxy extends Contract {
public static final Event PARTICIPANTREMOVED_EVENT =
new Event(
"ParticipantRemoved", Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}));;
"ParticipantRemoved", Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}));
@Deprecated
protected OnChainPrivacyGroupManagementProxy(

Loading…
Cancel
Save