Skip to content
Merged
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@

<!-- Allows the use of the @SuppressWarnings annotation in the code -->
<module name="SuppressWarningsHolder"/>

<module name="ModifierOrder"/>

</module>

<module name="SuppressionFilter">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
*
*/
final class ClusterConnectionStates {
final static int RECONNECT_BACKOFF_EXP_BASE = 2;
final static double RECONNECT_BACKOFF_JITTER = 0.2;
final static int CONNECTION_SETUP_TIMEOUT_EXP_BASE = 2;
final static double CONNECTION_SETUP_TIMEOUT_JITTER = 0.2;
static final int RECONNECT_BACKOFF_EXP_BASE = 2;
static final double RECONNECT_BACKOFF_JITTER = 0.2;
static final int CONNECTION_SETUP_TIMEOUT_EXP_BASE = 2;
static final double CONNECTION_SETUP_TIMEOUT_JITTER = 0.2;
private final Map<String, NodeConnectionState> nodeState;
private final Logger log;
private final HostResolver hostResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
@InterfaceStability.Evolving
public class CreateTopicsResult {
final static int UNKNOWN = -1;
static final int UNKNOWN = -1;

private final Map<String, KafkaFuture<TopicMetadataAndConfig>> futures;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public KafkaFuture<Map<TopicPartitionReplica, ReplicaLogDirInfo>> all() {
});
}

