Sample

int-1b91328204c7-I10

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

Matched original source

Lines98

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4470–1; higher is more readable
Dorn0.2880–1; higher is more readable
Mi0.0070–1; higher is more readable
LLOC43Logical 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.320–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.98+39.2
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.899−7.349

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

Score0.447

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.182−4.044
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.99−2.469
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.181.99+2.132
Indentation frequencyHow rapidly indentation changes from line to line.77+1.926
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.97.847+0.958
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.084+0.123

Intercept 0.07 + feature contributions = -0.905 (log-odds).
Score = sigmoid(-0.905) = 0.288.

Score0.007
Score43
Run 1

The code suffers from severe formatting issues that significantly harm readability. Multiple statements are crammed onto single lines, including imports, method declarations, and bodies. Javadoc comments are merged with code annotations, and braces are positioned inconsistently. While the class has a coherent structure and the intent (wrapping tasks before delegation) is reasonably clear, the physical layout obscures it. The nesting level is low, which is good, and the conciseness is high, but this conciseness is achieved by sacrificing clarity. For example, the wrapTask(Runnable) method contains a lambda with multiple statements on one line, reducing action granularity. The reading flow is disjointed due to the inconsistent line breaks and mixed visibility of methods. Although individual expressions are understandable, the overall effect is disorganized, making the code feel tangled despite a logical underlying design.

Run 2

This code is technically functional but poorly formatted, making it significantly less readable. The most severe issue is the inconsistent line breaks: multiple statements are crammed onto single lines, while other methods are unnecessarily split across lines. The import statements are also collapsed onto one line, reducing scannability. The code structure is logical (wrapping executor service), but the formatting obscures it. Nesting is reasonable (e.g., the lambda in wrapTask), but the single-line try-catch block inside makes it harder to parse. Several generated or trivial methods (shutdown, isShutdown, etc.) are split awkwardly across lines, while more complex methods like submit and invokeAll have their signatures and bodies on the same line. This inconsistency disrupts reading flow. Action granularity is violated in places where multiple statements are on one line. The intent is clear from the class and method names, but the physical layout makes it difficult to quickly understand the code's structure.

Run 3

The code suffers from severe formatting issues that drastically hurt readability. Multiple statements are packed onto single lines, including imports and method signatures, violating the 'one action per line' principle. The structure is tangled: comments and Javadoc are placed mid-line before methods, and opening braces sometimes follow statements on the same line. Nesting is moderate but the wrapTask(Runnable) method contains a lambda with a try-catch block that is compressed. While the intent of the class (wrapping tasks before delegation) is conceptually clear, the execution makes it hard to scan. The code length is reasonable but presentation makes it appear bloated and disorganized. Reading flow is poor because the eye cannot follow a natural vertical rhythm; it constantly jumps horizontally. With proper formatting, this would be much more readable, but as presented it is difficult to navigate and maintain.

Run 1

Code Structure: Logically organized around task wrapping and executor delegation, with helper methods and comments separating responsibilities. Nesting: Shallow overall; the lambda and try/catch add only modest complexity. Clarity of intent: Descriptive names, Javadoc, and consistent delegation make the purpose clear. Code length: Appropriately concise for implementing ExecutorService; repeated delegation methods are largely necessary. Action granularity: Poor formatting places multiple imports, statements, annotations, and method boundaries on single lines, obscuring individual actions. Reading flow: Inconsistent line breaks, indentation, and brace placement disrupt scanning, particularly around wrapTasks, exception handling, and submit overloads. The underlying design is readable, but compressed and irregular presentation significantly reduces accessibility.

Run 2

Code Structure: Logical organization separates task wrapping from executor delegation, with helpful section comments. Nesting: Mostly shallow; only the Runnable adapter introduces a lambda with try/catch, and collection wrapping uses a simple loop. Clarity of intent: Descriptive names, standard ExecutorService methods, and useful Javadoc make the purpose clear. Code length: Appropriately concise for an interface wrapper; repeated delegation methods are necessary rather than excessive. Action granularity: Poor formatting places multiple imports, statements, annotations, and even method declarations on single lines, obscuring individual actions. Reading flow: Inconsistent indentation, compressed exception handling, and comments attached to closing braces interrupt scanning and blur method boundaries. The underlying design is readable, but presentation substantially reduces accessibility.

Run 3

Code Structure: Logically organized into task-wrapping helpers, submission methods, and lifecycle delegation, but compressed formatting obscures boundaries. Nesting: Shallow overall; the lambda with try/catch and the collection loop remain manageable. Clarity of intent: Descriptive names, Javadoc, and delegation comments clearly explain the wrapper's purpose. Code length: Appropriately concise for implementing ExecutorService; most methods are necessary one-line delegations. Action granularity: Multiple imports, exception-handling actions, declarations, and even methods share lines, making individual operations harder to distinguish. Reading flow: Inconsistent indentation, inline closing braces, and annotations or comments attached to preceding statements interrupt scanning. The underlying design is readable, but formatting substantially reduces accessibility.