Sample

int-07dcfc5553fa-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines178

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6910–1; higher is more readable
Dorn0.1750–1; higher is more readable
Mi0.2910–1; higher is more readable
LLOC29Logical lines; fewer is more readable
DeepSeek V4 Pro13.670–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.6010–1; higher is more readable

Views

Source code

package io.netty.channel.nio; import io.netty.channel.Channel; import io.netty.channel.DefaultSelectStrategyFactory; import io.netty.channel.EventLoopTaskQueueFactory; import io.netty.channel.IoEventLoop; import io.netty.channel.IoEventLoopGroup; import io.netty.channel.IoHandlerFactory; import io.netty.channel.MultiThreadIoEventLoopGroup; import io.netty.channel.SelectStrategyFactory; import io.netty.channel.SingleThreadEventLoop; import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.EventExecutorChooserFactory; import io.netty.util.concurrent.RejectedExecutionHandler; import io.netty.util.concurrent.RejectedExecutionHandlers; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; import java.nio.channels.Selector; import java.nio.channels.spi.SelectorProvider; import java.util.concurrent.Executor; import java.util.concurrent.ThreadFactory; /** * {@link MultiThreadIoEventLoopGroup} implementation which is used for NIO {@link Selector} based {@link Channel}s. * * @deprecated Use {@link MultiThreadIoEventLoopGroup} with {@link NioIoHandler#newFactory()}. */ @Deprecated public class NioEventLoopGroup extends MultiThreadIoEventLoopGroup implements IoEventLoopGroup { private static final InternalLogger LOGGER = InternalLoggerFactory.getInstance(NioEventLoopGroup.class); /** * Create a new instance using the default number of threads, the default {@link ThreadFactory} and * the {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. */ public NioEventLoopGroup() { this(0); } /** * Create a new instance using the specified number of threads, {@link ThreadFactory} and the * {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. */ public NioEventLoopGroup(int nThreads) { this(nThreads, (Executor) null); } /** * Create a new instance using the default number of threads, the given {@link ThreadFactory} and the * {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. */ public NioEventLoopGroup(ThreadFactory threadFactory) { this(0, threadFactory, SelectorProvider.provider()); } /** * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the * {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. */ public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory) { this(nThreads, threadFactory, SelectorProvider.provider()); } public NioEventLoopGroup(int nThreads, Executor executor) { this(nThreads, executor, SelectorProvider.provider()); } /** * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the given * {@link SelectorProvider}. */ public NioEventLoopGroup( int nThreads, ThreadFactory threadFactory, final SelectorProvider selectorProvider) { this(nThreads, threadFactory, selectorProvider, DefaultSelectStrategyFactory.INSTANCE); } public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory) { super(nThreads, threadFactory, NioIoHandler.newFactory(selectorProvider, selectStrategyFactory), RejectedExecutionHandlers.reject()); } public NioEventLoopGroup( int nThreads, Executor executor, final SelectorProvider selectorProvider) { this(nThreads, executor, selectorProvider, DefaultSelectStrategyFactory.INSTANCE); } public NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory) { super(nThreads, executor, NioIoHandler.newFactory(selectorProvider, selectStrategyFactory), RejectedExecutionHandlers.reject()); } public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory) { super(nThreads, executor, NioIoHandler.newFactory(selectorProvider, selectStrategyFactory), chooserFactory, RejectedExecutionHandlers.reject()); } public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory, final RejectedExecutionHandler rejectedExecutionHandler) { super(nThreads, executor, NioIoHandler.newFactory(selectorProvider, selectStrategyFactory), chooserFactory, rejectedExecutionHandler); } public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory, final RejectedExecutionHandler rejectedExecutionHandler, final EventLoopTaskQueueFactory taskQueueFactory) { super(nThreads, executor, NioIoHandler.newFactory(selectorProvider, selectStrategyFactory), chooserFactory, rejectedExecutionHandler, taskQueueFactory); } /** * @param nThreads the number of threads that will be used by this instance. * @param executor the Executor to use, or {@code null} if default one should be used. * @param chooserFactory the {@link EventExecutorChooserFactory} to use. * @param selectorProvider the {@link SelectorProvider} to use. * @param selectStrategyFactory the {@link SelectStrategyFactory} to use. * @param rejectedExecutionHandler the {@link RejectedExecutionHandler} to use. * @param taskQueueFactory the {@link EventLoopTaskQueueFactory} to use for * {@link SingleThreadEventLoop#execute(Runnable)}, * or {@code null} if default one should be used. * @param tailTaskQueueFactory the {@link EventLoopTaskQueueFactory} to use for * {@link SingleThreadEventLoop#executeAfterEventLoopIteration(Runnable)}, * or {@code null} if default one should be used. */ public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory taskQueueFactory, EventLoopTaskQueueFactory tailTaskQueueFactory) { super(nThreads, executor, NioIoHandler.newFactory(selectorProvider, selectStrategyFactory), chooserFactory, rejectedExecutionHandler, taskQueueFactory, tailTaskQueueFactory); } /** * This method is a no-op. * * @deprecated */ @Deprecated public void setIoRatio(int ioRatio) { LOGGER.debug("NioEventLoopGroup.setIoRatio(int) logic was removed, this is a no-op"); } /** * Replaces the current {@link Selector}s of the child event loops with newly created {@link Selector}s to work * around the infamous epoll 100% CPU bug. */ public void rebuildSelectors() { for (EventExecutor e: this) { ((NioEventLoop) e).rebuildSelector(); } } @Override protected IoEventLoop newChild(Executor executor, IoHandlerFactory ioHandlerFactory, Object... args) { RejectedExecutionHandler rejectedExecutionHandler = (RejectedExecutionHandler) args[0]; EventLoopTaskQueueFactory taskQueueFactory = null; EventLoopTaskQueueFactory tailTaskQueueFactory = null; int argsLength = args.length; if (!((argsLength > 1))) {} else { taskQueueFactory = (EventLoopTaskQueueFactory) args[1]; } if (!((argsLength > 2))) {} else { tailTaskQueueFactory = (EventLoopTaskQueueFactory) args[2]; } return new NioEventLoop( this, executor, ioHandlerFactory, taskQueueFactory, tailTaskQueueFactory, rejectedExecutionHandler); } }

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.555−178.515
Source linesThe number of non-empty source lines.178+71.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.634−6.951

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

