Sample

int-32c896a433eb-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines188

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6910–1; higher is more readable
Dorn0.1560–1; higher is more readable
Mi0.2910–1; higher is more readable
LLOC39Logical lines; fewer is more readable
DeepSeek V4 Pro11.330–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.4750–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) { final int a = 1; final int b = -1; RejectedExecutionHandler rejectedExecutionHandler = (RejectedExecutionHandler) args[(a + b)]; EventLoopTaskQueueFactory taskQueueFactory = null; EventLoopTaskQueueFactory tailTaskQueueFactory = null; int argsLength = args.length; final int c = 2; final int d = -1; if (argsLength > (c + d)) { final int f = 2; final int g = -1; taskQueueFactory = (EventLoopTaskQueueFactory) args[(f + g)]; } final int h = 1; final int i = 1; if (argsLength > (h + i)) { final int j = 1; final int k = 1; tailTaskQueueFactory = (EventLoopTaskQueueFactory) args[(j + k)]; } 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.5976.307−197.218
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.62−6.93

Intercept 8.87 + feature contributions = -120.078 (log-odds).
Score = sigmoid(-120.078) = 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.189−5.656
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.957+2.217
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.937−1.245
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.114.111+1.037
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.048+0.473

Intercept 0.07 + feature contributions = -1.686 (log-odds).
Score = sigmoid(-1.686) = 0.156.

Score0.291
Score39
Run 1

This code has moderate structure but suffers from several readability issues. The constructor overloads are logical but create excessive boilerplate with 10+ variations. The most problematic section is the newChild() method's bizarre indexing pattern using variables like 'a+b', 'c+d', 'f+g', 'h+i' to access array elements - this is confusing and obscures intent. Several lines exceed reasonable width, especially constructor chaining calls. Action granularity is inconsistent - some lines contain multiple operations while others are properly separated. The deprecated methods and class-level deprecation create ambiguity about whether the class should be used. Javadocs are present on some constructors but missing on others, creating inconsistent documentation. The imports are excessive but appropriate for the functionality. The method's parameter proliferation (8 parameters in one variant) indicates potential design issues. While the overall flow follows a logical constructor delegation pattern, the convoluted array indexing in newChild() significantly degrades clarity and maintainability.

Run 2

The code is structurally sound with clear constructor chaining, organized imports, and mostly useful method Javadocs. However, the `newChild` method is confusing. It uses cryptic, single-letter variables (`a`, `b`, `c`, `d`, etc.) to perform arithmetic offsets like `args[(a + b)]`, `argsLength > (c + d)`, and `args[(f + g)]`. These expressions obscure array indices and make the intent hard to follow. A reader must manually compute the values (index 0, 1, 2, etc.) instead of seeing descriptive constants. Additionally, using `args` as an `Object[]` without meaningful names for positions reduces clarity. Other parts of the class, especially the constructors and `rebuildSelectors`, are clear, but the `newChild` logic creates unnecessary cognitive load, violating clarity of intent and action granularity. The code has reasonable length and flat nesting, but the index arithmetic and mystery arguments lower readability.

Run 3

The code is partially readable due to clear class-level documentation, consistent constructor chaining, and a logical package structure. However, significant readability issues lower the score. The `newChild` method uses heavily obfuscated arithmetic (e.g., `args[(a + b)]` instead of `args[0]`, `argsLength > (c + d)` instead of `argsLength > 1`) which destroys clarity of intent. This is an anti-pattern for maintainability. While most constructors are straightforward, the class has too many overloaded constructors (9 total), creating redundancy. Naming and imports are standard, and line lengths are mostly acceptable, but the artificial variable declarations in `newChild` are confusing. The class is deprecated yet still complex, which adds ambiguity. Overall, the code is structurally organized but suffers from deliberate opacity in a critical method.

Run 1

Code Structure: Constructors, compatibility methods, and child creation are logically grouped, with straightforward delegation. Nesting: Shallow loops and conditionals keep control flow easy to follow. Clarity of intent: Descriptive API names and Javadocs explain most behavior, but newChild obscures simple argument indexes and thresholds behind meaningless variables and arithmetic. Positional Object... arguments and casts also require contextual knowledge. Code length: Numerous constructor overloads and repeated documentation increase scanning effort, while unnecessary constants make newChild longer than needed. Action granularity: Statements generally perform one action per line, and multiline calls remain understandable. Reading flow: The progression from constructors to operational methods is natural, but inconsistent continuation indentation and the artificial arithmetic interrupt otherwise clean reading.

Run 2

Code Structure: Constructors and lifecycle methods are logically grouped, although numerous overloads create repetition. Nesting: Very shallow; only a simple loop and two independent conditionals. Clarity of intent: Descriptive class, method, and parameter names plus Javadoc explain most behavior, but newChild uses meaningless variables and arithmetic to obscure straightforward array indices and length checks. Code length: Most methods are concise, but repeated constructor documentation and unnecessary constants inflate the class. Action granularity: Statements generally perform one action each, with constructor delegation keeping initialization focused. Reading flow: The progression from simple constructors to configurable overloads is natural, followed by operational methods; inconsistent parameter indentation and the contrived arithmetic in newChild interrupt that flow. Overall, readable API scaffolding is weakened by needless local complexity.

Run 3

Code Structure: Constructors and lifecycle methods are logically grouped, with delegation avoiding duplicated initialization. Nesting: Very shallow; only a loop and two independent conditionals. Clarity of intent: Class documentation, descriptive parameter names, and deprecation notices clarify purpose, but newChild uses meaningless variables and arithmetic expressions for simple array indices and thresholds, obscuring intent. Code length: Numerous constructor overloads and repetitive documentation increase scanning effort; unnecessary constants further inflate newChild. Action granularity: Statements generally perform one action each, although inline casts and factory calls add some visual complexity. Reading flow: Progression from simple constructors to advanced configuration and operational methods is natural, but inconsistent indentation, long signatures, positional varargs, and the artificial arithmetic interrupt readability.