Sample

int-241dcdf23fba-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines170

Scores

MethodScoreScale
Posnett0.1350–1; higher is more readable
Scalabrino0.8710–1; higher is more readable
Dorn0.1550–1; higher is more readable
Mi0.0390–1; higher is more readable
LLOC28Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.2690–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() { {int lI0O_22d4c374=0xBEC3;boolean lI0O_e56027af=true;do{lI0O_22d4c374^=0xBEC3;lI0O_e56027af=false;}while(lI0O_e56027af);} } /** * 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.2182.322−72.017
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.475−6.712

Intercept 8.87 + feature contributions = -1.859 (log-odds).
Score = sigmoid(-1.859) = 0.135.

Score0.871

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.988−2.645
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.947+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.716

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

Score0.039
Score28
Run 1

The code is a well-structured Java interface with clear purpose and excellent documentation. It maintains flat nesting throughout, with each method performing a single, well-defined action. The interface is organized logically, grouping related methods (config management, target states, session keys, restart requests) and includes a nested UpdateListener interface with clear callback definitions. Reading flow is natural and predictable. However, the score is reduced due to a suspicious obfuscated empty do-while loop in the claimWritePrivileges() default method, which appears to be dead code or accidental obfuscation. This harms clarity and raises concerns about code quality. The javadoc comments are thorough and helpful, though slightly verbose in places. Overall, the code demonstrates strong readability with good separation of concerns, clear naming conventions, and appropriate documentation, but the odd obfuscated loop is a notable flaw.

Run 2

The code is an interface with clear, well-documented methods, making its intent highly readable. The structure is logical, grouping related methods (configuration, target state, session key, restart requests) together. Nesting is minimal and appropriate. Javadoc comments thoroughly explain each method's purpose and parameters. The one obfuscated line inside the default method reduces clarity slightly but is otherwise an isolated anomaly. Overall, the code is concise, follows natural reading flow, and adheres to one-action-per-line principles.

Run 3

The code is highly readable as a clean interface definition. Structure is logical, with clear separation between methods and the nested UpdateListener interface. Documentation is thorough with consistent Javadoc. Nesting is minimal, limited to the single nested interface. Intent is clear throughout - each method name and signature communicates its purpose. The code is concise for what it represents, with no unnecessary complexity. Action granularity is appropriate for an interface (one method declaration per logical action). Reading flow is natural and follows consistent ordering. The only notable issue is an obfuscated no-op block in claimWritePrivileges() that appears to be accidentally included code, which slightly breaks the otherwise clean style and clarity of intent.

Run 1

Code Structure: The interface is logically organized, with configuration operations and a separate nested listener interface. Nesting: Mostly flat declarations; the default method adds an unnecessary block and loop. Clarity of intent: Descriptive method names and detailed Javadocs clarify most responsibilities, but claimWritePrivileges contains opaque variable names and pointless operations despite being documented as a no-op. Code length: Appropriate for the API's scope, though some comments are verbose and the default implementation is unnecessary. Action granularity: Most declarations occupy individual lines, but the default method compresses multiple declarations, assignments, and control flow onto one line. Reading flow: Consistent documentation and spacing make the interface easy to scan, interrupted sharply by the obfuscated default-method body.

Run 2

Code Structure: The interface is logically organized, with storage operations followed by a cohesive nested listener interface. Nesting: Mostly flat declarations; the unnecessary block and do-while loop in claimWritePrivileges add localized complexity. Clarity of intent: Descriptive method names and Javadocs clearly explain most responsibilities, but opaque variable names and meaningless operations obscure the documented no-op implementation. Code length: Appropriate for the API and its documentation, except for the redundant implementation block and some lengthy comment lines. Action granularity: Most declarations occupy separate lines, but claimWritePrivileges compresses multiple declarations, assignments, and control-flow constructs onto one line. Reading flow: Consistent spacing and documentation make the interface easy to scan; the poorly formatted, obfuscated default method sharply interrupts that flow.

Run 3

Code Structure: The interface is logically organized, with storage operations followed by a dedicated update-listener interface. Nesting: Mostly flat declarations; claimWritePrivileges introduces an unnecessary block and loop. Clarity of intent: Descriptive method names and thorough Javadocs make most responsibilities clear, but obfuscated variables and meaningless operations obscure the default method's documented no-op behavior. Code length: Appropriate for the API, though some documentation is verbose and the default implementation adds needless code. Action granularity: Most declarations occupy individual lines, but the entire default-method block compresses multiple declarations and operations onto one line. Reading flow: Consistent spacing and documentation generally support natural scanning; the unindented, compressed block sharply interrupts that flow.