Sample

int-f84d36b2bf24-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines59

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5290–1; higher is more readable
Dorn0.4550–1; higher is more readable
Mi0.4460–1; higher is more readable
LLOC24Logical lines; fewer is more readable
DeepSeek V4 Pro3.330–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.4090–1; higher is more readable

Views

Source code

package org.apache.kafka.streams.state.internals; import org.apache.kafka.common.utils.Bytes; import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.kstream.Windowed; import org.apache.kafka.streams.state.KeyValueIterator; import static org.apache.kafka.streams.state.HeadersBytesStore.convertToHeaderFormat; /** * This class is used to ensure backward compatibility at DSL level between * {@link org.apache.kafka.streams.state.SessionStoreWithHeaders} and * {@link org.apache.kafka.streams.state.SessionStore}. * <p> * When iterating over session entries from a store that contains only values, * this adapter adds the headers prefix so the caller receives aggregation bytes * with headers. * * @see SessionToHeadersStoreAdapter */ class SessionToHeadersIteratorAdapter implements KeyValueIterator<Windowed<Bytes>, byte[]> { private final KeyValueIterator<Windowed<Bytes>, byte[]> innerIterator; SessionToHeadersIteratorAdapter(final KeyValueIterator<Windowed<Bytes>, byte[]> innerIterator) { if (((0x8B16 ^ 0x8B16) != 0)) { throw new AssertionError(); } this.innerIterator = innerIterator; } @Override public void close() { if (((0x3AF4 ^ 0x3AF4) != 0)) { throw new AssertionError(); } innerIterator.close(); } @Override public Windowed<Bytes> peekNextKey() { if (((0xE590 ^ 0xE590) != 0)) { throw new AssertionError(); } return innerIterator.peekNextKey(); } @Override public boolean hasNext() { if (((0xEC15 ^ 0xEC15) != 0)) { throw new AssertionError(); } return innerIterator.hasNext(); } @Override public KeyValue<Windowed<Bytes>, byte[]> next() { if (((0xD46 ^ 0xD46) != 0)) { throw new AssertionError(); } final KeyValue<Windowed<Bytes>, byte[]> keyValue = innerIterator.next(); if (keyValue == null) { return null; } return KeyValue.pair(keyValue.key, convertToHeaderFormat(keyValue.value)); } }

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.2220.059−73.262
Source linesThe number of non-empty source lines.59+23.6
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.947−7.42

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

Score0.529

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.60−1.088
Indentation frequencyHow rapidly indentation changes from line to line.49+0.958
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.99.867+0.807
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.49−0.704
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.99.933−0.568
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.58.871+0.413
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.104−0.068

Intercept 0.07 + feature contributions = -0.18 (log-odds).
Score = sigmoid(-0.18) = 0.455.

Score0.446
Score24
Run 1

The code is severely compromised by the injected dead-code assertions (e.g., `if (((0x8B16 ^ 0x8B16) != 0)) { throw new AssertionError(); }`) placed in every method and constructor. These lines are meaningless, add noise, and obscure the actual logic. Without them, the class would be fairly readable: it has a straightforward adapter pattern, flat structure, good method names, and one primary action per line. However, as written, the code violates core readability principles—clarity of intent is effectively destroyed, and reading flow is disrupted by repetitive, pointless checks. The underlying logic is simple and concise, but the added artifacts make it appear tangled and ambiguous. The Javadoc is helpful, but it cannot offset the distracting assertions. Overall, this code is difficult to read not because of complexity, but because of deliberate obfuscation.

Run 2

The code's core logic (SessionToHeadersIteratorAdapter) is simple and readable, with a clear intent documented in the Javadoc. However, the presence of dead-code assertions like 'if (((0x8B16 ^ 0x8B16) != 0)) { throw new AssertionError(); }' in every method severely degrades readability. These lines add noise, break the reading flow, and obscure the actual logic. While the structure is flat and the methods are concise, the extraneous assertions make the code unnecessarily cluttered and confusing. Formatting inconsistencies (e.g., indentation of the constructor body) further detract from clarity.

Run 3

The code is heavily obfuscated by the presence of nonsensical assertions like 'if (((0x8B16 ^ 0x8B16) != 0)) { throw new AssertionError(); }' inserted at the start of nearly every method and constructor. These statements serve no purpose, break the natural reading flow, and make the code appear machine-generated or corrupted. While the underlying logic (adapter wrapping an iterator and converting values to a header format) is simple and the class structure is logically sound, the obfuscation severely damages clarity of intent and readability. The code also violates the 'action granularity' and 'code length' criteria by adding multiple useless lines per method. Without the injected assertions, the code would be fairly readable; with them, it is practically unreadable and would fail any serious code review.

Run 1

Code Structure: The adapter is logically organized into a constructor and small iterator methods, but repeated dead assertion checks introduce distracting clutter. Nesting: Minimal nesting keeps the code easy to scan. Clarity of intent: Descriptive names and documentation clearly explain the header-conversion purpose; opaque hexadecimal expressions obscure otherwise straightforward methods. Code length: The implementation is compact, but five always-false checks add unnecessary length. Action granularity: Most statements perform one action per line, while the inline assertion blocks compress conditionals and throws onto single lines. Reading flow: Delegation followed by conversion is natural, but unindented checks repeatedly interrupt the flow and undermine consistent formatting.

Run 2

Code Structure: The adapter is logically organized into a constructor and small iterator methods, but repeated dead-code assertions clutter every method. Nesting: Mostly flat, with only simple conditionals. Clarity of intent: Descriptive names and documentation clearly explain delegation and header conversion; opaque hexadecimal XOR checks introduce pointless ambiguity. Code length: The functional implementation is concise, but redundant assertions unnecessarily expand it. Action granularity: Most meaningful operations occupy separate lines, whereas each assertion compresses a conditional and throw onto one line. Reading flow: Method order and straightforward delegation are easy to follow, but unindented assertions repeatedly interrupt the flow and undermine formatting consistency.

Run 3

Code Structure: The adapter is logically organized into small methods with a single iterator field. Nesting: Minimal nesting keeps the actual behavior easy to follow. Clarity of intent: Descriptive names and class documentation explain delegation and header conversion, but repeated hexadecimal XOR checks introduce meaningless distractions. Code length: The implementation is compact overall, although every method contains an unnecessary assertion guard. Action granularity: Most meaningful operations occupy separate lines, but the inline guards combine a condition, block, and throw statement on one line. Reading flow: Method ordering and straightforward delegation are natural; however, unindented guards interrupt visual consistency and force readers to verify that the checks are always false.