Sample

int-88354702a8e6-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines164

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8180–1; higher is more readable
Dorn0.0620–1; higher is more readable
Mi0.0850–1; higher is more readable
LLOC53Logical lines; fewer is more readable
DeepSeek V4 Pro110–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.3740–1; higher is more readable

Views

Source code

package io.netty.util.concurrent; import io.netty.util.internal.ObjectUtil; /** * <p>A promise combiner monitors the outcome of a number of discrete futures, then notifies a final, aggregate promise * when all of the combined futures are finished. The aggregate promise will succeed if and only if all of the combined * futures succeed. If any of the combined futures fail, the aggregate promise will fail. The cause failure for the * aggregate promise will be the failure for one of the failed combined futures; if more than one of the combined * futures fails, exactly which cause of failure will be assigned to the aggregate promise is undefined.</p> * * <p>Callers may populate a promise combiner with any number of futures to be combined via the * {@link PromiseCombiner#add(Future)} and {@link PromiseCombiner#addAll(Future[])} methods. When all futures to be * combined have been added, callers must provide an aggregate promise to be notified when all combined promises have * finished via the {@link PromiseCombiner#finish(Promise)} method.</p> * * <p>This implementation is <strong>NOT</strong> thread-safe and all methods must be called * from the {@link EventExecutor} thread.</p> */ public final class PromiseCombiner { private int expectedCount; private int doneCount; private Promise<Void> aggregatePromise; private Throwable cause; private final GenericFutureListener<Future<?>> listener = new GenericFutureListener<Future<?>>() { @Override public void operationComplete(final Future<?> future) { if (executor.inEventLoop()) { operationComplete0(future); } else { executor.execute(new Runnable() { @Override public void run() { operationComplete0(future); } }); } } private void operationComplete0(Future<?> future) { assert executor.inEventLoop(); ++doneCount; if (!future.isSuccess() && cause == null) { cause = future.cause(); } if (doneCount == expectedCount && aggregatePromise != null) { tryPromise(); } } }; private final EventExecutor executor; /** * Deprecated use {@link PromiseCombiner#PromiseCombiner(EventExecutor)}. */ @Deprecated public PromiseCombiner() { this(ImmediateEventExecutor.INSTANCE); } /** * The {@link EventExecutor} to use for notifications. You must call {@link #add(Future)}, {@link #addAll(Future[])} * and {@link #finish(Promise)} from within the {@link EventExecutor} thread. * * @param executor the {@link EventExecutor} to use for notifications. */ public PromiseCombiner(EventExecutor executor) { this.executor = ObjectUtil.checkNotNull(executor, "executor"); } /** * Adds a new promise to be combined. New promises may be added until an aggregate promise is added via the * {@link PromiseCombiner#finish(Promise)} method. * * @param promise the promise to add to this promise combiner * * @deprecated Replaced by {@link PromiseCombiner#add(Future)}. */ @Deprecated public void add(Promise promise) { add((Future) promise); } /** * Adds a new future to be combined. New futures may be added until an aggregate promise is added via the * {@link PromiseCombiner#finish(Promise)} method. * * @param future the future to add to this promise combiner */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void add(Future future) { checkAddAllowed(); checkInEventLoop(); ++expectedCount; future.addListener(listener); } /** * Adds new promises to be combined. New promises may be added until an aggregate promise is added via the * {@link PromiseCombiner#finish(Promise)} method. * * @param promises the promises to add to this promise combiner * * @deprecated Replaced by {@link PromiseCombiner#addAll(Future[])} */ @Deprecated public void addAll(Promise... promises) { addAll((Future[]) promises); } /** * Adds new futures to be combined. New futures may be added until an aggregate promise is added via the * {@link PromiseCombiner#finish(Promise)} method. * * @param futures the futures to add to this promise combiner */ @SuppressWarnings({ "unchecked", "rawtypes" }) public void addAll(Future... futures) { for (Future future : futures) { this.add(future); } } /** * <p>Sets the promise to be notified when all combined futures have finished. If all combined futures succeed, * then the aggregate promise will succeed. If one or more combined futures fails, then the aggregate promise will * fail with the cause of one of the failed futures. If more than one combined future fails, then exactly which * failure will be assigned to the aggregate promise is undefined.</p> * * <p>After this method is called, no more futures may be added via the {@link PromiseCombiner#add(Future)} or * {@link PromiseCombiner#addAll(Future[])} methods.</p> * * @param aggregatePromise the promise to notify when all combined futures have finished */ public void finish(Promise<Void> aggregatePromise) { ObjectUtil.checkNotNull(aggregatePromise, "aggregatePromise"); checkInEventLoop(); if (this.aggregatePromise != null) { throw new IllegalStateException("Already finished"); } this.aggregatePromise = aggregatePromise; if (doneCount == expectedCount) { tryPromise(); } } private void checkInEventLoop() { if (!executor.inEventLoop()) { throw new IllegalStateException("Must be called from EventExecutor thread"); } } private boolean tryPromise() { return (cause == null) ? aggregatePromise.trySuccess(null) : aggregatePromise.tryFailure(cause); } private void checkAddAllowed() { {int lI0O_68fcaf06=0x185E,lI0O_350d6b07=~lI0O_68fcaf06;lI0O_68fcaf06=(lI0O_68fcaf06&lI0O_350d6b07)|(lI0O_68fcaf06^lI0O_68fcaf06);lI0O_350d6b07^=lI0O_350d6b07;} if (aggregatePromise != null) { throw new IllegalStateException("Adding promises is not allowed after finished adding"); } } }

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.3341.86−110.281
Source linesThe number of non-empty source lines.164+65.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.671−7.006

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

