Sample

int-66a35450a031-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines151

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5330–1; higher is more readable
Dorn0.7240–1; higher is more readable
Mi0.1650–1; higher is more readable
LLOC43Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.4340–1; higher is more readable

Views

Source code

package com.google.common.util.concurrent; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.throwIfUnchecked; import static com.google.common.util.concurrent.Platform.restoreInterruptIfIsInterruptedException; import static java.util.concurrent.Executors.callable; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.collect.ImmutableList; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Collection; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.jspecify.annotations.Nullable; @J2ktIncompatible @GwtIncompatible abstract class WrappingExecutorService implements ExecutorService { private final ExecutorService delegate; protected WrappingExecutorService(ExecutorService delegate) { this.delegate = checkNotNull(delegate); } protected abstract <T extends @Nullable Object> Callable<T> wrapTask(Callable<T> callable); protected Runnable wrapTask(Runnable command) { Callable<Object> wrapped = wrapTask(callable(command, null)); return () -> { try { wrapped.call(); } catch (Exception e) { restoreInterruptIfIsInterruptedException(e); throwIfUnchecked(e); throw new RuntimeException(e); } }; } private <T extends @Nullable Object> ImmutableList<Callable<T>> wrapTasks( Collection<? extends Callable<T>> tasks) { ImmutableList.Builder<Callable<T>> builder = ImmutableList.builder(); for (Callable<T> task : tasks) { builder.add(wrapTask(task)); } return builder.build(); } @Override public final void execute(Runnable command) { delegate.execute(wrapTask(command)); } @Override public final <T extends @Nullable Object> Future<T> submit(Callable<T> task) { return delegate.submit(wrapTask(checkNotNull(task))); } @Override public final Future<?> submit(Runnable task) { return delegate.submit(wrapTask(task)); } @Override public final <T extends @Nullable Object> Future<T> submit( Runnable task, @ParametricNullness T result) { return delegate.submit(wrapTask(task), result); } @Override public final <T extends @Nullable Object> List<Future<T>> invokeAll( Collection<? extends Callable<T>> tasks) throws InterruptedException { return delegate.invokeAll(wrapTasks(tasks)); } @Override public final <T extends @Nullable Object> List<Future<T>> invokeAll( Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException { return delegate.invokeAll(wrapTasks(tasks), timeout, unit); } @Override public final <T extends @Nullable Object> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException { return delegate.invokeAny(wrapTasks(tasks)); } @Override public final <T extends @Nullable Object> T invokeAny( Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.invokeAny(wrapTasks(tasks), timeout, unit); } @Override public final void shutdown() { delegate.shutdown(); } @Override @CanIgnoreReturnValue public final List<Runnable> shutdownNow() { return delegate.shutdownNow(); } @Override public final boolean isShutdown() { return delegate.isShutdown(); } @Override public final boolean isTerminated() { return delegate.isTerminated(); } @Override public final boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return delegate.awaitTermination(timeout, unit); } }

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.5186.14−171.143
Source linesThe number of non-empty source lines.151+60.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.854−7.281

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

Score0.533

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.151+4.486
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.152−4.346
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.150.919+1.7
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.97.921−0.482
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.103−0.058

Intercept 0.07 + feature contributions = 0.963 (log-odds).
Score = sigmoid(0.963) = 0.724.

Score0.165
Score43
Run 1

The code is highly readable with clear structure and consistent formatting. It follows a logical organization: fields, constructor, abstract methods, private helpers, then grouped public methods. Nesting is minimal—only a lambda inside wrapTask. Intent is explicit through descriptive method names and the delegation pattern. Code length is appropriate, avoiding unnecessary verbosity while maintaining clarity. Action granularity is excellent, with one logical operation per line. Reading flow is natural, with methods grouped by functionality (task execution, submission, invocation, lifecycle). The only minor deductions are for some redundant javadoc comments and the somewhat dense generic type declarations.

Run 2

This code is highly readable due to its clear, logical structure and consistent delegation pattern. The class is organized into distinct sections for abstract methods, helper methods, task submission, and lifecycle management, making the purpose of each method obvious. Nesting is minimal, with only one small try-catch block in the Runnable wrapper. The intent is explicit: wrap tasks before delegating to an underlying ExecutorService. Action granularity is excellent, with each method performing a single, clear action. The code is concise without sacrificing clarity, avoiding unnecessary verbosity. Reading flows naturally from constructor to abstract methods, to helper methods, then through the ExecutorService interface implementations. Generics and nullness annotations add some visual complexity, but this is expected for a Guava utility class and does not impede comprehension for experienced Java developers.

Run 3

The code is highly readable due to its clear structure and logical organization. It follows the Wrapper/Decorator pattern, with the delegate executor clearly separated and all methods delegating consistently. Nesting is minimal, with only one level inside the wrapTask method for handling exceptions. Each public method has a single purpose, and operations are generally one action per line, enhancing clarity. The intent is obvious: wrapping task submissions while preserving ExecutorService behavior. Naming is descriptive, and the use of final methods and fields reinforces immutability and thread-safety expectations. Comments are concise and informative, particularly those explaining non-obvious exception handling. The only minor readability drawbacks are the generic type declarations, which add some verbosity, and the multiple blank lines before the class declaration, which appear unintentional. Overall, the code is clean, maintains flat structure, and reads naturally from constructor through task-wrapping methods to delegation and shutdown operations.

Run 1

Code Structure: Logically organized into task-wrapping helpers, execution methods, and lifecycle delegation. Nesting: Shallow overall; only the Runnable adapter introduces a lambda with try/catch. Clarity of intent: Descriptive names and consistent delegation clearly communicate the wrapper pattern, though undocumented exception handling and nullness annotations add complexity. Code length: Methods are concise, and repetition largely follows the ExecutorService interface; excessive blank lines unnecessarily inflate the presentation. Action granularity: Statements generally perform one action each, with short nested calls remaining easy to understand. Reading flow: Predictable method grouping and consistent formatting support natural reading, but irregular whitespace interrupts continuity.

Run 2

Code Structure: Well organized into task-wrapping helpers, execution methods, and lifecycle delegation. Nesting: Mostly flat; the Runnable wrapper adds modest lambda and try/catch nesting. Clarity of intent: Descriptive names and consistent delegation make the wrapping purpose clear, although the abstract wrapping contract and exception handling lack explanatory documentation. Code length: Methods are concise, and most repetition is justified by the ExecutorService interface; excessive blank lines unnecessarily expand the listing. Action granularity: Statements generally perform one clear action, with straightforward nested calls for wrapping and delegation. Reading flow: Consistent formatting and sensible method grouping support natural reading, but irregular whitespace and verbose generic annotations slightly interrupt the flow.

Run 3

Code Structure: Well organized into task-wrapping helpers, execution methods, and lifecycle delegation. Nesting: Mostly flat; only the Runnable adapter introduces a lambda with try/catch. Clarity of intent: Descriptive names and consistent delegation clearly communicate the wrapper's purpose, though exception conversion and nullness annotations require some Java familiarity. Code length: Methods are concise, and repeated delegation is justified by the interface; excessive blank lines unnecessarily expand the listing. Action granularity: Statements generally perform one logical action per line, with straightforward nested calls for wrapping and validation. Reading flow: Consistent formatting and method grouping support natural reading, but irregular whitespace and long generic signatures mildly disrupt it.