Sample

int-a20b4428a1ff-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines33

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5330–1; higher is more readable
Dorn0.1140–1; higher is more readable
Mi0.0020–1; higher is more readable
LLOC14Logical lines; fewer is more readable
DeepSeek V4 Pro8.330–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.4440–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) { this.innerIterator = innerIterator; } @Override public void close() { innerIterator.close(); } @Override public Windowed<Bytes> peekNextKey() { return innerIterator.peekNextKey(); } @Override public boolean hasNext() { return innerIterator.hasNext(); } @Override public KeyValue<Windowed<Bytes>, byte[]> next() { 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.1421.457−46.908
Source linesThe number of non-empty source lines.33+13.2
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.795−7.192

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

Score0.533

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.206.941−5.1
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.207+2.535
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.34−0.167
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.086+0.111
Indentation frequencyHow rapidly indentation changes from line to line.23+0.058
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.32.774+0.048

Intercept 0.07 + feature contributions = -2.047 (log-odds).
Score = sigmoid(-2.047) = 0.114.

Score0.002
Score14
Run 1

The code has clear intent and is logically organized, but readability is significantly reduced by inconsistent formatting and multiple statements on single lines. The class declaration, constructor, method signatures, and several method bodies are compressed onto single lines, violating action granularity and disrupting reading flow. Nesting is minimal and code length is concise, but the formatting makes the structure harder to parse quickly. Standard Java conventions (line breaks between fields, methods, and braces) are not followed consistently.

Run 2

The code is functional but poorly formatted and structured. It has severe readability issues: multiple statements and method declarations are crammed onto single lines, making it difficult to scan. The class-level structure is reasonable, but the formatting destroys clarity. There is minimal nesting, which is good, but the lack of line breaks negates that benefit. The intent is somewhat clear from the Javadoc, but the implementation is hard to follow due to compressed lines. The code length is concise, but this is achieved at the expense of readability. Action granularity is poor—multiple actions per line (e.g., field declaration and constructor body on one line). Reading flow is disorganized and unnatural, forcing the reader to mentally parse dense lines. Overall, the code is technically correct but reads like minified source, not production-grade code.

Run 3

The code is functionally simple but poorly formatted. Multiple methods and fields are crammed onto single lines, which severely hurts readability. The class structure is logical, but the lack of indentation and line breaks makes it look tangled. Nesting is minimal (one if statement), which is good. Intent is somewhat clear from the Javadoc and class name, but the formatting obscures it. Code length is concise, but this conciseness comes at the cost of readability. Many lines contain multiple actions or declarations, violating the 'one action per line' principle. Reading flow is disorganized because the eye must parse dense, multi-statement lines. Overall, while the logic itself is straightforward, the poor formatting makes it much less readable than it could be.

Run 1

Code Structure: The adapter has a logical organization, with a wrapped iterator and straightforward delegation, but compressed declarations and method boundaries obscure that structure. Nesting: Minimal nesting; only a simple null check appears in next(). Clarity of intent: Descriptive names and useful class documentation clearly explain the compatibility purpose and value conversion. Code length: Appropriately concise, without unnecessary logic. Action granularity: Several imports, declarations, annotations, and method statements share lines, making individual operations harder to distinguish. Reading flow: Inconsistent line breaks and closing braces disrupt scanning, particularly between delegated methods. The underlying implementation is easy to understand, but poor formatting significantly reduces readability.

Run 2

Code Structure: A coherent iterator adapter with straightforward delegation, but compressed declarations and method boundaries obscure its organization. Nesting: Very shallow, with only one simple null check. Clarity of intent: The class documentation, descriptive names, and explicit conversion clearly explain its compatibility purpose. Code length: Concise, with little unnecessary logic. Action granularity: Several imports, declarations, annotations, and method statements share lines, reducing visual separation despite simple individual operations. Reading flow: Inconsistent line breaks and closing braces interrupt scanning and make method transitions harder to follow. Overall, the logic is easy to understand, but poor formatting substantially reduces readability.

Run 3

Code Structure: The adapter logically groups iterator delegation and value conversion, but compressed declarations and method boundaries obscure that organization. Nesting: Minimal nesting, with only a simple null check, makes control flow easy to understand. Clarity of intent: Descriptive class and variable names, explicit delegation, and helpful documentation clearly explain the compatibility purpose. Code length: The implementation is appropriately concise without unnecessary logic. Action granularity: Multiple imports, declarations, annotations, and method boundaries share lines, reducing visual separation despite generally simple statements. Reading flow: Inconsistent line breaks and cramped formatting interrupt an otherwise straightforward progression through iterator methods. Standard formatting would substantially improve readability.