Skip to content

Commit

Permalink
Add missing final (#8342)
Browse files Browse the repository at this point in the history
* Add final

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

---------

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
  • Loading branch information
gfukushima authored May 29, 2024
1 parent 32133f9 commit 9522d35
Show file tree
Hide file tree
Showing 142 changed files with 388 additions and 389 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ReferenceTestGenerator {

public static final Charset CHARSET = StandardCharsets.UTF_8;

public static void main(String[] args) throws IOException {
public static void main(final String[] args) throws IOException {
final Path outputDir = Path.of(args[0]);
try (final Stream<TestDefinition> tests = ReferenceTestFinder.findReferenceTests()) {
tests.forEach(testDefinition -> generateReferenceTest(outputDir, testDefinition));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ public class BeaconBlockBodyElectraImpl
implements BeaconBlockBodyElectra {

BeaconBlockBodyElectraImpl(
BeaconBlockBodySchemaElectraImpl type,
SszSignature randaoReveal,
Eth1Data eth1Data,
SszBytes32 graffiti,
SszList<ProposerSlashing> proposerSlashings,
SszList<AttesterSlashing> attesterSlashings,
SszList<Attestation> attestations,
SszList<Deposit> deposits,
SszList<SignedVoluntaryExit> voluntaryExits,
SyncAggregate syncAggregate,
ExecutionPayloadElectraImpl executionPayload,
SszList<SignedBlsToExecutionChange> blsToExecutionChanges,
SszList<SszKZGCommitment> blobKzgCommitments,
SszList<SignedConsolidation> consolidations) {
final BeaconBlockBodySchemaElectraImpl type,
final SszSignature randaoReveal,
final Eth1Data eth1Data,
final SszBytes32 graffiti,
final SszList<ProposerSlashing> proposerSlashings,
final SszList<AttesterSlashing> attesterSlashings,
final SszList<Attestation> attestations,
final SszList<Deposit> deposits,
final SszList<SignedVoluntaryExit> voluntaryExits,
final SyncAggregate syncAggregate,
final ExecutionPayloadElectraImpl executionPayload,
final SszList<SignedBlsToExecutionChange> blsToExecutionChanges,
final SszList<SszKZGCommitment> blobKzgCommitments,
final SszList<SignedConsolidation> consolidations) {
super(
type,
randaoReveal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class BlindedBeaconBlockBodyElectraImpl
final ExecutionPayloadHeaderElectraImpl executionPayloadHeader,
final SszList<SignedBlsToExecutionChange> blsToExecutionChanges,
final SszList<SszKZGCommitment> blobKzgCommitments,
SszList<SignedConsolidation> consolidations) {
final SszList<SignedConsolidation> consolidations) {
super(
type,
randaoReveal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public SszUInt64 getEpochSchema() {
}

@Override
public Consolidation createFromBackingNode(TreeNode node) {
public Consolidation createFromBackingNode(final TreeNode node) {
return new Consolidation(this, node);
}
}
Expand All @@ -61,7 +61,7 @@ protected Consolidation(
super(schema);
}

private Consolidation(Consolidation.ConsolidationSchema type, final TreeNode backingNode) {
private Consolidation(final Consolidation.ConsolidationSchema type, final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ default UInt64 getGenesisTimeMillis() {

Optional<List<BlobSidecar>> getBlobSidecarsIfAvailable(SlotAndBlockRoot slotAndBlockRoot);

default SafeFuture<Optional<BeaconBlock>> retrieveBlock(Bytes32 blockRoot) {
default SafeFuture<Optional<BeaconBlock>> retrieveBlock(final Bytes32 blockRoot) {
return retrieveSignedBlock(blockRoot).thenApply(res -> res.map(SignedBeaconBlock::getMessage));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Optional<SszBitvectorSchema<?>> getCommitteeBitsSchema() {
}

@Override
public AttestationElectra createFromBackingNode(TreeNode node) {
public AttestationElectra createFromBackingNode(final TreeNode node) {
return new AttestationElectra(this, node);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ static BeaconStateElectra required(final BeaconState state) {
}

private static <T extends SszData> void addItems(
MoreObjects.ToStringHelper stringBuilder, String keyPrefix, SszList<T> items) {
final MoreObjects.ToStringHelper stringBuilder,
final String keyPrefix,
final SszList<T> items) {
for (int i = 0; i < items.size(); i++) {
stringBuilder.add(keyPrefix + "[" + i + "]", items.get(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public SignedConsolidation.SignedConsolidationSchema getSignedConsolidationSchem
}

@Override
long getMaxValidatorPerAttestation(SpecConfig specConfig) {
long getMaxValidatorPerAttestation(final SpecConfig specConfig) {
return (long) specConfig.getMaxValidatorsPerCommittee() * specConfig.getMaxCommitteesPerSlot();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public interface AttestationBitsAggregator {

static AttestationBitsAggregator fromEmptyFromAttestationSchema(
AttestationSchema<?> attestationSchema, Optional<Int2IntMap> committeesSize) {
final AttestationSchema<?> attestationSchema, final Optional<Int2IntMap> committeesSize) {
return attestationSchema
.toVersionElectra()
.map(
Expand All @@ -34,7 +34,7 @@ static AttestationBitsAggregator fromEmptyFromAttestationSchema(
.orElseGet(() -> AttestationBitsAggregatorPhase0.fromAttestationSchema(attestationSchema));
}

static AttestationBitsAggregator of(ValidatableAttestation attestation) {
static AttestationBitsAggregator of(final ValidatableAttestation attestation) {
return attestation
.getAttestation()
.getCommitteeBits()
Expand All @@ -52,7 +52,7 @@ static AttestationBitsAggregator of(ValidatableAttestation attestation) {
}

static AttestationBitsAggregator of(
Attestation attestation, Optional<Int2IntMap> committeesSize) {
final Attestation attestation, final Optional<Int2IntMap> committeesSize) {
return attestation
.getCommitteeBits()
.<AttestationBitsAggregator>map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ static AttestationBitsAggregator fromAttestationSchema(
}

@Override
public void or(AttestationBitsAggregator other) {
public void or(final AttestationBitsAggregator other) {
or(other.getCommitteeBits(), other.getAggregationBits(), false);
}

@Override
public boolean aggregateWith(Attestation other) {
public boolean aggregateWith(final Attestation other) {
return or(other.getCommitteeBitsRequired(), other.getAggregationBits(), true);
}

@Override
public void or(Attestation other) {
public void or(final Attestation other) {
or(other.getCommitteeBitsRequired(), other.getAggregationBits(), false);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ private Int2IntMap calculateCommitteeStartingPositions(final SszBitvector commit
}

@Override
public boolean isSuperSetOf(Attestation other) {
public boolean isSuperSetOf(final Attestation other) {
if (!committeeBits.isSuperSetOf(other.getCommitteeBitsRequired())) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ class AttestationBitsAggregatorPhase0 implements AttestationBitsAggregator {
this.aggregationBits = aggregationBits;
}

static AttestationBitsAggregator fromAttestationSchema(AttestationSchema<?> attestationSchema) {
static AttestationBitsAggregator fromAttestationSchema(
final AttestationSchema<?> attestationSchema) {
return new AttestationBitsAggregatorPhase0(attestationSchema.createEmptyAggregationBits());
}

@Override
public void or(AttestationBitsAggregator other) {
public void or(final AttestationBitsAggregator other) {
aggregationBits = aggregationBits.or(other.getAggregationBits());
}

@Override
public boolean aggregateWith(Attestation other) {
public boolean aggregateWith(final Attestation other) {
return aggregateWith(other.getAggregationBits());
}

Expand All @@ -50,12 +51,12 @@ private boolean aggregateWith(final SszBitlist otherAggregationBits) {
}

@Override
public void or(Attestation other) {
public void or(final Attestation other) {
aggregationBits = aggregationBits.or(other.getAggregationBits());
}

@Override
public boolean isSuperSetOf(Attestation other) {
public boolean isSuperSetOf(final Attestation other) {
return aggregationBits.isSuperSetOf(other.getAggregationBits());
}

Expand Down
2 changes: 1 addition & 1 deletion fuzz/src/main/java/tech/pegasys/teku/fuzz/FuzzUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public Optional<byte[]> fuzzBlsToExecutionChange(final byte[] input) {
}
}

private <T extends SszData> T deserialize(byte[] data, SszSchema<T> type) {
private <T extends SszData> T deserialize(final byte[] data, final SszSchema<T> type) {
// allow exception to propagate on failure - indicates a preprocessing or deserializing error
T structuredInput = type.sszDeserialize(Bytes.wrap(data));
if (structuredInput == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public static ContainerSchema2<AttestationFuzzInput, BeaconState, Attestation> c
}

private AttestationFuzzInput(
ContainerSchema2<AttestationFuzzInput, BeaconState, Attestation> type, TreeNode backingNode) {
final ContainerSchema2<AttestationFuzzInput, BeaconState, Attestation> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class AttesterSlashingFuzzInput
}

private AttesterSlashingFuzzInput(
ContainerSchema2<AttesterSlashingFuzzInput, BeaconState, AttesterSlashing> type,
TreeNode backingNode) {
final ContainerSchema2<AttesterSlashingFuzzInput, BeaconState, AttesterSlashing> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class BeaconBlockBodyFuzzInput
}

public BeaconBlockBodyFuzzInput(
ContainerSchema2<BeaconBlockBodyFuzzInput, BeaconState, BeaconBlockBodyCapella> type,
TreeNode backingNode) {
final ContainerSchema2<BeaconBlockBodyFuzzInput, BeaconState, BeaconBlockBodyCapella> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public static ContainerSchema2<BlockFuzzInput, BeaconState, SignedBeaconBlock> c
}

private BlockFuzzInput(
ContainerSchema2<BlockFuzzInput, BeaconState, SignedBeaconBlock> type, TreeNode backingNode) {
final ContainerSchema2<BlockFuzzInput, BeaconState, SignedBeaconBlock> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public static ContainerSchema2<BlockHeaderFuzzInput, BeaconState, BeaconBlock> c
}

private BlockHeaderFuzzInput(
ContainerSchema2<BlockHeaderFuzzInput, BeaconState, BeaconBlock> type, TreeNode backingNode) {
final ContainerSchema2<BlockHeaderFuzzInput, BeaconState, BeaconBlock> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public class BlsToExecutionChangeFuzzInput
}

public BlsToExecutionChangeFuzzInput(
ContainerSchema2<BlsToExecutionChangeFuzzInput, BeaconState, SignedBlsToExecutionChange> type,
TreeNode backingNode) {
final ContainerSchema2<BlsToExecutionChangeFuzzInput, BeaconState, SignedBlsToExecutionChange>
type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public static ContainerSchema2<DepositFuzzInput, BeaconState, Deposit> createSch
}

public DepositFuzzInput(
ContainerSchema2<DepositFuzzInput, BeaconState, Deposit> type, TreeNode backingNode) {
final ContainerSchema2<DepositFuzzInput, BeaconState, Deposit> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class ProposerSlashingFuzzInput
}

public ProposerSlashingFuzzInput(
ContainerSchema2<ProposerSlashingFuzzInput, BeaconState, ProposerSlashing> type,
TreeNode backingNode) {
final ContainerSchema2<ProposerSlashingFuzzInput, BeaconState, ProposerSlashing> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public static ContainerSchema2<SyncAggregateFuzzInput, BeaconState, SyncAggregat
}

public SyncAggregateFuzzInput(
ContainerSchema2<SyncAggregateFuzzInput, BeaconState, SyncAggregate> type,
TreeNode backingNode) {
final ContainerSchema2<SyncAggregateFuzzInput, BeaconState, SyncAggregate> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class VoluntaryExitFuzzInput
}

public VoluntaryExitFuzzInput(
ContainerSchema2<VoluntaryExitFuzzInput, BeaconState, SignedVoluntaryExit> type,
TreeNode backingNode) {
final ContainerSchema2<VoluntaryExitFuzzInput, BeaconState, SignedVoluntaryExit> type,
final TreeNode backingNode) {
super(type, backingNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ private void validate() {
"gossipedSignedBlsToExecutionChangeProcessor", gossipedSignedBlsToExecutionChangeProcessor);
}

private void assertNotNull(String fieldName, Object fieldValue) {
private void assertNotNull(final String fieldName, final Object fieldValue) {
checkState(fieldValue != null, "Field " + fieldName + " must be set.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private P2PConfig(
final int batchVerifyMaxBatchSize,
final boolean batchVerifyStrictThreadLimitEnabled,
final boolean p2pDumpsToFileEnabled,
boolean allTopicsFilterEnabled) {
final boolean allTopicsFilterEnabled) {
this.spec = spec;
this.networkConfig = networkConfig;
this.discoveryConfig = discoveryConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public synchronized void removeSubscription(final int subnet) {
subnetSubscriptions.set(values);
}

public synchronized long subscribeToUpdates(ValueObserver<Iterable<Integer>> observer) {
public synchronized long subscribeToUpdates(final ValueObserver<Iterable<Integer>> observer) {
return subnetSubscriptions.subscribe(observer);
}

public void unsubscribe(long subscriptionId) {
public void unsubscribe(final long subscriptionId) {
subnetSubscriptions.unsubscribe(subscriptionId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Eth2TopicHandler<T> getTopicHandler() {
return topicHandler;
}

protected void publishMessage(T message) {
protected void publishMessage(final T message) {
channel.ifPresent(c -> c.gossip(gossipEncoding.encode(message)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void configureDynamicTopics(
final Eth2Context eth2Context) {}
};

static GossipConfigurator scoringEnabled(Spec spec) {
static GossipConfigurator scoringEnabled(final Spec spec) {
return new GossipScoringConfigurator(spec);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public <T extends SszData> Bytes encode(final T value) {
}

@Override
public <T extends SszData> T decodeMessage(PreparedGossipMessage message, SszSchema<T> valueType)
throws DecodingException {
public <T extends SszData> T decodeMessage(
final PreparedGossipMessage message, final SszSchema<T> valueType) throws DecodingException {
try {
return sszCodec.decode(message.getDecodedMessage().getDecodedMessageOrElseThrow(), valueType);
} catch (GossipDecodingException e) {
Expand All @@ -50,7 +50,7 @@ public <T extends SszData> T decodeMessage(PreparedGossipMessage message, SszSch

@Override
public Eth2PreparedGossipMessageFactory createPreparedGossipMessageFactory(
ForkDigestToMilestone forkDigestToMilestone) {
final ForkDigestToMilestone forkDigestToMilestone) {
return new SnappyPreparedGossipMessageFactory(snappyCompressor, forkDigestToMilestone);
}
}
Loading

0 comments on commit 9522d35

Please sign in to comment.