Sample

int-0f8a2d75eb14-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines151

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5630–1; higher is more readable
Dorn0.8660–1; higher is more readable
Mi0.2510–1; higher is more readable
LLOC43Logical lines; fewer is more readable
DeepSeek V4 Pro3.670–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.4430–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 del) { this.delegate = checkNotNull(del); } /** * 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> wrap(Callable<T> cal); /** * Wraps a {@code Runnable} for submission to the underlying executor. The default implementation * delegates to {@link #wrapTask(Callable)}. */ protected Runnable wrap(Runnable com2) { Callable<Object> wra = wrap(callable(com2, null)); return () -> { try { wra.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>> wrap2( Collection<? extends Callable<T>> tas) { ImmutableList.Builder<Callable<T>> bui = ImmutableList.builder(); for (Callable<T> tas2 : tas) { bui.add(wrap(tas2)); } return bui.build(); } // These methods wrap before delegating. @Override public final void exe(Runnable com3) { delegate.execute(wrap(com3)); } @Override public final <T extends @Nullable Object> Future<T> sub(Callable<T> tas3) { return delegate.submit(wrap(checkNotNull(tas3))); } @Override public final Future<?> sub(Runnable tas4) { return delegate.submit(wrap(tas4)); } @Override public final <T extends @Nullable Object> Future<T> sub( Runnable tas5, @ParametricNullness T res) { return delegate.submit(wrap(tas5), res); } @Override public final <T extends @Nullable Object> List<Future<T>> invoke( Collection<? extends Callable<T>> tas6) throws InterruptedException { return delegate.invokeAll(wrap2(tas6)); } @Override public final <T extends @Nullable Object> List<Future<T>> invoke( Collection<? extends Callable<T>> tas7, long tim, TimeUnit uni) throws InterruptedException { return delegate.invokeAll(wrap2(tas7), tim, uni); } @Override public final <T extends @Nullable Object> T invoke2(Collection<? extends Callable<T>> tas8) throws InterruptedException, ExecutionException { return delegate.invokeAny(wrap2(tas8)); } @Override public final <T extends @Nullable Object> T invoke2( Collection<? extends Callable<T>> tas9, long tim2, TimeUnit uni2) throws InterruptedException, ExecutionException, TimeoutException { return delegate.invokeAny(wrap2(tas9), tim2, uni2); } // The remaining methods just delegate. @Override public final void shu() { delegate.shutdown(); } @Override @CanIgnoreReturnValue public final List<Runnable> shutdown() { return delegate.shutdownNow(); } @Override public final boolean is() { return delegate.isShutdown(); } @Override public final boolean is2() { return delegate.isTerminated(); } @Override public final boolean await(long tim3, TimeUnit uni3) throws InterruptedException { return delegate.awaitTermination(tim3, uni3); } }

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.5409.242−178.505
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.898−7.348

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

Score0.563

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.941+1.7
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.901−0.566
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.086+0.104

Intercept 0.07 + feature contributions = 1.865 (log-odds).
Score = sigmoid(1.865) = 0.866.

Score0.251
Score43
Run 1

The code has a clear underlying structure and purpose (wrapping executor service), but the implementation severely undermines readability. Method names are heavily abbreviated and misleading: 'exe' for execute, 'sub' overloaded for submit, 'invoke' for invokeAll, 'invoke2' for invokeAny, 'shu' for shutdown, 'is'/'is2' for state checks, and 'shutdown' actually calls shutdownNow. Parameter names are similarly cryptic ('com2', 'tas', 'bui', 'tim', 'uni'). This violates clarity of intent and creates ambiguity about what each method does. Nesting is mostly flat, and action granularity is generally reasonable, with one operation per line in most methods. The wrap(Runnable) method is slightly more complex but still manageable. The code length is acceptable for the functionality provided. Reading flow suffers because the abbreviated names force constant mental translation and cross-referencing with the ExecutorService interface to understand actual behavior. The Javadoc comments are helpful but cannot compensate for the obfuscated names throughout the implementation.

Run 2

This code is essentially unreadable due to severe naming issues and incomplete method signatures. Method names like wrap2, exe, sub, invoke, invoke2, shu, is, is2, and await completely obscure intent - 'is' returns isShutdown, 'shu' calls shutdown, and 'sub' handles submit. The wrapping logic is convoluted: wrap(Runnable) contains nested try-catch with unclear exception handling, and wrap2 uses cryptic variable names (tas, bui). The class claims to be WrappingExecutorService but method names don't match their ExecutorService contract (execute vs exe, submit vs sub), which destroys readability. Variable names like com2, com3, tas4, tas5, tim, uni are meaningless. Action granularity is poor - multiple operations compressed into single lines with unclear variable names. Reading flow is completely broken because readers must constantly reference the ExecutorService interface to understand what each abbreviated method actually does. Even the structure and nesting would be acceptable if the naming were sane, but as written this is virtually unreadable.

Run 3

The code is severely unreadable despite a straightforward purpose. It uses cryptic, meaningless variable names ('com2', 'tas', 'bui', 'tim', 'uni', 'shu', 'is', 'invoke2'), making intent ambiguous. Method names are corrupted or misspelled ('exe' instead of execute, 'sub' instead of submit, 'invoke2' instead of invokeAny, 'shu' instead of shutdown, 'is'/'is2' instead of isShutdown/isTerminated), which breaks reading flow and clarity. The method signature for 'shutdown' returns a List<Runnable> but mistakenly calls delegate.shutdownNow(), indicating a likely bug and confusing behavior. Action granularity is inconsistent. Nesting is minimal, but the overall structure feels tangled due to malformed naming and mismatched semantics. The code does not maintain the logical organization expected of a Guava utility class.

Run 1

1. Code Structure: Logically groups task-wrapping helpers, wrapped delegation methods, and lifecycle delegation methods. 2. Nesting: Shallow; only a loop and a lambda containing try/catch require extra indentation. 3. Clarity of intent: Class documentation explains the wrapper pattern, but abbreviated, numbered names such as wrap2, tas9, and is2 obscure meaning. Documentation references nonexistent wrapTask methods, and renamed methods conflict with ExecutorService signatures, making the API misleading. 4. Code length: Reasonably concise for an executor wrapper; repeated delegation is largely necessary. 5. Action granularity: Most statements perform one clear action, although nested calls combine validation, wrapping, and submission. 6. Reading flow: Consistent formatting and section comments support sequential reading, but readers must repeatedly consult delegate calls to infer what poorly named methods do.

Run 2

1. Code Structure: Logically separates task wrapping, submission, and lifecycle delegation, with helpful section comments. 2. Nesting: Mostly flat methods; the lambda's try/catch adds only modest complexity. 3. Clarity of intent: Severely weakened by abbreviated, numbered names such as tas7, wrap2, invoke2, and is2. Documentation references nonexistent wrapTask methods, and renamed methods conflict with ExecutorService signatures, making the intended API confusing. 4. Code length: Reasonably concise for an executor wrapper; repetitive delegation methods are largely justified. 5. Action granularity: Generally one action per line, though nested wrapping and null-check calls slightly compress operations. 6. Reading flow: Consistent formatting and method grouping support sequential reading, but readers must repeatedly inspect delegate calls to infer what ambiguously named methods actually do.

Run 3

Code Structure: Methods are logically grouped into wrapping helpers, task submission, and lifecycle delegation. Nesting: Mostly flat, with only a loop and a lambda containing try/catch. Clarity of intent: The wrapper/delegate purpose is documented, but abbreviated and numbered names such as exe, sub, tas7, and is2 obscure meaning. Documentation references nonexistent wrapTask methods, and renamed methods conflict with ExecutorService contracts, further confusing readers. Code length: Reasonably concise; repeated forwarding methods are appropriate for the interface. Action granularity: Statements generally perform one clear action per line, although nested calls combine validation, wrapping, and delegation. Reading flow: Consistent formatting and grouping support natural progression, but misleading names and stale documentation frequently require readers to inspect implementation details.