Score0.691

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.178−5.266
Indentation frequencyHow rapidly indentation changes from line to line.139+4.071
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.139−2.769
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.177.966+2.078
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.115.966−1.247
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.113.402+1.025
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.047+0.486

Intercept 0.07 + feature contributions = -1.552 (log-odds).
Score = sigmoid(-1.552) = 0.175.

Score0.291
Score29
Run 1

The code is a deprecated Netty class implementing an event loop group. Its structure is mostly linear with many constructor overloads, which bloats length but is conventional for this API. Nesting is minimal, but the newChild() method contains awkward inverted conditionals with empty if-bodies, harming readability. Clarity of intent is mixed: javadocs help, but some constructors lack documentation, and the NioIoHandler factory pattern is repetitive. Action granularity is generally good, though super() calls pack multiple arguments onto single lines. Reading flow is disrupted by the bizarre if (!condition) {} else pattern and unnecessary parentheses. The class is maintainable but not exemplary; improving the conditional clarity and consolidating constructors would raise the score.

Run 2

The code has clear structure and intent, with well-named methods and JavaDoc comments explaining each constructor. However, readability suffers from excessive constructor overloads that create redundancy and make the class hard to navigate. The `newChild` method contains awkward inverted conditionals (`if (!((argsLength > 1))) {} else { ... }`) that should be written as straightforward `if` statements. Action granularity is mostly good, with one operation per line, but the long parameter lists in constructors reduce clarity. The reading flow is disrupted by the many similar-looking constructors and the unnecessarily verbose empty if-blocks. Overall, the code is maintainable but could be significantly improved by simplifying constructor chains and cleaning up conditional logic.

Run 3

The code is generally well-structured with clear constructor delegation and Javadocs, but has some readability issues. The main problems are: (1) awkward inverted conditionals in newChild() using 'if (!((argsLength > 1))) {} else' pattern which is confusing and should be simple 'if (argsLength > 1)'; (2) many similar constructor overloads create repetition though this is common for builder-pattern APIs. Positives include flat nesting, logical organization, clear method names, good Javadoc coverage, and one-action-per-line formatting. The constructor chain is logical and follows a clear pattern. Overall the code is readable but the newChild() method unnecessarily obscures simple logic, and the numerous constructors add length that may be unavoidable given API flexibility requirements.

Run 1

Code Structure: Constructors are logically grouped, followed by operational methods and child creation; delegation keeps implementation organized. Nesting: Very shallow, with only a loop and simple conditionals. Clarity of intent: Descriptive names and Javadoc explain most behavior, but positional Object... arguments and casts obscure configuration handling. The negated conditions with empty if blocks and populated else blocks are unnecessarily confusing. Code length: Numerous constructor overloads and repetitive documentation increase scanning effort, although individual methods remain concise. Action granularity: Statements generally perform one action each; compact empty branches are an awkward exception. Reading flow: Consistent delegation and method ordering support natural reading, but long parameter lists, uneven indentation, and inverted conditional logic interrupt the flow.

Run 2

Code Structure: Constructors are logically grouped and delegate consistently, followed by operational methods, though numerous overloads add repetition. Nesting: Mostly flat, with only a simple loop and conditionals; empty if branches with negated conditions unnecessarily complicate newChild. Clarity of intent: Descriptive names and Javadoc clarify responsibilities, defaults, and deprecation, but positional Object varargs and casts obscure configuration handling. Code length: Individual methods are concise, but repetitive constructors and documentation make the class lengthy to scan. Action granularity: Statements generally perform one action each, although inline empty branches reduce visual clarity. Reading flow: Constructor progression and consistent delegation support natural reading; inconsistent parameter indentation, redundant parentheses, and inverted conditional logic interrupt it.

Run 3

Code Structure: Constructors are grouped logically, followed by operational methods and child creation; repeated overloads add clutter. Nesting: Mostly flat, with only shallow loops and conditionals, although empty if branches with negated conditions unnecessarily complicate newChild. Clarity of intent: Descriptive names and Javadoc explain the class and configuration, but positional Object... arguments and casts obscure type expectations. Code length: Individual methods are concise, while numerous similar constructors and repetitive documentation make the class lengthy. Action granularity: Statements generally perform one action each; compact empty-if/else formatting is a notable readability exception. Reading flow: Constructor delegation and consistent method responsibilities support natural reading, but uneven indentation, long signatures, redundant parentheses, and inverted conditional logic interrupt it.