Sample

int-3ea4421a63c9-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines49

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6360–1; higher is more readable
Dorn0.7640–1; higher is more readable
Mi0.6480–1; higher is more readable
LLOC14Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.580–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[]> inner) { this.innerIterator = inner; } @Override public void clo() { innerIterator.close(); } @Override public Windowed<Bytes> peek() { return innerIterator.peekNextKey(); } @Override public boolean has() { return innerIterator.hasNext(); } @Override public KeyValue<Windowed<Bytes>, byte[]> nex() { final KeyValue<Windowed<Bytes>, byte[]> key2 = innerIterator.next(); if (key2 == null) { return null; } return KeyValue.pair(key2.key, convertToHeaderFormat(key2.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.1453.013−47.949
Source linesThe number of non-empty source lines.49+19.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.76−7.141

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

Score0.636

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.50−0.734
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.91.9+0.678
Indentation frequencyHow rapidly indentation changes from line to line.39+0.612
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.48.796+0.272
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.91.96−0.23
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.086+0.108

Intercept 0.07 + feature contributions = 1.174 (log-odds).
Score = sigmoid(1.174) = 0.764.

Score0.648
Score14
Run 1

The code has reasonable structure and basic delegation, but it contains obvious typos ('clo', 'has', 'nex') which would break compilation and severely hurt readability. These likely indicate a corrupted snippet. Nesting is minimal, but method names are unclear because of truncation. The single conditional and null check in 'nex' is straightforward, but the intent of the adapter is not strongly expressed in the logic itself—only in the class comment. The class is concise, but the corrupted method signatures and variable names ('key2') make it ambiguous and disorganized. Without the typos it would be more readable, but as written it fails basic clarity and flow.

Run 2

The code is generally readable but suffers from naming inconsistencies that harm clarity. The class structure is logical and flat, with minimal nesting and one action per line. However, method names 'clo()', 'has()', 'nex()', and 'peek()' appear to be typos or truncated variants of standard interface methods (close, hasNext, next, peekNextKey). This significantly undercuts clarity of intent and makes the reading flow feel disjointed, particularly since the return type of 'peek()' is 'Windowed<Bytes>' while delegating to 'peekNextKey()'. The variable name 'key2' is also poorly chosen, suggesting a leftover or unclear intent, despite it actually representing the next key-value entry. The Javadoc is helpful, but the adapter logic itself is minimal enough that the naming issues dominate the readability assessment. Concise length and flat structure are positives, but consistent, meaningful names are critical for maintainability.

Run 3

The code has a clear purpose and a simple adapter pattern, but several issues hurt readability. The method names are truncated—'clo', 'has', 'nex'—making the intent unclear and diverging from standard conventions ('close', 'hasNext', 'next'). The class Javadoc is helpful, but the import order and formatting could be improved. Nesting is flat and each method performs one action, which is good. However, variable names like 'key2' are confusing. Overall, the structure is logical but stripped-down naming and inconsistent style reduce clarity.

Run 1

Code Structure: The adapter is logically organized, with a single delegate field and small methods. Nesting: Minimal nesting and an early null return keep control flow simple. Clarity of intent: The class name and documentation clearly explain the compatibility conversion, but abbreviated method names (clo, peek, has, nex) and the variable key2 obscure meaning. These method names also appear inconsistent with the implemented interface, making the @Override annotations confusing. Code length: Concise, with little unnecessary code. Action granularity: Each statement performs one clear action. Reading flow: Delegation methods followed by the conversion method provide a natural progression, although cramped import formatting and unclear identifiers interrupt readability.

Run 2

Code Structure: The adapter is logically organized, with a single wrapped iterator and small delegation methods. Nesting: Minimal nesting makes execution easy to follow. Clarity of intent: The class name and documentation clearly explain the compatibility conversion, but truncated method names (clo, peek, has, nex) and the vague variable key2 reduce clarity. These method names also do not match the expected KeyValueIterator interface methods, making the @Override annotations misleading. Code length: Concise, with little unnecessary code. Action granularity: Each statement performs one clear action. Reading flow: Constructor, delegation methods, and conversion logic follow a natural progression; missing spacing around imports slightly reduces visual separation.

Run 3

Code Structure: The adapter is logically organized around a single wrapped iterator, with small delegation methods. Nesting: Minimal nesting and an early null return keep control flow simple. Clarity of intent: Class documentation clearly explains the compatibility purpose, but abbreviated method names (clo, peek, has, nex) and the vague variable key2 reduce clarity. The abbreviated methods also do not match the expected KeyValueIterator methods despite @Override annotations, creating confusion about interface compliance. Code length: Concise, with little unnecessary code. Action granularity: Each statement performs one clear action. Reading flow: Constructor, delegation methods, and conversion logic follow a natural sequence, although missing spacing between package and imports slightly weakens presentation.