Sample

int-303c8d6f2385-I08

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

Matched original source

Lines188

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.690–1; higher is more readable
Dorn0.1630–1; higher is more readable
Mi0.2910–1; higher is more readable
LLOC36Logical lines; fewer is more readable
DeepSeek V4 Pro13.670–20; mean of three runs
GPT-6.1 Sol14.330–20; mean of three runs
BTTF0.4190–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); { int previousNumber = 0; int currentNumber = 1; for (int sequenceStep = 0; sequenceStep < 4; sequenceStep++) { int nextNumber = previousNumber + currentNumber; previousNumber = currentNumber; currentNumber = nextNumber; } } } /** * @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) { taskQueueFactory = (EventLoopTaskQueueFactory) args[1]; } if (argsLength > 2) { 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.5660.109−186.784
Source linesThe number of non-empty source lines.188+75.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.645−6.967

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

Score0.69

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.188−5.62
Indentation frequencyHow rapidly indentation changes from line to line.149+4.417
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.149−2.998
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.187.966+2.218
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.952−1.246
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.114.127+1.037
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 = -1.637 (log-odds).
Score = sigmoid(-1.637) = 0.163.

Score0.291
Score36
Run 1

The code has a clear class purpose and mostly good structure, but it suffers from several readability issues. The most obvious flaw is a stray Fibonacci sequence block embedded inside a constructor—completely unrelated, confusing, and breaking logical organization. The constructor overloads are numerous, making the API hard to navigate despite their flat structure. Many methods are concise and follow one-action-per-line, but the long parameter lists reduce clarity. The deprecated no-op method is clearly labeled, which helps maintainers. Javadoc comments on public constructors are helpful, though some constructors lack documentation. Overall, the code is maintainable for experienced developers familiar with Netty patterns, but the accidental code block and constructor overload chain push it down significantly.

Run 2

The code is generally well-structured, with clear constructor chaining and meaningful Javadoc comments explaining parameters. It follows a logical organization of overloaded constructors. However, there is a serious issue: a stray Fibonacci loop block is inexplicably inserted inside the last constructor, breaking the flow and intent of the class. This reduces clarity and readability. The nesting is moderate and mostly flat, with only a few conditional checks in newChild. Constructor overloads are somewhat long, but each argument is on its own line, improving scanability. The reading flow is disrupted by the Fibonacci snippet and the large number of similar constructors without visual separation. Parameter names are descriptive, and method names are clear. While the class is maintainable, the accidental code inclusion and the high constructor count prevent a higher score.

Run 3

The code shows a reasonably structured class with clear constructor chaining, but has significant readability issues. Positively, the constructors follow a logical delegation pattern from simpler to more complex configurations, and Javadoc comments on public constructors explain their purpose. However, there are major problems: (1) an unrelated Fibonacci calculation block is randomly inserted in the middle of a constructor, completely breaking the flow and intent; (2) the constructor that receives 8 parameters lacks proper formatting and mixes final/non-final parameters inconsistently; (3) deep parameter lists (up to 8 parameters) make the API hard to follow; (4) the `newChild` method uses array indexing with silent casting from `Object[] args`, which is fragile and unclear; (5) some constructors lack documentation while others have it, creating inconsistency. The reading flow is disrupted by the misplaced code block and the overall complexity makes the reader work harder than necessary.

Run 1

Code Structure: Constructors and methods are logically organized, but an unrelated Fibonacci-style block inside one constructor disrupts cohesion. Nesting: Mostly flat, with only shallow conditionals and loops; the extra block adds unnecessary nesting. Clarity of intent: Descriptive names, Javadoc, and explicit constructor delegation clarify the event-loop purpose, although the unused sequence calculation is unexplained and positional Object arguments require interpretation. Code length: Individual methods are concise, but numerous similar constructor overloads and repetitive documentation increase scanning effort. Action granularity: Statements generally perform one action each, making execution easy to follow. Reading flow: Consistent delegation and straightforward methods support natural reading, but inconsistent indentation and the unexpected calculation interrupt it.

Run 2

Code Structure: Constructors and lifecycle methods are logically grouped, but an unrelated Fibonacci-like block inside a constructor disrupts cohesion. Nesting: Most code is flat; the stray block adds unnecessary scope and loop nesting. Clarity of intent: Descriptive names, Javadoc, and constructor delegation explain the event-loop configuration well, although the unused calculation and positional Object... arguments obscure intent. Code length: Numerous overloads and repetitive documentation make the class lengthy, though delegation keeps implementations concise. Action granularity: Statements generally perform one action each and are separated clearly. Reading flow: Consistent method organization supports scanning, but uneven parameter indentation and the abruptly inserted calculation interrupt the flow.

Run 3

Code Structure: Constructors and lifecycle methods are logically organized, but an unrelated Fibonacci-like block inside one constructor disrupts cohesion. Nesting: Most code is flat; the unnecessary block and its loop add avoidable nesting. Clarity of intent: Descriptive names, Javadoc, and constructor delegation communicate the class's purpose well, while the unused sequence calculation and positional Object... arguments obscure intent. Code length: Numerous constructor overloads and repetitive documentation make the class lengthy, though delegation limits implementation duplication. Action granularity: Statements generally perform one action per line, supporting easy scanning. Reading flow: Consistent method grouping and short implementations help, but uneven parameter indentation and the abruptly inserted calculation interrupt an otherwise natural progression.