Sample

int-f5279e4b9232-SRC

Unmodified source class

Lines69

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4110–1; higher is more readable
Dorn0.10–1; higher is more readable
Mi0.3310–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro14.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.4130–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 testMultipleConnect(TestInfo testInfo) throws Throwable { run(testInfo, new Runner<ServerBootstrap, Bootstrap>() { @Override public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable { testMultipleConnect(serverBootstrap, bootstrap); } }); } public void testMultipleConnect(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 connectFuture2 = cc.connect(sc.localAddress()).await(); assertTrue(connectFuture2.cause() instanceof AlreadyConnectedException); } finally { if (cc != null) { cc.close(); } if (sc != null) { sc.close(); } } } @Override protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() { List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> factories = new ArrayList<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>>(); for (TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap> comboFactory : SocketTestPermutation.INSTANCE.socketWithFastOpen()) { EventLoopGroup group = comboFactory.newClientInstance().config().group(); if (group instanceof IoEventLoopGroup && ((IoEventLoopGroup) group).isIoType(NioIoHandler.class)) { factories.add(comboFactory); } } return factories; } }

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.3566.833−117.705
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.684−7.026

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

Score0.411

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.110.957−1.035
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.848+0.553
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.1−0.027

Intercept 0.07 + feature contributions = -2.198 (log-odds).
Score = sigmoid(-2.198) = 0.1.

Score0.331
Score26
Run 1

The code demonstrates good readability, particularly in the main test method. It uses clear variable names, flat structure, and a logical try-finally pattern for resource cleanup. The test flow is natural: setup server, bind, register client, attempt connections, assert expected exception. One action per line is mostly followed. The newFactories method is concise. Deductions: anonymous inner class in the test method adds slight nesting overhead; the import list is long; the channel references and syncUninterruptibly chains are Netty-idiomatic but can be dense for newcomers. Overall, the code is straightforward and maintainable with clear intent.

Run 2

The code is generally readable but has some issues. Structure is logical with clear separation between test setup, execution, and configuration. Nesting is minimal - only one level of try/finally and a for loop. Intent is mostly clear, though the anonymous Runner class adds some complexity. The method is somewhat long but not excessive. Each line typically contains one action, though the chain calls (e.g., sb.bind().syncUninterruptibly().channel()) pack multiple operations into single lines, reducing action granularity. Reading flow is natural - the test follows a clear progression from setup to action to assertion. Weaknesses include: generic type declarations are verbose (TestsuitePermutation.BootstrapComboFactory repeated), the anonymous inner class obscures the test logic, and the chained method calls require careful reading to understand the sequence of operations. The lack of comments explaining the test's purpose or the NioIoHandler filtering logic also impacts clarity.

Run 3

The code is generally readable but has some issues. Structure is logical for a Netty test (setup, test action, cleanup), and the flow is normal. However, nesting is moderate in the test method with try/finally and nested ifs in newFactories; clarity suffers in the condition checking IoEventLoopGroup and NioIoHandler. Lines are reasonably granular, though `cc.connect(sc.localAddress()).syncUninterruptibly();` chains multiple actions. The anonymous `Runner` class adds boilerplate. The final cleanup is clear, but the code is somewhat verbose overall, especially with long generic type names and indentation in newFactories. Not terrible, but not exemplary.

Run 1

Code Structure: Clearly separates test execution, connection verification, cleanup, and factory selection. Nesting: Mostly shallow; the anonymous runner and try/finally introduce manageable nesting. Clarity of intent: The test name and AlreadyConnectedException assertion clearly communicate the purpose, but abbreviated variables (sb, cb, sc, cc) and the unexplained factory filter reduce clarity. Code length: Reasonably concise, though the anonymous runner and repeated generic types add boilerplate. Action granularity: Statements generally perform one logical action per line; chained calls compact several operations but remain understandable. Reading flow: Setup, first connection, second connection, assertion, and cleanup follow a natural sequence. Factory selection is straightforward, although its long generic declarations and combined type check/cast require extra attention.

Run 2

Code Structure: Test execution, connection verification, cleanup, and factory filtering are logically separated into methods. Nesting: Mostly shallow, with modest nesting in the anonymous runner, try/finally cleanup, and filtering loop. Clarity of intent: The test name and assertion clearly communicate that a second connection should fail; abbreviated names such as sb, cb, sc, and cc reduce clarity. Code length: Reasonably concise, though repeated generic types and the anonymous runner add verbosity. Action granularity: Statements generally perform one logical action per line, although chained asynchronous calls combine several operations. Reading flow: Setup, connection attempts, assertion, and cleanup follow a natural sequence. Long generic declarations and the compound factory-filtering condition slightly interrupt scanning.

Run 3

Code Structure: Clearly separates test execution, connection verification, and factory filtering. Nesting: Mostly shallow; the anonymous runner and cleanup checks add modest nesting. Clarity of intent: The test name and AlreadyConnectedException assertion communicate the purpose well, although abbreviations such as sb, cb, sc, and cc obscure roles. Code length: Reasonably concise, but verbose generic declarations and anonymous-class boilerplate add visual weight. Action granularity: Statements generally perform one logical action per line; fluent setup chains remain understandable. Reading flow: Setup, connection attempts, assertion, and cleanup follow a natural sequence. The factory method is straightforward, though long type signatures and the combined type-check/cast condition slow scanning.