Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Remove unnecessary Boolean boxing (#1667)
Browse files Browse the repository at this point in the history
### Motivation

There is some unnecessary boxing of `boolean` primitives in the code.
This PR removes that boxing.

### Modifications

* Replace `Boolean` with `boolean` when appropriate.

### Verifying this change

No new tests are added, but the changes are pretty minor and are easy to
understand. In all cases, we can see that the calling methods and the
usage of the variables expect a primitive `boolean`.

(cherry picked from commit bc1dee1)
  • Loading branch information
michaeljmarshall authored and Demogorgon314 committed Jan 11, 2023
1 parent 5302f3f commit 76843d2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ protected static ByteBuf responseToByteBuf(AbstractResponse response, KafkaHeade
}
}

protected Boolean channelReady() {
protected boolean channelReady() {
return hasAuthenticated();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ private void endTransaction(String transactionalId,
Long producerId,
Short producerEpoch,
TransactionResult txnMarkerResult,
Boolean isFromClient,
boolean isFromClient,
Consumer<Errors> callback) {
AtomicBoolean isEpochFence = new AtomicBoolean(false);
if (transactionalId == null || transactionalId.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ private static class BumpEpochResult {
public TxnTransitMetadata prepareProducerIdRotation(Long newProducerId,
Integer newTxnTimeoutMs,
Long updateTimestamp,
Boolean recordLastEpoch) {
boolean recordLastEpoch) {
if (hasPendingTransaction()) {
throw new IllegalStateException("Cannot rotate producer ids while a transaction is still pending");
}
Expand Down Expand Up @@ -489,7 +489,7 @@ public void addPartitions(Set<TopicPartition> partitions) {
topicPartitions.addAll(partitions);
}

public Boolean pendingTransitionInProgress() {
public boolean pendingTransitionInProgress() {
return this.pendingState.isPresent();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public static void writeOpStat(SimpleTextOutputStream w, String name, DataSketch
}

private static void writeQuantile(SimpleTextOutputStream w, DataSketchesOpStatsLogger opStat, String name,
Boolean success, double quantile) {
boolean success, double quantile) {
w.write(name)
.write("{success=\"").write(success.toString())
.write("{success=\"").write(success)
.write("\",quantile=\"").write(Double.toString(quantile));
if (!opStat.getLabels().isEmpty()) {
w.write("\", ");
Expand All @@ -105,8 +105,8 @@ private static void writeQuantile(SimpleTextOutputStream w, DataSketchesOpStatsL
}

private static void writeCount(SimpleTextOutputStream w, DataSketchesOpStatsLogger opStat, String name,
Boolean success) {
w.write(name).write("_count{success=\"").write(success.toString());
boolean success) {
w.write(name).write("_count{success=\"").write(success);
if (!opStat.getLabels().isEmpty()) {
w.write("\", ");
writeLabelsNoBraces(w, opStat.getLabels());
Expand All @@ -118,8 +118,8 @@ private static void writeCount(SimpleTextOutputStream w, DataSketchesOpStatsLogg
}

private static void writeSum(SimpleTextOutputStream w, DataSketchesOpStatsLogger opStat, String name,
Boolean success) {
w.write(name).write("_sum{success=\"").write(success.toString());
boolean success) {
w.write(name).write("_sum{success=\"").write(success);
if (!opStat.getLabels().isEmpty()) {
w.write("\", ");
writeLabelsNoBraces(w, opStat.getLabels());
Expand Down

0 comments on commit 76843d2

Please sign in to comment.