Sample

int-8d18c9136609-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines69

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4770–1; higher is more readable
Dorn0.1110–1; higher is more readable
Mi0.5080–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.4140–1; higher is more readable

Views

Source code

package io.netty.testsuite.transport.socket; import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.EventLoopGroup; import io.netty.channel.IoEventLoopGroup; import io.netty.channel.nio.NioIoHandler; import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.util.NetUtil; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.Timeout; import java.nio.channels.AlreadyConnectedException; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import static org.junit.jupiter.api.Assertions.assertTrue; public class SocketMultipleConnectTest extends AbstractSocketTest { @Test @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS) public void test(TestInfo test) throws Throwable { run(test, new Runner<ServerBootstrap, Bootstrap>() { @Override public void run(ServerBootstrap server, Bootstrap boo) throws Throwable { test(server, boo); } }); } public void test(ServerBootstrap sb, Bootstrap cb) throws Exception { Channel sc = null; Channel cc = null; try { sb.childHandler(new ChannelInboundHandlerAdapter()); sc = sb.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel(); cb.handler(new ChannelInboundHandlerAdapter()); cc = cb.register().syncUninterruptibly().channel(); cc.connect(sc.localAddress()).syncUninterruptibly(); ChannelFuture connect2 = cc.connect(sc.localAddress()).await(); assertTrue(connect2.cause() instanceof AlreadyConnectedException); } finally { if (cc != null) { cc.close(); } if (sc != null) { sc.close(); } } } @Override protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> new2() { List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> fac = new ArrayList<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>>(); for (TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap> combo : SocketTestPermutation.INSTANCE.socketWithFastOpen()) { EventLoopGroup gro = combo.newClientInstance().config().group(); if (gro instanceof IoEventLoopGroup && ((IoEventLoopGroup) gro).isIoType(NioIoHandler.class)) { fac.add(combo); } } return fac; } }

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.3573.777−117.935
Source linesThe number of non-empty source lines.69+27.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.675−7.013

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

Score0.477

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.69+1.65
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.70−1.442
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.69−1.163
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.106.957−0.865
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.68.917+0.553
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.105−0.08

Intercept 0.07 + feature contributions = -2.081 (log-odds).
Score = sigmoid(-2.081) = 0.111.

Score0.508
Score26
Run 1

The code is generally readable with a clear structure and intent. The test class is logically organized, and the main test method is concise with a straightforward flow. Nesting is minimal, and action granularity is mostly one action per line. However, readability is reduced by the anonymous inner class and the somewhat cryptic method name `new2()` which lacks descriptive intent. Variable names like `cb`, `sb`, `sc`, `cc`, `boo`, and `gro` are too abbreviated, hurting clarity. The loop in `new2()` contains a complex condition that could be refactored for better readability. Overall, the code is understandable for experienced Netty developers but could be more self-documenting.

Run 2

The code has a logical structure, but several issues reduce readability. The test method uses unclear parameter names ('boo', 'sb', 'cb') and nests a try-finally block around imperative setup code. The custom Runner anonymous class adds unnecessary indirection; the test method overload has the same name as the annotated test, creating ambiguity. Resource management is manual, with null checks and close calls in finally, instead of using try-with-resources or Netty's channel closing utilities. The new2() override contains a deeply chained condition and its functional purpose (filtering bootstrap factories by event loop type) is not obvious without careful reading. Import statements are comprehensive but not organized into logical groups. However, each statement generally performs a single action, and the flow follows a logical order (setup, act, assert, cleanup). The connection setup and failure assertion are clear. The code is not deeply nested overall, but the anonymous class adds one level of indirection.

Run 3

The code has a logical structure with clear separation of setup, test execution, and cleanup. However, readability suffers from several issues: the nested anonymous class in the test method adds unnecessary complexity, the parameter name 'boo' is unclear, and 'fac'/'gro' abbreviations reduce clarity. The test method mixes setup and assertions in a linear way but uses try/finally well for resource cleanup. Also, some lines combine multiple actions (e.g., 'sb.bind(...).syncUninterruptibly().channel()'), reducing action granularity. The reading flow is somewhat disrupted by the anonymous Runner and the loop filtering logic in new2(). Overall, it is reasonably organized but could be more explicit and concise.

Run 1

Code Structure: Well organized into test execution, connection verification, and bootstrap filtering, with reliable cleanup separated in a finally block. Nesting: Moderate and manageable; the anonymous runner and loop condition add some indentation without becoming tangled. Clarity of intent: The repeated-connect assertion clearly communicates the test's purpose, but abbreviated names such as sb, cb, sc, cc, gro, and fac, plus the opaque method name new2, obscure details. Code length: Mostly concise, though the anonymous runner and repeated generic declarations introduce boilerplate. Action granularity: Statements generally occupy separate lines; fluent call chains combine related operations coherently. Reading flow: Setup, first connection, second connection, assertion, and cleanup follow a natural sequence. The long generic types and compound type-checking condition slightly interrupt scanning.

Run 2

Code Structure: Test execution, connection verification, cleanup, and bootstrap filtering are logically separated. Nesting: Mostly shallow, though the anonymous runner and loop conditional add modest nesting. Clarity of intent: The repeated-connect assertion clearly expresses the test purpose, but abbreviated names such as sb, cb, sc, cc, gro, and fac, plus the opaque method name new2, require extra interpretation. Code length: Reasonably concise, with some verbosity from the anonymous class and repeated generic type declarations. Action granularity: Statements generally occupy separate lines; fluent chains combine related setup and synchronization operations without becoming difficult to follow. Reading flow: Setup, execution, assertion, and cleanup follow a natural sequence. Dense imports, long generic signatures, and the compound type-check condition slightly interrupt readability.

Run 3

Code Structure: Well organized into test execution, connection verification, and bootstrap filtering, with explicit cleanup. Nesting: Mostly shallow; the anonymous runner and loop condition add modest nesting. Clarity of intent: The class name and exception assertion clearly convey the multiple-connect test, but names such as sb, cb, sc, cc, gro, fac, and new2 obscure individual roles. Code length: Reasonably concise, though verbose generic declarations and the anonymous runner add boilerplate. Action granularity: Generally one statement per line; chained asynchronous operations combine several steps but remain understandable. Reading flow: Setup, connection attempts, assertion, and cleanup follow a natural sequence. Dense type signatures, abbreviated identifiers, and minimally separated imports slightly interrupt readability.