Sample

int-e1a5c93e8959-I10

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

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4650–1; higher is more readable
Dorn0.1770–1; higher is more readable
Mi0.0020–1; higher is more readable
LLOC7Logical lines; fewer is more readable
DeepSeek V4 Pro7.330–20; mean of three runs
GPT-6.1 Sol11.670–20; mean of three runs
BTTF0.420–1; higher is more readable

Views

Source code

package org.apache.kafka.streams.state.internals; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.IsolationLevel; import org.apache.kafka.common.utils.Bytes; import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.state.internals.PrefixedWindowKeySchemas.TimeFirstWindowKeySchema; import org.rocksdb.WriteBatch; import java.util.Collection; import java.util.Map; import java.util.Optional; /** * A RocksDB backed time-ordered segmented bytes store for window key schema. */ public class RocksDBTimeOrderedKeyValueBytesStore extends AbstractRocksDBTimeOrderedSegmentedBytesStore<KeyValueSegment> { RocksDBTimeOrderedKeyValueBytesStore(final String name, final String metricsScope) { super(name, Long.MAX_VALUE, new TimeFirstWindowKeySchema(), Optional.empty(), new KeyValueSegments(name, metricsScope, Long.MAX_VALUE, Long.MAX_VALUE)); } @Override protected KeyValue<Bytes, byte[]> getIndexKeyValue(final Bytes baseKey, final byte[] baseValue) { throw new UnsupportedOperationException("Do not use for TimeOrderedKeyValueStore"); } @Override Map<KeyValueSegment, WriteBatch> getWriteBatches(final Collection<ConsumerRecord<byte[], byte[]>> records) { return getWriteBatches( records, WindowKeySchema::extractStoreTimestamp, null, // never an indexed store -- not needed TimeFirstWindowKeySchema::fromNonPrefixWindowKey ); } @Override protected IndexToBaseStoreIterator getIndexToBaseStoreIterator(final SegmentIterator<KeyValueSegment> segmentIterator, final IsolationLevel isolationLevel) { throw new UnsupportedOperationException("Do not use for TimeOrderedKeyValueStore"); } }

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.1631.95−53.854
Source linesThe number of non-empty source lines.31+12.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.832−7.247

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

Score0.465

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.199.875−4.801
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.200+2.422
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.071+0.254
Indentation frequencyHow rapidly indentation changes from line to line.27+0.197
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.32−0.097
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.736+0.02

Intercept 0.07 + feature contributions = -1.536 (log-odds).
Score = sigmoid(-1.536) = 0.177.

Score0.002
Score7
Run 1

The code has significant readability issues. The package and imports are crammed onto a single line, making them difficult to scan. There is inconsistent spacing around braces and annotations, and some methods appear on the same line as other code, violating the 'one action per line' principle. While the class has a clear purpose and the method names are descriptive, the overall structure feels disorganized. The getWriteBatches method signature is split awkwardly across lines, and the lambda/method references reduce clarity for readers unfamiliar with the codebase. The nesting is shallow, which is good, but the formatting undermines the natural reading flow. The code could be greatly improved with consistent line breaks, spacing, and separation of concerns.

Run 2

The code demonstrates poor readability due to several issues. The import statements are compressed onto single lines, violating standard Java formatting and making them difficult to scan. Methods are inconsistently formatted - some opening braces appear on the same line as method signatures while others don't, and there's inconsistent line breaking in method parameters. The getWriteBatches method contains multiple statements on one line, making it harder to follow the logic flow. The code lacks proper spacing between methods and has irregular indentation throughout. While the class has a clear purpose and the method names are descriptive, the structural inconsistencies and compressed formatting significantly hamper readability. The nesting level is acceptable, but the overall presentation appears rushed and fails to follow Java conventions consistently.

Run 3

The code has severe readability issues. The first line combines a package declaration, an import, and a class annotation without proper line breaks, making it hard to follow. Imports are not separated from the class-level documentation, and methods are sometimes placed on the same line as annotations or other methods, violating one-action-per-line principles. The class structure is somewhat logical, but the formatting disrupts natural reading flow. Nesting is not a major issue here, but the dense lines create confusion. The intent of the class is clear from the Javadoc, but the implementation details are obscured by poor spacing and inconsistent indentation. Overall, the code is functional but difficult to read and would benefit from standard Java formatting conventions, especially separating package, imports, and class declarations onto distinct lines, and ensuring each method or annotation starts on its own line.

Run 1

Code Structure: The class is logically organized around a constructor and three overrides, but compressed imports and inconsistent declaration formatting obscure boundaries. Nesting: Very shallow, with no nested control flow, making execution easy to follow. Clarity of intent: Descriptive class and method names, a class comment, and explicit unsupported-operation messages communicate purpose; repeated Long.MAX_VALUE arguments and null require contextual knowledge. Code length: Short and largely free of unnecessary code, though some lines are excessively long. Action granularity: Method bodies generally contain one action, but multiple imports and declarations share lines, reducing scanability. Reading flow: The constructor-to-overrides sequence is natural, but annotations attached to braces, uneven indentation, and mixed inline/multiline formatting interrupt reading.

Run 2

Code Structure: The class is logically organized into a constructor and focused overrides, but compressed imports and inconsistent formatting weaken visual organization. Nesting: Minimal nesting makes the control flow easy to follow. Clarity of intent: Descriptive class and method names, the class comment, and explicit unsupported-operation exceptions communicate purpose; repeated Long.MAX_VALUE arguments and a null argument require contextual knowledge. Code length: The implementation is concise without substantial unnecessary code. Action granularity: Method bodies generally perform one action, but multiple imports, annotations, declarations, and statements share lines, reducing scanability. Reading flow: Uneven indentation, inconsistent line breaks, and an annotation attached to the constructor's closing brace interrupt otherwise straightforward reading.

Run 3

Code Structure: The class is logically organized around a constructor and three overrides, but compressed imports and inconsistent formatting obscure its organization. Nesting: There is no deep nesting; methods contain simple delegation or exceptions. Clarity of intent: Descriptive class and method names, documentation, and the index-related comment explain the purpose, although repeated Long.MAX_VALUE arguments and null require contextual knowledge. Code length: The implementation is concise without excessive boilerplate. Action granularity: Method bodies generally perform one action, but multiple imports, annotations, declarations, and statements share lines, reducing readability. Reading flow: Uneven indentation, crowded argument lists, and annotations attached to closing braces interrupt an otherwise straightforward progression.