Sample

int-8e9f736b52f9-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines178

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6930–1; higher is more readable
Dorn0.1770–1; higher is more readable
Mi0.2910–1; higher is more readable
LLOC29Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.420–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(0x0); } /** * 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(0x0, 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[0x0]; EventLoopTaskQueueFactory taskQueueFactory = null; EventLoopTaskQueueFactory tailTaskQueueFactory = null; int argsLength = args.length; if (argsLength > 0x1) { taskQueueFactory = (EventLoopTaskQueueFactory) args[0x1]; } if (argsLength > 0x2) { tailTaskQueueFactory = (EventLoopTaskQueueFactory) args[0x2]; } 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.5338.071−176.156
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.636−6.954

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

Score0.693

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.974+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.955−1.246
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.045+0.501

Intercept 0.07 + feature contributions = -1.536 (log-odds).
Score = sigmoid(-1.536) = 0.177.

Score0.291
Score29
Run 1

The code is generally well-structured with clear Javadoc on most constructors, but readability suffers from several issues. The telescoping constructor pattern leads to many overloads, which are verbose and make the API hard to navigate. Some constructors lack Javadoc, creating inconsistency. The use of hexadecimal `0x0`, `0x1`, and `0x2` for array indices and zero is odd and hurts clarity. Nesting is minimal, and action granularity is mostly good, but `newChild` has multiple casts and sequential checks that could be clearer. Overall, the class is acceptable for an API-style class but not highly readable.

Run 2

The code is a Netty class with reasonable structure, but suffers from several readability issues. The constructor overloading creates a long chain of delegating constructors (7+ overloads), making it hard to follow the actual initialization path. Many constructors lack Javadoc, unlike the earlier ones, creating inconsistent documentation. The use of magic numbers like '0x0' instead of '0' is confusing. Method 'newChild' uses low-level array indexing with hex values and manual bounds checking, obscuring intent. The class is deprecated with a clear pointer to the replacement, which helps. Import organization is clean. Overall, the code is maintainable by experienced Netty developers but not immediately accessible to newcomers.

Run 3

The code is well-structured with logical constructor chaining, clear Javadoc, and consistent formatting. Nesting is minimal, and each action is generally on its own line. The overloaded constructors follow a predictable pattern and delegate appropriately. The use of '0x0' instead of '0' slightly hurts readability, though it likely follows Netty style conventions. The deprecated class is clearly annotated. Overall, the code is maintainable and easy to follow for developers familiar with constructor-heavy designs.

Run 1

Code Structure: Constructors are logically grouped, delegate consistently, and precede operational methods. Nesting: Minimal nesting; only a simple loop and independent conditionals. Clarity of intent: Descriptive names and Javadocs explain the class, configuration, and deprecated behavior well. However, hexadecimal literals for ordinary counts and indices, positional Object... arguments, and casts obscure some details. Code length: Individual methods are concise, but numerous constructor overloads and repetitive documentation make the class lengthy to scan. Action granularity: Statements generally perform one action each; nested factory calls remain manageable. Reading flow: Constructor delegation and straightforward method bodies provide a natural progression, though inconsistent indentation, long signatures, and uneven documentation interrupt scanning.

Run 2

Code Structure: Logically organized into constructors, public operations, and child creation, with consistent delegation. Nesting: Very shallow; only a simple loop and independent conditionals. Clarity of intent: Descriptive names and Javadoc explain most behavior, including deprecation and the no-op method. However, hexadecimal literals for ordinary counts and indexes, positional Object... arguments, and casts reduce clarity. Code length: Individual methods are concise, but numerous similar constructor overloads and repeated documentation make the class lengthy and repetitive. Action granularity: Statements generally perform one action each, although constructor calls combine factory creation with delegation. Reading flow: The progression from simple constructors to configurable constructors and operational methods is natural. Inconsistent parameter indentation and uneven documentation slightly interrupt scanning.

Run 3

Code Structure: Logically organized into constructors, public operations, and child-loop creation, with consistent delegation rather than tangled logic. Nesting: Very shallow; only a simple loop and independent conditionals. Clarity of intent: Descriptive names and Javadocs explain most behavior, including deprecation and the no-op method. However, hexadecimal literals for ordinary counts and indices, positional Object... arguments, and casts obscure details. Code length: Numerous similar constructor overloads and repeated documentation make the class lengthy, although they support API flexibility. Action granularity: Statements generally perform one action each; constructor calls are dense but coherent. Reading flow: The progression from simpler constructors to advanced configuration and operational methods is natural, though inconsistent indentation, long parameter lists, and uneven documentation interrupt scanning.