Skip to content

Commit

Permalink
Update spotless and google-java-format (#2593)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
shemnon authored Jul 29, 2021
1 parent 992c656 commit fd59570
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public void start(final List<? extends RunnableNode> nodes) {

final Optional<? extends RunnableNode> bootnode = selectAndStartBootnode(nodes);

nodes
.parallelStream()
nodes.parallelStream()
.filter(
node -> {
LOG.info("starting non-bootnode {}", node.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ private static boolean verifyAllUsersHavePassword(final TomlParseResult tomlPars
int configuredUsers = tomlParseResult.getTable("Users").keySet().size();

int usersWithPasswords =
tomlParseResult
.keyPathSet()
.parallelStream()
tomlParseResult.keyPathSet().parallelStream()
.filter(
keySet ->
keySet.contains("Users")
Expand All @@ -95,9 +93,7 @@ private static boolean verifyAllUsersHavePassword(final TomlParseResult tomlPars
}

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));
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -128,7 +128,7 @@ allprojects {
exclude '**/.gradle/**'
}
removeUnusedImports()
googleJavaFormat('1.7')
googleJavaFormat('1.10.0')
importOrder 'org.hyperledger', 'java', ''
trimTrailingWhitespace()
endWithNewline()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ public long getGasPriceMax() {
@Value.Derived
public double getGasPriceFraction() {
return getGasPricePercentile() / 100.0;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ protected Object resultByBlockHash(
}

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ public String getName() {
@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ default List<String> getPermissions() {
permissions.add(this.getName().substring(0, this.getName().indexOf('_')) + ":*");
permissions.add(this.getName().replace('_', ':'));
return permissions;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ private Object traceBlock(final Block block, final Hash transactionHash) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ protected Map<String, JsonRpcMethod> create() {
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public void accept(final LogWithMetadata 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ public long getGasUsed() {

public Optional<Long> getBaseFee() {
return baseFee;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ public Gas calculateStorageRefundAmount(
@Override
public long getMaxRefundQuotient() {
return NEW_MAX_REFUND_QUOTIENT;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ default Gas modExpGasCost(final Bytes input) {

default long getMaxRefundQuotient() {
return 2;
};
}

// what would be the gas for a PMT with hash of all non-zeros
Gas getMaximumPmtCost();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,13 @@ private 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public LegacyForkIdManager(final Blockchain blockchain, final List<Long> forks)
this.forks =
forks.stream().filter(fork -> fork > 0).distinct().collect(Collectors.toUnmodifiableList());
createForkIds();
};
}

public List<ForkId> getForkAndHashList() {
return this.forkAndHashList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,15 @@ private static Map<ALLOWLIST_TYPE, Collection<String>> existingConfigItems(
Collectors.toMap(
o -> o.getKey(),
o ->
o.getValue()
.toList()
.parallelStream()
o.getValue().toList().parallelStream()
.map(Object::toString)
.collect(Collectors.toList())));
}

@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());
Expand Down Expand Up @@ -153,8 +149,7 @@ private static String valueListToTomlArray(
return String.format(
"%s=[%s]",
allowlistType.getTomlKey(),
allowlistValues
.parallelStream()
allowlistValues.parallelStream()
.map(uri -> String.format("\"%s\"", uri))
.collect(Collectors.joining(",")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ private static LocalPermissioningConfiguration loadNodePermissioning(

if (nodeAllowlistTomlArray != null) {
List<EnodeURL> nodesAllowlistToml =
nodeAllowlistTomlArray
.toList()
.parallelStream()
nodeAllowlistTomlArray.toList().parallelStream()
.map(Object::toString)
.map(
url ->
Expand Down Expand Up @@ -114,9 +112,7 @@ private static LocalPermissioningConfiguration loadAccountPermissioning(

if (accountAllowlistTomlArray != null) {
List<String> accountsAllowlistToml =
accountAllowlistTomlArray
.toList()
.parallelStream()
accountAllowlistTomlArray.toList().parallelStream()
.map(Object::toString)
.collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ protected void doStart() throws NatInitializationException {
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()
Expand Down
3 changes: 2 additions & 1 deletion pki/src/main/java/org/hyperledger/besu/pki/crl/CRLUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public static CertStore loadCRLs(final String path) {
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());

Expand Down
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -61,5 +61,5 @@ default Optional<Long> getPulledStates() {
@Unstable
default Optional<Long> getKnownStates() {
return Optional.empty();
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit fd59570

Please sign in to comment.