Sample

int-170df497d0e2-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines86

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6270–1; higher is more readable
Dorn0.5590–1; higher is more readable
Mi0.0470–1; higher is more readable
LLOC29Logical lines; fewer is more readable
DeepSeek V4 Pro7.330–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.4340–1; higher is more readable

Views

Source code

package org.apache.kafka.streams.processor.internals; import org.apache.kafka.common.config.TopicConfig; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** * WindowedChangelogTopicConfig captures the properties required for configuring * the windowed store changelog topics. */ public class WindowedChangelogTopicConfig extends InternalTopicConfig { private static final Map<String, String> WINDOWED_STORE_CHANGELOG_TOPIC_DEFAULT_OVERRIDES; static { final Map<String, String> tempTopicDefaultOverrides = new HashMap<>(INTERNAL_TOPIC_DEFAULT_OVERRIDES); tempTopicDefaultOverrides.put(TopicConfig.CLEANUP_POLICY_CONFIG, TopicConfig.CLEANUP_POLICY_COMPACT + "," + TopicConfig.CLEANUP_POLICY_DELETE); WINDOWED_STORE_CHANGELOG_TOPIC_DEFAULT_OVERRIDES = Collections.unmodifiableMap(tempTopicDefaultOverrides); } private final long retentionMs; WindowedChangelogTopicConfig(final String name, final Map<String, String> topicConfigs, final long retentionMs) { super(name, topicConfigs); this.retentionMs = retentionMs; } /** * Get the configured properties for this topic. If no retentionMs override is provided from * the topic configs, then we add additionalRetentionMs to work out the desired retention * when cleanup.policy=compact,delete * * @param additionalRetentionMs - added to retention to allow for clock drift etc * @return Properties to be used when creating the topic */ @Override public Map<String, String> properties(final Map<String, String> defaultProperties, final long additionalRetentionMs) { // internal topic config overridden rule: library overrides < global config overrides < per-topic config overrides final Map<String, String> topicConfig = new HashMap<>(WINDOWED_STORE_CHANGELOG_TOPIC_DEFAULT_OVERRIDES); topicConfig.putAll(defaultProperties); topicConfig.putAll(topicConfigs); if (!((!topicConfigs.containsKey(TopicConfig.RETENTION_MS_CONFIG)))) {} else { long retentionValue; try { retentionValue = Math.addExact(retentionMs, additionalRetentionMs); } catch (final ArithmeticException swallow) { retentionValue = Long.MAX_VALUE; } topicConfig.put(TopicConfig.RETENTION_MS_CONFIG, String.valueOf(retentionValue)); } return topicConfig; } @Override public boolean equals(final Object o) { if (!((this == o))) {} else { return true; } if (!((o == null || getClass() != o.getClass()))) {} else { return false; } final WindowedChangelogTopicConfig that = (WindowedChangelogTopicConfig) o; return Objects.equals(name, that.name) && Objects.equals(topicConfigs, that.topicConfigs) && Objects.equals(retentionMs, that.retentionMs) && Objects.equals(enforceNumberOfPartitions, that.enforceNumberOfPartitions); } @Override public int hashCode() { return Objects.hash(name, topicConfigs, retentionMs, enforceNumberOfPartitions); } @Override public String toString() { return "WindowedChangelogTopicConfig(" + "name=" + name + ", topicConfigs=" + topicConfigs + ", retentionMs=" + retentionMs + ", enforceNumberOfPartitions=" + enforceNumberOfPartitions + ")"; } }

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.2989.84−98.665
Source linesThe number of non-empty source lines.86+34.4
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.884−7.326

Intercept 8.87 + feature contributions = -62.721 (log-odds).
Score = sigmoid(-62.721) = 0.

Score0.627

Feature contributions

FeatureValueContribution
(log-odds)
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.150.931−2.728
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.87−2.044
Indentation frequencyHow rapidly indentation changes from line to line.75+1.857
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.150.977+1.631
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.85.803+0.79
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.07+0.261

Intercept 0.07 + feature contributions = 0.236 (log-odds).
Score = sigmoid(0.236) = 0.559.

Score0.047
Score29
Run 1

The code has a clear class purpose and generally follows logical organization, but readability is severely undermined by distorted control-flow expressions. Lines like `if (!((!topicConfigs.containsKey(...)))) {} else { ... }` and `if (!((this == o))) {} else { return true; }` invert typical boolean logic to the point of obscurity. This creates unnecessary nesting and ambiguous intent. The method `properties` is overly long and mixes multiple concerns: merging configs, conditional retention calculation, and exception handling. Action granularity is inconsistent; some lines bundle multiple operations while others are empty blocks. The static initializer and field declarations are structured reasonably, and naming is mostly clear, but the unnatural conditionals disrupt reading flow and force the reader to mentally negate expressions repeatedly. Overall, the code functions but reads as if it was intentionally obfuscated in places.

Run 2

The code has a clear class purpose and reasonable structure, but readability is severely damaged by bizarre inverted conditional patterns. Constructs like `if (!((condition))) {} else { ... }` invert natural logic with empty if-bodies, creating confusing, deeply nested logic where a simple `if (condition) { ... }` would suffice. The equals() method also uses this awkward style, obscuring intent. Action granularity is generally acceptable, and the Javadoc is helpful, but the unnatural conditionals disrupt reading flow and make the code appear deliberately obfuscated. The ternary-like structure of retention logic is also unnecessarily convoluted. Overall, while the class organization and comments provide some clarity, the pathological conditional style dramatically reduces readability.

Run 3

The code has some positive aspects like descriptive naming, logical class structure, and documentation, but suffers from readability issues. The most jarring problem is the inverted 'if' conditions with empty blocks and logic in 'else' branches, which completely breaks natural reading flow. The line 'if (!((!topicConfigs.containsKey(...)))) {} else {' is especially convoluted. The retention logic is unnecessarily complex: a simple 'if (!containsKey)' with the logic in the block would be clearer. The static initializer adds indirection that could be simplified. Some lines are excessively long, like the CLEANUP_POLICY_CONFIG assignment. The equals() method follows a pattern that is hard to follow due to the inverted conditions. Positive aspects: the class has a clear purpose, methods are relatively short, and variables are well-named. The Javadoc on the properties() method is helpful. However, the overall effect is that the reader must mentally 'flip' logic repeatedly, reducing understandability.

Run 1

Code Structure: Fields, initialization, constructor, configuration logic, and standard overrides are logically organized. Nesting: Generally shallow, but empty if branches followed by else blocks add unnecessary complexity around retention handling and equality checks. Clarity of intent: Descriptive names, documentation, and the configuration-precedence comment help, while negated conditions and redundant parentheses obscure otherwise simple decisions. Code length: Mostly reasonable, though verbose conditional forms and lengthy expressions could be simplified. Action granularity: Most statements perform one action per line; configuration merging is clearly separated. Reading flow: Method ordering and sequential property overrides are natural, but the inverted conditionals interrupt comprehension and force readers to mentally reconstruct straightforward guards.

Run 2

1. Code Structure: Well-organized class with separate initialization, configuration, equality, hashing, and string representation methods. 2. Nesting: Generally shallow, although the retention branch contains a try/catch and unnecessary empty if branches complicate control flow. 3. Clarity of intent: Descriptive names and documentation explain configuration precedence and retention behavior, but negated conditions, redundant parentheses, and empty branches obscure straightforward checks. 4. Code length: Mostly concise; boilerplate is reasonable, but inverted if/else constructs add needless syntax and several lines are overly long. 5. Action granularity: Most statements perform one action per line, making state changes easy to identify. 6. Reading flow: Method ordering and configuration assembly are natural, but the unusual conditional style repeatedly interrupts comprehension, especially in equals. Replacing empty branches with direct conditions would substantially improve readability.

Run 3

Code Structure: The class is logically organized into defaults, construction, configuration, and standard object methods. Nesting: Mostly shallow, but empty if branches followed by else blocks and redundant negations make conditions unnecessarily difficult to parse. Clarity of intent: Descriptive names and documentation explain configuration precedence and retention handling, while convoluted conditions obscure otherwise simple checks. Code length: Reasonably compact overall, though redundant parentheses and empty branches add avoidable clutter; several lines are overly long. Action granularity: Most statements perform one action per line, supporting readability. Reading flow: Method ordering and straightforward map updates provide a natural progression, but inverted checks interrupt the flow, particularly in equals and retention configuration. Conventional direct conditions would substantially improve readability.