Sample

int-7c25b5c5fd83-I10

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

Matched original source

Lines24

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4960–1; higher is more readable
Dorn0.4580–1; higher is more readable
Mi0.1410–1; higher is more readable
LLOC5Logical lines; fewer is more readable
DeepSeek V4 Pro7.330–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.5910–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() {} /** * 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.647.078−21.354
Source linesThe number of non-empty source lines.24+9.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.78−7.17

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

Score0.496

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.134.96−2.051
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.134.92+1.372
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.13−0.287
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.071+0.255
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.25+0.151
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.23.75−0.078

Intercept 0.07 + feature contributions = -0.169 (log-odds).
Score = sigmoid(-0.169) = 0.458.

Score0.141
Score5
Run 1

The code has severe readability issues. The package and import statements are on one line, and the class declaration combines the opening brace and the constructor on the same line, breaking logical organization. Formatting is inconsistent: there is a space before the method parameter 'RemovalListener<K, V> listener', and multiple statements like checkNotNull calls are placed on a single line. The lambda expression puts multiple actions on one line, reducing action granularity. The closing braces are stacked at line ends, disrupting reading flow. While the Javadoc is present and the method logic is concise, the absence of vertical separation, inconsistent indentation, and compressed statements make the code difficult to scan and understand. Clear intent exists, but the structure and nesting presentation undermine readability.

Run 2

The code is structurally flawed and difficult to read. The class declaration and constructor are placed on the same line, and the method signature is wrapped awkwardly with unusual spacing before parameters. Multiple actions (two checkNotNull calls, return statement) are packed into a single method without blank lines, and the lambda body executes two actions in one line. While the Javadoc and logic are clear, the physical layout undermines readability. The package and import sharing a line also violates typical formatting conventions. Overall, the code is logically simple but presented in a tangled way that forces the reader to mentally reformat it.

Run 3

The code is a relatively simple factory method, but its style undermines readability. Structure is logical but presentation is compressed: package and imports are on one line, and the class declaration shares a line with the private constructor. Nesting is low, which is good, but the asynchronous method's lambda is a single line containing two nested actions. Clarity of intent is adequate due to Javadoc, though the method body would benefit from line breaks around the validation calls and lambda. Code length is concise but overly terse. Action granularity is mixed: validation calls are on separate lines, but the return statement combines lambda creation and nested executor invocation. Reading flow is disrupted by inconsistent spacing, line-wrapped parameters, and a cramped lambda. With simple formatting fixes—separating imports, adding line breaks, and expanding the lambda—the score would improve significantly.

Run 1

Code Structure: A simple utility class with logically grouped validation and listener creation, but compressed declarations weaken organization. Nesting: Shallow; the nested lambdas are manageable. Clarity of intent: Descriptive names and Javadoc clearly explain asynchronous notification handling. Code length: Concise, with no unnecessary logic. Action granularity: Several lines combine declarations, braces, or statements, notably the package/import line and method declaration with validation. Reading flow: The sequence from argument checks to returning the asynchronous wrapper is natural, but inconsistent spacing and crowded opening and closing braces interrupt scanning.

Run 2

Code Structure: The utility class, private constructor, and factory method are logically organized, but compressed formatting obscures boundaries. Nesting: Minimal nesting; the nested lambdas are straightforward. Clarity of intent: Descriptive names and Javadoc clearly explain asynchronous notification handling, and null checks make requirements explicit. Code length: Concise without unnecessary logic or duplication. Action granularity: Mostly one action per line, but the package and import share a line, as do the method declaration and first null check; class declarations and braces are also crowded. Reading flow: The sequence of validation followed by listener construction is natural, but inconsistent spacing, long lines, and combined closing braces interrupt scanning.

Run 3

Code Structure: A logically organized utility class with one focused factory method, though compressed formatting obscures boundaries. Nesting: Minimal nesting; the two lambdas are compact and straightforward. Clarity of intent: Descriptive names, documentation, and explicit null checks clearly communicate asynchronous listener execution. Code length: Concise with no unnecessary implementation. Action granularity: Several declarations and statements share lines, including the package and import, class and constructor, and method signature and null check. Reading flow: The implementation follows a natural validation-then-return sequence, but long lines and combined closing braces interrupt scanning.