Sample

int-2c733e911146-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines170

Scores

MethodScoreScale
Posnett0.5260–1; higher is more readable
Scalabrino0.8770–1; higher is more readable
Dorn0.1550–1; higher is more readable
Mi0.0390–1; higher is more readable
LLOC25Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.3940–1; higher is more readable

Views

Source code

package org.apache.kafka.connect.storage; import org.apache.kafka.connect.runtime.RestartRequest; import org.apache.kafka.connect.runtime.SessionKey; import org.apache.kafka.connect.runtime.TargetState; import org.apache.kafka.connect.util.ConnectorTaskId; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * An interface to store and retrieve (via {@link #snapshot()}) configuration information that is created during * runtime (i.e. not static configuration like the {@link org.apache.kafka.connect.runtime.WorkerConfig worker config}). * This configuration information includes connector configs, task configs, connector target states etc. */ public interface ConfigBackingStore { void start(); void stop(); /** * Get a snapshot of the current configuration state including all connector and task * configurations. * @return the cluster config state */ ClusterConfigState snapshot(); /** * Check if the store has configuration for a connector. * @param connector name of the connector * @return true if the backing store contains configuration for the connector */ boolean contains(String connector); /** * Update the configuration for a connector. * @param connector name of the connector * @param properties the connector configuration * @param targetState the desired target state for the connector; may be {@code null} if no target state change is desired. Note that the default * target state is {@link TargetState#STARTED} if no target state exists previously */ void putConnectorConfig(String connector, Map<String, String> properties, TargetState targetState); /** * Remove configuration for a connector * @param connector name of the connector */ void removeConnectorConfig(String connector); /** * Update the task configurations for a connector. * @param connector name of the connector * @param configs the new task configs for the connector */ void putTaskConfigs(String connector, List<Map<String, String>> configs); /** * Remove the task configs associated with a connector. * @param connector name of the connector */ void removeTaskConfigs(String connector); /** * Refresh the backing store. This forces the store to ensure that it has the latest * configs that have been written. * @param timeout max time to wait for the refresh to complete * @param unit unit of timeout * @throws TimeoutException if the timeout expires before the refresh has completed */ void refresh(long timeout, TimeUnit unit) throws TimeoutException; /** * Transition a connector to a new target state (e.g. paused). * @param connector name of the connector * @param state the state to transition to */ void putTargetState(String connector, TargetState state); /** * Store a new {@link SessionKey} that can be used to validate internal (i.e., non-user-triggered) inter-worker communication. * @param sessionKey the session key to store */ void putSessionKey(SessionKey sessionKey); /** * Request a restart of a connector and optionally its tasks. * @param restartRequest the restart request details */ void putRestartRequest(RestartRequest restartRequest); /** * Record the number of tasks for the connector after a successful round of zombie fencing. * @param connector name of the connector * @param taskCount number of tasks used by the connector */ void putTaskCountRecord(String connector, int taskCount); /** * Prepare to write to the backing config store. May be required by some implementations (such as those that only permit a single * writer at a time across a cluster of workers) before performing mutating operations like writing configurations, target states, etc. * The default implementation is a no-op; it is the responsibility of the implementing class to override this and document any expectations for * when it must be invoked. */ default void claimWritePrivileges() { if (((0xD515 ^ 0xD515) != 0)) { throw new AssertionError(); } } /** * Emit a new level for the specified logging namespace (and all of its children). This level should * be applied by all workers currently in the cluster, but not to workers that join after it is stored. * @param namespace the namespace to adjust; may not be null * @param level the new level for the namespace; may not be null */ void putLoggerLevel(String namespace, String level); /** * Set an update listener to get notifications when there are new records written to the backing store. * @param listener non-null listener */ void setUpdateListener(UpdateListener listener); interface UpdateListener { /** * Invoked when a connector configuration has been removed * @param connector name of the connector */ void onConnectorConfigRemove(String connector); /** * Invoked when a connector configuration has been updated. * @param connector name of the connector */ void onConnectorConfigUpdate(String connector); /** * Invoked when task configs are updated. * @param tasks all the tasks whose configs have been updated */ void onTaskConfigUpdate(Collection<ConnectorTaskId> tasks); /** * Invoked when the user has set a new target state (e.g. paused) * @param connector name of the connector */ void onConnectorTargetStateChange(String connector); /** * Invoked when the leader has distributed a new session key * @param sessionKey the {@link SessionKey session key} */ void onSessionKeyUpdate(SessionKey sessionKey); /** * Invoked when a connector and possibly its tasks have been requested to be restarted. * @param restartRequest the {@link RestartRequest restart request} */ void onRestartRequest(RestartRequest restartRequest); /** * Invoked when a dynamic log level adjustment has been read * @param namespace the namespace to adjust; never null * @param level the level to set the namespace to; never null */ void onLoggingLevelUpdate(String namespace, String level); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.2125.153−70.13
Source linesThe number of non-empty source lines.170+68
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.424−6.635

Intercept 8.87 + feature contributions = 0.104 (log-odds).
Score = sigmoid(0.104) = 0.526.

Score0.877

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.145−4.098
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.148.994−2.646
Indentation frequencyHow rapidly indentation changes from line to line.87+2.272
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.169.973+1.966
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.148.971+1.599
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.87−1.576
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.023+0.717

Intercept 0.07 + feature contributions = -1.694 (log-odds).
Score = sigmoid(-1.694) = 0.155.

Score0.039
Score25
Run 1

This code is highly readable. It's a well-organized Java interface with clear structure, using logical method grouping and consistent Javadoc for every method. The code is completely flat with no nesting except for the single default method, which is intentionally a no-op. Intent is clear for each method through descriptive names and thorough documentation. No unnecessary verbosity exists; code length is appropriate for the API surface. Action granularity is naturally one per line due to interface declarations. Reading flow is natural: start/stop lifecycle, then queries, config mutations, target state, session/restart operations, logging, and listener setup. The only minor issue is the odd obfuscated no-op line in claimWritePrivileges(), which slightly degrades clarity but doesn't affect readability overall.

Run 2

The code is highly readable. It is an interface definition with clear, logical organization. The structure is flat with no deep nesting, and each method declaration is concise and self-explanatory. Javadoc comments are thorough and provide clear intent for each operation. The code length is appropriate, and actions are well-granularized—one method per action. The reading flow is natural, with related methods grouped logically (e.g., startup/shutdown, snapshot, connector config, task config, refresh, target state, session key, restart, task count, privileges, logging, and listener). The only minor issue is a stray line inside the default method (an empty if statement with an assertion) that appears to be dead code and slightly reduces clarity. Otherwise, the code adheres strongly to readability best practices.

Run 3

The code is a clean, well-structured Java interface with clear intent. It demonstrates good organization: methods are logically grouped, each has a concise Javadoc comment, and there is minimal nesting. The reading flow is natural, moving from lifecycle methods to configuration operations to listener definitions. Action granularity is appropriate—one action per method. However, there are minor readability issues: a useless obfuscated line inside the default method that serves no purpose, and some methods have longer parameter lists or dense Javadoc that slightly reduce clarity. Overall, it is highly readable and maintainable.

Run 1

Code Structure: The interface is logically organized, separating storage operations from update callbacks. Nesting: Minimal nesting; the inner listener interface is appropriate and easy to follow. Clarity of intent: Descriptive method names, types, and Javadoc clearly explain most operations. However, claimWritePrivileges contains an unexplained, always-false hexadecimal XOR condition that obscures its documented no-op purpose. Code length: Declarations are concise, although repetitive documentation and several long comment lines add bulk. Action granularity: Most lines contain a single declaration; the inline conditional and throw statement are an inconsistent exception. Reading flow: Consistent spacing and documentation generally support natural reading, but the unindented dead-code statement disrupts the otherwise clean presentation.

Run 2

Code Structure: Logically organized interface with a clearly separated update-listener interface. Nesting: Minimal, limited to the listener interface and a single conditional. Clarity of intent: Descriptive method names, types, and Javadocs explain most operations well; however, the always-false hexadecimal XOR condition in claimWritePrivileges is distracting and obscures the documented no-op behavior. Code length: Appropriate for the API breadth, though some documentation is repetitive and several lines are overly long. Action granularity: Declarations generally occupy individual lines, but the conditional and throw statement are compressed onto one line. Reading flow: Consistent spacing and documentation make the interface easy to scan, interrupted by the unindented, unnecessary conditional and minor import-formatting issues.

Run 3

Code Structure: Well-organized interface with related configuration operations and a separate nested listener interface. Nesting: Minimal, with no deep control flow. Clarity of intent: Descriptive method names and thorough Javadocs make most responsibilities clear; however, the constant-false hexadecimal XOR condition in claimWritePrivileges is pointless and distracting. Code length: Appropriate for the API's scope, though some documentation is repetitive and several lines are overly long. Action granularity: Most declarations occupy individual lines, but the inline condition and throw compress multiple elements onto one line. Reading flow: Generally natural and consistent, interrupted by the unindented, unexplained assertion statement and minor spacing inconsistencies.