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); final Optional<? extends RunnableNode> bootnode = selectAndStartBootnode(nodes);
nodes nodes.parallelStream()
.parallelStream()
.filter( .filter(
node -> { node -> {
LOG.info("starting non-bootnode {}", node.getName()); LOG.info("starting non-bootnode {}", node.getName());

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

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

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

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

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

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

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

@ -49,8 +49,11 @@ public class DebugGetBadBlocks implements JsonRpcMethod {
@Override @Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
final List<BadBlockResult> response = final List<BadBlockResult> response =
protocolSchedule.getByBlockNumber(blockchain.headBlockNumber()).getBadBlocksManager() protocolSchedule
.getBadBlocks().stream() .getByBlockNumber(blockchain.headBlockNumber())
.getBadBlocksManager()
.getBadBlocks()
.stream()
.map(block -> BadBlockResult.from(blockResultFactory.transactionComplete(block), block)) .map(block -> BadBlockResult.from(blockResultFactory.transactionComplete(block), block))
.collect(Collectors.toList()); .collect(Collectors.toList());
return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), response); 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().substring(0, this.getName().indexOf('_')) + ":*");
permissions.add(this.getName().replace('_', ':')); permissions.add(this.getName().replace('_', ':'));
return permissions; return permissions;
}; }
} }

@ -78,9 +78,12 @@ public class TraceTransaction implements JsonRpcMethod {
return emptyResult(); return emptyResult();
} }
final TransactionTrace transactionTrace = final TransactionTrace transactionTrace =
blockTracerSupplier.get() blockTracerSupplier
.get()
.trace(block, new DebugOperationTracer(new TraceOptions(false, false, true))) .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)) .filter(trxTrace -> trxTrace.getTransaction().getHash().equals(transactionHash))
.findFirst() .findFirst()
.orElseThrow(); .orElseThrow();

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

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

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

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

@ -437,7 +437,7 @@ public interface GasCalculator {
default long getMaxRefundQuotient() { default long getMaxRefundQuotient() {
return 2; return 2;
}; }
// what would be the gas for a PMT with hash of all non-zeros // what would be the gas for a PMT with hash of all non-zeros
Gas getMaximumPmtCost(); 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 // 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 // storage so we can do both warm ups in one pass
accessListWarmAddresses accessListWarmAddresses.parallelStream()
.parallelStream()
.forEach( .forEach(
address -> address ->
Optional.ofNullable(worldState.get(address)) Optional.ofNullable(worldState.get(address))
.ifPresent( .ifPresent(
account -> account ->
warmedUpStorage warmedUpStorage.get(address).parallelStream()
.get(address)
.parallelStream()
.forEach( .forEach(
storageKeyBytes -> storageKeyBytes ->
account.getStorageValue( account.getStorageValue(

@ -38,7 +38,7 @@ import org.junit.Test;
public class ChainHeadPrivateNonceProviderTest { public class ChainHeadPrivateNonceProviderTest {
private static final Bytes32 PRIVACY_GROUP_ID = private static final Bytes32 PRIVACY_GROUP_ID =
Bytes32.wrap(Bytes.fromBase64String("DyAOiF/ynpc+JXa2YAGB0bCitSlOMNm+ShmB/7M6C4w=")); 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 Account account;
private WorldState worldState; private WorldState worldState;

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

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

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

@ -38,7 +38,7 @@ import org.apache.logging.log4j.Logger;
public class NetworkRunner implements AutoCloseable { public class NetworkRunner implements AutoCloseable {
private static final Logger LOG = LogManager.getLogger(); 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 started = new AtomicBoolean(false);
private final AtomicBoolean stopped = new AtomicBoolean(false); private final AtomicBoolean stopped = new AtomicBoolean(false);

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

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

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

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

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

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

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

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

Loading…
Cancel
Save