Sample

int-5d92074e0d2b-SRC

Unmodified source class

Lines151

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5780–1; higher is more readable
Dorn0.870–1; higher is more readable
Mi0.2440–1; higher is more readable
LLOC43Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol18.330–20; mean of three runs
BTTF0.4830–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; /** * An abstract {@code ExecutorService} that allows subclasses to {@linkplain #wrapTask(Callable) * wrap} tasks before they are submitted to the underlying executor. * * <p>Note that task wrapping may occur even if the task is never executed. * * <p>For delegation without task-wrapping, see {@link ForwardingExecutorService}. * * @author Chris Nokleberg */ @J2ktIncompatible @GwtIncompatible abstract class WrappingExecutorService implements ExecutorService { private final ExecutorService delegate; protected WrappingExecutorService(ExecutorService delegate) { this.delegate = checkNotNull(delegate); } /** * Wraps a {@code Callable} for submission to the underlying executor. This method is also applied * to any {@code Runnable} passed to the default implementation of {@link #wrapTask(Runnable)}. */ protected abstract <T extends @Nullable Object> Callable<T> wrapTask(Callable<T> callable); /** * Wraps a {@code Runnable} for submission to the underlying executor. The default implementation * delegates to {@link #wrapTask(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); } }; } /** * Wraps a collection of tasks. * * @throws NullPointerException if any element of {@code tasks} is null */ 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(); } // These methods wrap before delegating. @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); } // The remaining methods just delegate. @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.87−7.305

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

Score0.578

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.152−4.346
Indentation frequencyHow rapidly indentation changes from line to line.130+3.759
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.150.901+1.699
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.96.072+0.746
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.99.914−0.567
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.083+0.138

Intercept 0.07 + feature contributions = 1.898 (log-odds).
Score = sigmoid(1.898) = 0.87.

Score0.244
Score43
Run 1

The code exhibits excellent structure and readability. It starts with a clear Javadoc explaining the class's purpose, then organizes methods logically: core wrapping methods first, followed by wrapped ExecutorService methods, and finally simple delegation methods. Nesting is minimal; the only nested block is a concise try-catch in wrapTask. Each method has a clear, single responsibility and is named appropriately. The code is concise but not terse, with one action per line. The reading flow is natural, moving from abstract concepts to concrete implementations. Minor deductions: the wrapTask(Runnable) method's lambda could arguably be extracted for clarity, and the generic type parameters add some visual noise. Overall, this is highly readable code that follows strong conventions.

Run 2

This code is highly readable. It has a clear, logical structure: the class-level documentation explains intent, fields and constructors are simple, and methods are grouped into transformations and plain delegations. Nesting is minimal—only one lambda inside wrapTask and a simple loop in wrapTasks. Intent is explicit through method names, comments, and consistent use of wrapTask/wrapTasks. Code length is concise; each method delegates in one or two lines. Action granularity is generally one action per line. Reading flow is natural, with wrapper-specific methods first, then delegation-only methods. Minor deductions are for the slightly dense generic signatures and the lambda in wrapTask, which could reduce clarity for some readers, but overall the maintainability is strong.

Run 3

The code is highly readable. It has a clear, single-purpose structure: an abstract ExecutorService wrapper that wraps tasks before delegation. The class is logically organized with wrapping methods grouped together, followed by delegating methods. Nesting is minimal, with only a small lambda in wrapTask. Intent is clear from method names and Javadoc comments, particularly for wrapTask and wrapTasks. Code length is appropriate, avoiding unnecessary verbosity while documenting key behavior. Each line generally performs one action, and the reading flow is natural: constructor, abstract wrap methods, private helper, then ExecutorService method overrides. Nullness annotations add complexity but are consistently applied. The code adheres to Guava style, making it easy to follow for experienced Java developers.

Run 1

Code Structure: Logically separates wrapping helpers, task-submission methods, and lifecycle delegation, with useful section comments. Nesting: Minimal; only the Runnable adapter introduces a lambda with try/catch, and collection wrapping uses a simple loop. Clarity of intent: Descriptive names and focused Javadocs clearly explain the wrapper/delegate design and exception handling. Code length: Concise implementations; repeated overrides are necessary to implement ExecutorService rather than unnecessary duplication. Action granularity: Statements generally perform one clear action, although nested wrapping, validation, and delegation calls combine operations on some lines. Reading flow: Natural progression from construction and customization hooks to helpers and public methods. Dense generic/nullness annotations and consecutive imports add minor visual overhead, but overall readability is excellent.

Run 2

Code Structure: Logically separates task-wrapping helpers, submission methods, and lifecycle delegation. Nesting: Mostly flat; only the Runnable wrapper introduces a lambda with try/catch, and collection wrapping uses a simple loop. Clarity of intent: Descriptive names, focused Javadocs, and section comments clearly explain the wrapping-and-delegation pattern. Generic nullability annotations and exception utilities add some cognitive overhead. Code length: Methods are concise; repeated forwarding boilerplate is largely necessary to implement ExecutorService. Action granularity: Most statements perform one action, although nested calls combine validation, wrapping, and submission on a single line. Reading flow: Proceeds naturally from construction and wrapping logic to task submission and lifecycle operations. Dense imports and lengthy generic signatures slightly reduce scanability.

Run 3

Code Structure: Logically separates task-wrapping helpers, wrapped execution methods, and lifecycle delegation. Nesting: Mostly flat, with only a short loop and a lambda containing try/catch. Clarity of intent: Descriptive names, Javadoc, and section comments clearly explain the wrapping/delegation pattern; generic nullness annotations add some visual complexity. Code length: Methods are concise, though interface implementation requires repetitive delegation boilerplate. Action granularity: Statements generally perform one clear action; nested wrapping and delegation calls remain easy to understand. Reading flow: Progresses naturally from construction to wrapping helpers, task submission, and lifecycle operations. Dense imports and lengthy generic signatures slightly reduce scanability.