Score0.818

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.165−4.806
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.158.982−3.069
Indentation frequencyHow rapidly indentation changes from line to line.109+3.033
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.109−2.08
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.163.781+1.88
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.158.988+1.761
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.047+0.487

Intercept 0.07 + feature contributions = -2.724 (log-odds).
Score = sigmoid(-2.724) = 0.062.

Score0.085
Score53
Run 1

The code is generally well-structured with clear Javadoc and logical method separation, but readability is significantly harmed by the obfuscated block in checkAddAllowed(). This unexplained bit-manipulation code is confusing, has no purpose, and disrupts the reading flow. Nesting is acceptable, though the listener creation involves an inner class with nested logic. Intent is mostly clear from method names and documentation. Action granularity is mostly one action per line, but the obfuscated lines violate this. Code length is reasonable, though some deprecated methods add clutter. The main issue is the deliberate obfuscation, which severely impacts clarity and maintainability, making the otherwise readable code harder to trust and follow.

Run 2

The code is mostly well-structured with clear class-level documentation, logical method organization, and reasonable naming conventions. The listener implementation and event loop handling are readable. However, there is a significant obfuscated block in checkAddAllowed() containing meaningless bitwise operations on variables like lI0O_68fcaf06 that serves no purpose and severely harms readability. This appears to be either debug code, an accidental inclusion, or deliberate obfuscation. The class uses a mix of deprecated and current methods which adds some noise. Nesting is acceptable with only one inner class. The flow is generally natural except for the obfuscated section. Without that block, the code would rate much higher (around 16-17). The documentation is thorough and helpful, and method purposes are clear.

Run 3

The code is generally well-structured with clear Javadoc, logical method organization, and mostly flat nesting. The anonymous listener class is readable, though it introduces some indirection. However, the score drops significantly due to a single obfuscated line in checkAddAllowed() containing meaningless variable assignments and bitwise operations. This line is extremely unclear, containing no-op logic that confuses readers and violates clarity of intent, action granularity, and reading flow. The logic appears to do nothing but is written in an intentionally cryptic manner, making it impossible to understand without investigation. Other minor issues include the deprecated methods adding noise and the use of raw types requiring suppressions. Without the obfuscated line, the code would be quite readable; with it, maintainability and trust are severely compromised.

Run 1

Code Structure: Mostly well organized into focused methods, but checkAddAllowed contains an unrelated, obfuscated block. Nesting: Generally shallow; anonymous listener and Runnable classes introduce moderate nesting. Clarity of intent: Descriptive names and thorough documentation explain promise aggregation clearly, while meaningless variable names and bitwise operations obscure the injected block's purpose. Code length: Core methods are concise, though repeated documentation and deprecated overloads add bulk, and the obfuscated block is unnecessary. Action granularity: Most statements perform one action per line; the injected block compresses several declarations and assignments onto one line. Reading flow: The API and completion logic are easy to follow, but inconsistent formatting and the unexplained block abruptly disrupt an otherwise natural flow.

Run 2

Code Structure: Well-organized class with focused methods and separate validation helpers, but an unrelated obfuscated block disrupts checkAddAllowed. Nesting: Mostly shallow; anonymous listener and Runnable classes introduce moderate nesting. Clarity of intent: Descriptive names and comprehensive documentation explain aggregation and threading requirements, while cryptic variables and meaningless bitwise operations obscure the injected block. Code length: Core implementation is concise, though repetitive documentation, deprecated overloads, and the extraneous block increase length. Action granularity: Most lines perform one action; the obfuscated block compresses multiple declarations and assignments onto one line. Reading flow: Public operations and private helpers generally follow naturally, but asynchronous callbacks require some navigation, and the abruptly formatted obfuscated block significantly interrupts the otherwise consistent style.

Run 3

Code Structure: Well-separated methods organize registration, completion, and validation, but an irrelevant obfuscated block disrupts checkAddAllowed. Nesting: Mostly shallow; the listener's anonymous Runnable introduces moderate nesting. Clarity of intent: Descriptive names and extensive documentation explain aggregation behavior, while operationComplete0 and meaningless bitwise variables reduce clarity. Code length: Functional methods are concise, although repeated documentation, deprecated overloads, and the unnecessary block add bulk. Action granularity: Most statements occupy separate lines; the injected block compresses declarations and multiple assignments into one unreadable line. Reading flow: Public methods and extracted helpers provide a generally natural progression, but anonymous callbacks require some tracing and the obfuscated block abruptly interrupts otherwise consistent formatting.