Sample

int-ad3eb6bc6e6f-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines69

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.3940–1; higher is more readable
Dorn0.0570–1; higher is more readable
Mi0.3310–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro11.330–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.3860–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))) {} else { cc.close(); } if (!((sc != null))) {} else { 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)))) {} else { 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.3743.723−123.543
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.696−7.044

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

Score0.394

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.69+1.65
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.123.971−1.586
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
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.904+0.553
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.106−0.084

Intercept 0.07 + feature contributions = -2.806 (log-odds).
Score = sigmoid(-2.806) = 0.057.

Score0.331
Score26
Run 1

The code is logically organized as a test class, but several patterns harm readability. The `register()` call before `connect()` is an unusual and potentially confusing approach for Netty client setup, obscuring intent. The `finally` block uses inverted empty-if patterns (`if (!condition) {} else { action; }`) which are unnecessarily convoluted and should be simple null checks. Similarly, `newFactories()` contains an inverted empty-if that makes the filter logic harder to follow. Naming is mostly clear (`sc`/`cc` are short but conventional here), and the test method structure is straightforward. The code length is appropriate for the task, but action granularity suffers from the awkward conditional structures. Reading flow is disrupted by those inverted conditionals and the repeated `syncUninterruptibly()` calls. Overall, functional but with avoidable readability obstacles.

Run 2

The code is reasonably structured with clear separation of test setup and execution. However, it has a notable readability problem: the cleanup code uses a bizarre conditional pattern (e.g., `if (!((cc != null))) {} else { cc.close(); }`) which is confusing and violates clarity of intent. This pattern also appears in `newFactories()`. The `if`/`else` construct with a no-op `if` branch is worse than a simple null check with early return. Nesting is moderate — the anonymous inner `Runner` class adds a layer but is acceptable. Action granularity is generally good, with one meaningful operation per line. Most lines are concise but some exceed 100 characters (`List` declaration, `if` condition for instance check). The `instanceof` check in `newFactories()` mishandles null and uses a non-idiomatic pattern. Overall the code is functional but the unusual conditional style and excessive line length hinder readability.

Run 3

The code has several readability issues. The structure is moderately organized, but nesting and convoluted conditional expressions harm clarity. For example, the odd `if (!((cc != null))) {} else { cc.close(); }` pattern is a confusing way to write `if (cc != null) cc.close();`. This doubles the length and obscures intent. The same pattern appears in `newFactories()` with `if (!((group instanceof IoEventLoopGroup && ...))) {} else { ... }`, which is hard to parse. These constructs reduce the overall readability score. The test method itself is reasonably straightforward, but the `finally` block and the factory method are unnecessarily verbose and hard to follow. The use of multiple actions per line (e.g., `sb.bind(...).syncUninterruptibly().channel()`) is common in Netty tests but slightly reduces line-level clarity. There is moderate nesting in the anonymous Runner class and factory loop, though not extreme. Overall, the code is functional but would benefit from simpler conditional logic and clearer null checks.

Run 1

Code Structure: Methods logically separate test invocation, connection testing, and factory selection. Nesting: Mostly shallow, although the anonymous runner and try/finally add layers. Clarity of intent: The repeated-connect assertion is clear, but abbreviated names (sb, cb, sc, cc) and negated conditions with empty if branches obscure straightforward cleanup and filtering. Code length: Reasonably compact, though verbose generic declarations and redundant parentheses add unnecessary text. Action granularity: Statements generally perform one action per line; fluent call chains remain understandable. Reading flow: Setup, execution, assertion, and cleanup follow a natural sequence, but the unusual empty-if/else pattern repeatedly interrupts comprehension.

Run 2

Code Structure: Test execution, connection verification, and factory selection are logically separated into methods. Nesting: Mostly shallow, but the anonymous runner and inverted conditions with empty branches add unnecessary complexity. Clarity of intent: The test name and AlreadyConnectedException assertion clearly communicate the purpose; abbreviated variables and negated, over-parenthesized conditions obscure details. Code length: Reasonably compact, though verbose generic declarations and empty if branches introduce avoidable clutter. Action granularity: Most statements perform one coherent action; fluent call chains remain understandable. Reading flow: Setup, connection attempts, assertion, and cleanup follow a natural sequence, but unconventional cleanup and filtering conditions interrupt scanning. Direct positive conditions, descriptive variable names, and simpler generic syntax would improve readability.

Run 3

Code Structure: Test execution, connection checks, and factory filtering are logically separated into methods. Nesting: Mostly shallow, although the anonymous runner and awkward conditional branches add complexity. Clarity of intent: The test name and AlreadyConnectedException assertion clearly communicate the purpose, but abbreviated variables and double-negated conditions with empty branches obscure cleanup and filtering. Code length: Reasonably compact, though verbose generic declarations and unnecessary conditional syntax inflate it. Action granularity: Statements generally perform one logical action per line; fluent chains remain understandable. Reading flow: Setup, connection attempts, assertion, and cleanup follow a natural sequence, but the inverted if/else patterns interrupt reading and require mental simplification.