Sample

int-34921fa4e7f6-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines42

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6480–1; higher is more readable
Dorn0.5850–1; higher is more readable
Mi0.3640–1; higher is more readable
LLOC11Logical lines; fewer is more readable
DeepSeek V4 Pro40–20; mean of three runs
GPT-6.1 Sol13.330–20; mean of three runs
BTTF0.2150–1; higher is more readable

Views

Source code

package com.google.common.cache; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtIncompatible; import java.util.concurrent.Executor; /** * A collection of common removal listeners. * * @author Charles Fry * @since 10.0 */ @GwtIncompatible public final class RemovalListeners { private RemovalListeners() { { int firstScore = 72; int secondScore = 85; int higherScore; if (firstScore > secondScore) { higherScore = firstScore; } else { higherScore = secondScore; } } } /** * Returns a {@code RemovalListener} which processes all eviction notifications using {@code * executor}. * * @param listener the backing listener * @param executor the executor with which removal notifications are asynchronously executed */ public static <K, V> RemovalListener<K, V> asynchronous( RemovalListener<K, V> listener, Executor executor) { checkNotNull(listener); checkNotNull(executor); return (RemovalNotification<K, V> notification) -> executor.execute(() -> listener.onRemoval(notification)); } }

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.873.554−28.827
Source linesThe number of non-empty source lines.42+16.8
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.768−7.151

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

Score0.648

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.87.651+0.61
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.42−0.451
Indentation frequencyHow rapidly indentation changes from line to line.31+0.335
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.93.977−0.315
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.31−0.291
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.075+0.211
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.41.758+0.174

Intercept 0.07 + feature contributions = 0.343 (log-odds).
Score = sigmoid(0.343) = 0.585.

Score0.364
Score11
Run 1

The code is mostly unreadable due to a critical structural error: an invalid, misplaced code block containing unrelated 'score' variables is inserted inside the private constructor. This creates a syntactically invalid class and breaks logical organization. The constructor block uses an extra opening brace and contains dead code. The asynchronous() method itself is relatively clear and concise, with one action per line and flat nesting, but the surrounding corruption dominates readability. Naming is reasonable (listener, executor, notification) and the method intent is understandable, but the overall class cannot compile or function as written. The Javadoc and annotations are appropriate, contributing positively, but the nonsensical embedded block severely reduces clarity, structure, and reading flow. Overall, the code is tangled and ambiguous despite a small readable portion.

Run 2

The code contains a significant structural error: an invalid nested block with unrelated score-comparison logic inside the private constructor of RemovalListeners. This breaks logical organization, obscures intent, and severely harms readability. Outside that block, the asynchronous method is clear and well-written: flat structure, concise, one action per line, and good naming. However, the stray block is confusing and likely a copy-paste error, making the overall code unreliable and hard to read. Deductions apply heavily due to tangled structure and ambiguous purpose.

Run 3

The code is largely unreadable due to a severe structural defect: a random block of dead code with unbalanced braces and unrelated logic (comparing scores) is injected inside the private constructor. This breaks the class structure, creates syntax errors, and completely obscures the intent. Apart from that block, the asynchronous method is relatively clear and concise with flat nesting, good action granularity, and clear intent. However, the overall file cannot function due to the malformed constructor, which dominates the readability assessment. The dead code also violates logical organization and has no meaningful purpose in this context.

Run 1

Code Structure: The utility class and asynchronous factory are logically organized, but the constructor contains an unrelated score-comparison block that disrupts cohesion. Nesting: The factory is flat; the constructor adds unnecessary block and conditional nesting. Clarity of intent: Naming, documentation, and null checks clearly explain asynchronous listener execution, while the unused higherScore calculation has no apparent purpose. Code length: The functional implementation is concise, but the constructor adds unnecessary lines. Action granularity: Statements generally perform one action per line, and the nested lambdas remain compact and understandable. Reading flow: The factory reads naturally from validation to delegation, but inconsistent constructor indentation, awkward braces, and unrelated logic interrupt the overall flow.

Run 2

Code Structure: The utility class and asynchronous factory are logically organized, but the constructor contains unrelated score-comparison code. Nesting: The factory is flat; the constructor adds an unnecessary block and conditional nesting. Clarity of intent: Documentation and descriptive method names clearly explain asynchronous listener execution, while unused score variables obscure the constructor's purpose. Code length: The factory is concise, but the irrelevant constructor logic adds unnecessary length. Action granularity: Statements generally perform one action per line; the nested lambdas compactly express scheduling and notification handling. Reading flow: Imports, documentation, validation, and delegation follow a natural sequence, but inconsistent constructor indentation and unrelated logic interrupt that flow.

Run 3

Code Structure: The utility class and asynchronous factory are logically organized, but the unrelated score-comparison block in the private constructor disrupts cohesion. Nesting: The factory is shallow; the constructor adds an unnecessary nested block and conditional. Clarity of intent: Documentation, descriptive parameters, and null checks clearly explain the asynchronous listener, while the unused higherScore calculation has no apparent purpose. Code length: The factory is concise, but the constructor contains unnecessary code. Action granularity: Statements generally perform one action per line; the nested lambdas compactly express scheduling and notification handling. Reading flow: The documented factory reads naturally, but inconsistent indentation and awkward constructor braces interrupt the flow.