mirror of https://github.com/apache/kafka.git
KAFKA-17763 Remove Utils.covariantCast and use var for type inference (#17468)
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
4529cc4e98
commit
d55b4e640c
|
@ -1526,11 +1526,6 @@ public final class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <S> Iterator<S> covariantCast(Iterator<? extends S> iterator) {
|
||||
return (Iterator<S>) iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string is null, empty or whitespace only.
|
||||
* @param str a string to be checked
|
||||
|
|
|
@ -105,7 +105,7 @@ public final class FileRawSnapshotTest {
|
|||
int countBatches = 0;
|
||||
int countRecords = 0;
|
||||
|
||||
Iterator<RecordBatch> batches = Utils.covariantCast(snapshot.records().batchIterator());
|
||||
var batches = snapshot.records().batchIterator();
|
||||
while (batches.hasNext()) {
|
||||
RecordBatch batch = batches.next();
|
||||
countBatches += 1;
|
||||
|
@ -191,7 +191,7 @@ public final class FileRawSnapshotTest {
|
|||
int countBatches = 0;
|
||||
int countRecords = 0;
|
||||
|
||||
Iterator<RecordBatch> batches = Utils.covariantCast(snapshot.records().batchIterator());
|
||||
var batches = snapshot.records().batchIterator();
|
||||
while (batches.hasNext()) {
|
||||
RecordBatch batch = batches.next();
|
||||
countBatches += 1;
|
||||
|
@ -245,7 +245,7 @@ public final class FileRawSnapshotTest {
|
|||
int countBatches = 0;
|
||||
int countRecords = 0;
|
||||
|
||||
Iterator<RecordBatch> batches = Utils.covariantCast(snapshot.records().batchIterator());
|
||||
var batches = snapshot.records().batchIterator();
|
||||
while (batches.hasNext()) {
|
||||
RecordBatch batch = batches.next();
|
||||
countBatches += 1;
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.apache.kafka.common.record.Record;
|
|||
import org.apache.kafka.common.record.RecordBatch;
|
||||
import org.apache.kafka.common.utils.BufferSupplier;
|
||||
import org.apache.kafka.common.utils.BufferSupplier.GrowableBufferSupplier;
|
||||
import org.apache.kafka.common.utils.Utils;
|
||||
import org.apache.kafka.raft.Batch;
|
||||
import org.apache.kafka.raft.ControlRecord;
|
||||
import org.apache.kafka.raft.OffsetAndEpoch;
|
||||
|
@ -209,7 +208,7 @@ public final class SnapshotWriterReaderTest {
|
|||
|
||||
int countRecords = 0;
|
||||
|
||||
Iterator<RecordBatch> recordBatches = Utils.covariantCast(snapshot.records().batchIterator());
|
||||
var recordBatches = snapshot.records().batchIterator();
|
||||
|
||||
assertTrue(recordBatches.hasNext());
|
||||
RecordBatch batch = recordBatches.next();
|
||||
|
|
Loading…
Reference in New Issue