static public class ReplicaLogDirInfo {
public static class ReplicaLogDirInfo {
// The current log directory of the replica of this partition on the given broker.
// Null if no replica is not found for this partition on the given broker.
private final String currentReplicaLogDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
* The API of this class is evolving, see {@link Admin} for details.
*/
@InterfaceStability.Evolving
final public class ElectLeadersOptions extends AbstractOptions<ElectLeadersOptions> {
public final class ElectLeadersOptions extends AbstractOptions<ElectLeadersOptions> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* The API of this class is evolving, see {@link Admin} for details.
*/
@InterfaceStability.Evolving
final public class ElectLeadersResult {
public final class ElectLeadersResult {
private final KafkaFuture<Map<TopicPartition, Optional<Throwable>>> electionFuture;

ElectLeadersResult(KafkaFuture<Map<TopicPartition, Optional<Throwable>>> electionFuture) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3483,7 +3483,7 @@ private Set<AclOperation> validAclOperations(final int authorizedOperations) {
.collect(Collectors.toSet());
}

private final static class ListConsumerGroupsResults {
private static final class ListConsumerGroupsResults {
private final List<Throwable> errors;
private final HashMap<String, ConsumerGroupListing> listings;
private final HashSet<Node> remaining;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public enum TransactionState {
PREPARE_EPOCH_FENCE("PrepareEpochFence"),
UNKNOWN("Unknown");

private final static Map<String, TransactionState> NAME_TO_ENUM = Arrays.stream(values())
private static final Map<String, TransactionState> NAME_TO_ENUM = Arrays.stream(values())
.collect(Collectors.toMap(state -> state.name, Function.identity()));

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.List;
import java.util.Objects;

final public class AdminBootstrapAddresses {
public final class AdminBootstrapAddresses {
private final boolean usingBootstrapControllers;
private final List<InetSocketAddress> addresses;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
* Note: Any change to this class is considered public and requires a KIP.
*/
public class ConsumerGroupMetadata {
final private String groupId;
final private int generationId;
final private String memberId;
final private Optional<String> groupInstanceId;
private final String groupId;
private final int generationId;
private final String memberId;
private final Optional<String> groupInstanceId;

public ConsumerGroupMetadata(String groupId,
int generationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@
*/
public class KafkaConsumer<K, V> implements Consumer<K, V> {

private final static ConsumerDelegateCreator CREATOR = new ConsumerDelegateCreator();
private static final ConsumerDelegateCreator CREATOR = new ConsumerDelegateCreator();

private final ConsumerDelegate<K, V> delegate;

Expand Down Expand Up @@ -1803,4 +1803,4 @@ KafkaConsumerMetrics kafkaConsumerMetrics() {
boolean updateAssignmentMetadataIfNeeded(final Timer timer) {
return delegate.updateAssignmentMetadataIfNeeded(timer);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
@InterfaceStability.Evolving
public class KafkaShareConsumer<K, V> implements ShareConsumer<K, V> {

private final static ShareConsumerDelegateCreator CREATOR = new ShareConsumerDelegateCreator();
private static final ShareConsumerDelegateCreator CREATOR = new ShareConsumerDelegateCreator();

private final ShareConsumerDelegate<K, V> delegate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public MemberData(List<TopicPartition> partitions, Optional<Integer> generation)
}
}

abstract protected MemberData memberData(Subscription subscription);
protected abstract MemberData memberData(Subscription subscription);

@Override
public Map<String, List<TopicPartition>> assignPartitions(Map<String, List<PartitionInfo>> partitionsPerTopic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
* This class manages the coordination process with the consumer coordinator.
*/
public final class ConsumerCoordinator extends AbstractCoordinator {
private final static TopicPartitionComparator COMPARATOR = new TopicPartitionComparator();
private static final TopicPartitionComparator COMPARATOR = new TopicPartitionComparator();

private final GroupRebalanceConfig rebalanceConfig;
private final Logger log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ public class MembershipManagerImpl implements MembershipManager {
/**
* TopicPartition comparator based on topic name and partition id.
*/
final static TopicPartitionComparator TOPIC_PARTITION_COMPARATOR = new TopicPartitionComparator();
static final TopicPartitionComparator TOPIC_PARTITION_COMPARATOR = new TopicPartitionComparator();

/**
* TopicIdPartition comparator based on topic name and partition id (ignoring ID while sorting,
* as this is sorted mainly for logging purposes).
*/
final static TopicIdPartitionComparator TOPIC_ID_PARTITION_COMPARATOR = new TopicIdPartitionComparator();
static final TopicIdPartitionComparator TOPIC_ID_PARTITION_COMPARATOR = new TopicIdPartitionComparator();

/**
* Group ID of the consumer group the member will be part of, provided when creating the current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class RequestState {

private final Logger log;
protected final String owner;
final static int RETRY_BACKOFF_EXP_BASE = 2;
final static double RETRY_BACKOFF_JITTER = 0.2;
static final int RETRY_BACKOFF_EXP_BASE = 2;
static final double RETRY_BACKOFF_JITTER = 0.2;
protected final ExponentialBackoff exponentialBackoff;
protected long lastSentMs = -1;
protected long lastReceivedMs = -1;
Expand Down Expand Up @@ -159,4 +159,4 @@ protected String toStringBase() {
public String toString() {
return getClass().getSimpleName() + "{" + toStringBase() + '}';
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public final class Utils {

final static class PartitionComparator implements Comparator<TopicPartition>, Serializable {
static final class PartitionComparator implements Comparator<TopicPartition>, Serializable {
private static final long serialVersionUID = 1L;
private final Map<String, List<String>> map;

Expand All @@ -46,7 +46,7 @@ public int compare(TopicPartition o1, TopicPartition o2) {
}
}

public final static class TopicPartitionComparator implements Comparator<TopicPartition>, Serializable {
public static final class TopicPartitionComparator implements Comparator<TopicPartition>, Serializable {
private static final long serialVersionUID = 1L;

@Override
Expand All @@ -62,7 +62,7 @@ public int compare(TopicPartition topicPartition1, TopicPartition topicPartition
}
}

public final static class TopicIdPartitionComparator implements Comparator<TopicIdPartition>, Serializable {
public static final class TopicIdPartitionComparator implements Comparator<TopicIdPartition>, Serializable {
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BuiltInPartitioner {
private final AtomicReference<StickyPartitionInfo> stickyPartitionInfo = new AtomicReference<>();

// Visible and used for testing only.
static volatile public Supplier<Integer> mockRandom = null;
public static volatile Supplier<Integer> mockRandom = null;

/**
* BuiltInPartitioner constructor.
Expand Down Expand Up @@ -331,7 +331,7 @@ public static int partitionForKey(final byte[] serializedKey, final int numParti
/**
* The partition load stats for each topic that are used for adaptive partition distribution.
*/
private final static class PartitionLoadStats {
private static final class PartitionLoadStats {
public final int[] cumulativeFrequencyTable;
public final int[] partitionIds;
public final int length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public boolean isCompressed() {
/**
* A callback and the associated FutureRecordMetadata argument to pass to it.
*/
final private static class Thunk {
private static final class Thunk {
final Callback callback;
final FutureRecordMetadata future;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ public PartitionerConfig() {
/*
* Metadata about a record just appended to the record accumulator
*/
public final static class RecordAppendResult {
public static final class RecordAppendResult {
public final FutureRecordMetadata future;
public final boolean batchIsFull;
public final boolean newBatchCreated;
Expand Down Expand Up @@ -1242,7 +1242,7 @@ public interface AppendCallbacks extends Callback {
/*
* The set of nodes that have at least one complete record batch in the accumulator
*/
public final static class ReadyCheckResult {
public static final class ReadyCheckResult {
public final Set<Node> readyNodes;
public final long nextReadyCheckDelayMs;
public final Set<String> unknownLeaderTopics;
Expand Down Expand Up @@ -1270,9 +1270,9 @@ public TopicInfo(LogContext logContext, String topic, int stickyBatchSize) {
* Node latency stats for each node that are used for adaptive partition distribution
* Visible for testing
*/
public final static class NodeLatencyStats {
volatile public long readyTimeMs; // last time the node had batches ready to send
volatile public long drainTimeMs; // last time the node was able to drain batches
public static final class NodeLatencyStats {
public volatile long readyTimeMs; // last time the node had batches ready to send
public volatile long drainTimeMs; // last time the node was able to drain batches

NodeLatencyStats(long nowMs) {
readyTimeMs = nowMs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public class SenderMetricsRegistry {

final static String TOPIC_METRIC_GROUP_NAME = "producer-topic-metrics";
static final String TOPIC_METRIC_GROUP_NAME = "producer-topic-metrics";

private final List<MetricNameTemplate> allTemplates;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ ProducerIdAndEpoch producerIdAndEpoch() {
return producerIdAndEpoch;
}

synchronized public void maybeUpdateProducerIdAndEpoch(TopicPartition topicPartition) {
public synchronized void maybeUpdateProducerIdAndEpoch(TopicPartition topicPartition) {
if (hasFatalError()) {
log.debug("Ignoring producer ID and epoch update request since the producer is in fatal error state");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public enum ConsumerGroupState {
ASSIGNING("Assigning"),
RECONCILING("Reconciling");

private final static Map<String, ConsumerGroupState> NAME_TO_ENUM = Arrays.stream(values())
private static final Map<String, ConsumerGroupState> NAME_TO_ENUM = Arrays.stream(values())
.collect(Collectors.toMap(state -> state.name.toUpperCase(Locale.ROOT), Function.identity()));

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum GroupType {
CONSUMER("Consumer"),
CLASSIC("Classic");

private final static Map<String, GroupType> NAME_TO_ENUM = Arrays.stream(values())
private static final Map<String, GroupType> NAME_TO_ENUM = Arrays.stream(values())
.collect(Collectors.toMap(type -> type.name.toLowerCase(Locale.ROOT), Function.identity()));

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public class KafkaException extends RuntimeException {

private final static long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

public KafkaException(String message, Throwable cause) {
super(message, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface BaseFunction<A, B> {
* @deprecated Since Kafka 3.0. Use the {@link BaseFunction} functional interface.
*/
@Deprecated
public static abstract class Function<A, B> implements BaseFunction<A, B> { }
public abstract static class Function<A, B> implements BaseFunction<A, B> { }

/**
* A consumer of two different types of object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum ShareGroupState {
DEAD("Dead"),
EMPTY("Empty");

private final static Map<String, ShareGroupState> NAME_TO_ENUM = Arrays.stream(values())
private static final Map<String, ShareGroupState> NAME_TO_ENUM = Arrays.stream(values())
.collect(Collectors.toMap(state -> state.name.toUpperCase(Locale.ROOT), Function.identity()));

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public enum AclOperation {
// Note: we cannot have more than 30 ACL operations without modifying the format used
// to describe ACL operations in MetadataResponse.

private final static HashMap<Byte, AclOperation> CODE_TO_VALUE = new HashMap<>();
private static final HashMap<Byte, AclOperation> CODE_TO_VALUE = new HashMap<>();

static {
for (AclOperation operation : AclOperation.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum AclPermissionType {
*/
ALLOW((byte) 3);

private final static HashMap<Byte, AclPermissionType> CODE_TO_VALUE = new HashMap<>();
private static final HashMap<Byte, AclPermissionType> CODE_TO_VALUE = new HashMap<>();

static {
for (AclPermissionType permissionType : AclPermissionType.values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class BrokerSecurityConfigs {
public static final String SSL_ALLOW_SAN_CHANGES_DOC = "Indicates whether changes to the certificate subject alternative names should be allowed during " +
"a dynamic reconfiguration of certificates or not.";

public final static String SASL_MECHANISM_INTER_BROKER_PROTOCOL_CONFIG = "sasl.mechanism.inter.broker.protocol";
public final static String SASL_MECHANISM_INTER_BROKER_PROTOCOL_DOC = "SASL mechanism used for inter-broker communication. Default is GSSAPI.";
public static final String SASL_MECHANISM_INTER_BROKER_PROTOCOL_CONFIG = "sasl.mechanism.inter.broker.protocol";
public static final String SASL_MECHANISM_INTER_BROKER_PROTOCOL_DOC = "SASL mechanism used for inter-broker communication. Default is GSSAPI.";

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public class TransactionAbortedException extends ApiException {

private final static long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

public TransactionAbortedException(String message, Throwable cause) {
super(message, cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class FatalExitError extends Error {

private final static long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

private final int statusCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* The schema for a compound record definition
*/
public class Schema extends Type {
private final static Object[] NO_VALUES = new Object[0];
private static final Object[] NO_VALUES = new Object[0];

private final BoundField[] fields;
private final Map<String, BoundField> fieldsByName;
Expand Down Expand Up @@ -229,7 +229,7 @@ private static void handleNode(Type node, Visitor visitor) {
/**
* Override one or more of the visit methods with the desired logic.
*/
public static abstract class Visitor {
public abstract static class Visitor {
public void visit(Schema schema) {}
public void visit(Type field) {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public final boolean isArray() {
/**
* A Type that can return its description for documentation purposes.
*/
public static abstract class DocumentedType extends Type {
public abstract static class DocumentedType extends Type {

/**
* Short name of the type to identify it in documentation;
Expand Down
Loading