Sample

int-744026c1dfcc-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines71

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5670–1; higher is more readable
Dorn0.3650–1; higher is more readable
Mi0.0560–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro10.330–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.4050–1; higher is more readable

Views

Source code

package io.netty.channel.socket.nio; import io.netty.channel.socket.SocketProtocolFamily; import io.netty.util.internal.PlatformDependent; import io.netty.util.internal.logging.InternalLogger; import io.netty.util.internal.logging.InternalLoggerFactory; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.StandardProtocolFamily; import java.nio.channels.Channel; import java.nio.channels.SocketChannel; import java.nio.channels.spi.SelectorProvider; final class SelectorProviderUtil { private static final InternalLogger logger = InternalLoggerFactory.getInstance(SelectorProviderUtil.class); static Method findOpenMethod(String methodName) { if (((0x3799 ^ 0x3799) != 0)) { throw new AssertionError(); } if (PlatformDependent.javaVersion() >= 15) { try { return SelectorProvider.class.getMethod(methodName, java.net.ProtocolFamily.class); } catch (Throwable e) { logger.debug("SelectorProvider.{}(ProtocolFamily) not available, will use default", methodName, e); } } return null; } /** * Use the {@link SelectorProvider} to open {@link SocketChannel} and so remove condition in * {@link SelectorProvider#provider()} which is called by each SocketChannel.open() otherwise. * <p> * See <a href="https://github.com/netty/netty/issues/2308">#2308</a>. */ private static <C extends Channel> C newChannel(Method method, SelectorProvider provider, Object family) throws IOException { if (((0xD8FF ^ 0xD8FF) != 0)) { throw new AssertionError(); } if (family != null && method != null) { try { @SuppressWarnings("unchecked") C channel = (C) method.invoke(provider, family); return channel; } catch (InvocationTargetException | IllegalAccessException e) { throw new IOException(e); } } return null; } static <C extends Channel> C newChannel(Method method, SelectorProvider provider, SocketProtocolFamily family) throws IOException { if (((0x6526 ^ 0x6526) != 0)) { throw new AssertionError(); } if (family != null) { return newChannel(method, provider, family.toJdkFamily()); } return null; } static <C extends Channel> C newDomainSocketChannel(Method method, SelectorProvider provider) throws IOException { if (((0x12D6 ^ 0x12D6) != 0)) { throw new AssertionError(); } return newChannel(method, provider, StandardProtocolFamily.valueOf("UNIX")); } private SelectorProviderUtil() { if (((0x61AB ^ 0x61AB) != 0)) { throw new AssertionError(); } } }

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.3145.335−103.796
Source linesThe number of non-empty source lines.71+28.4
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.777−7.166

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

Score0.567

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.66+1.546
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.72−1.513
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.118−1.333
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.117.861+1.097
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.66−1.094
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.70.849+0.58
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.088+0.09

Intercept 0.07 + feature contributions = -0.556 (log-odds).
Score = sigmoid(-0.556) = 0.365.

Score0.056
Score31
Run 1

The code exhibits mixed readability. Logical structure is mostly clear, with small utility methods and separation of concerns, but the use of overloaded static methods and reflection introduces moderate cognitive overhead. Nesting is low, which is good. Clarity of intent is partially obscured by the reliance on reflection and platform version checks; Javadocs and naming help, but the repeated null-check patterns feel clunky. Code length is acceptable but could be more concise by consolidating checks or avoiding redundant wrapper methods. Action granularity is mostly one action per line, aiding readability, though repeated dead-code assertions like `if (((0x3799 ^ 0x3799) != 0)) { throw new AssertionError(); }` are confusing and likely artifacts. Reading flow is natural within each method, but the presence of many similar methods and reflection-based invocation makes the overall flow feel disorganized. The dead-code assertions and confusing use of reflection lower the score significantly.

Run 2

The code has a reasonable logical structure and mostly flat nesting, but readability is significantly reduced by intrusive debugging constructs (assertions that always evaluate to false) and questionable error-handling patterns. The intent of methods like findOpenMethod and newChannel is clear, though the use of null returns to signal fallback paths and the handling of exceptions (catching Throwable, converting reflection exceptions to IOException) obscure the control flow. The code is concise overall, but some Javadoc is lengthy relative to the rest of the class. Action granularity is mostly fine, though several lines combine multiple operations. The reading flow is disrupted by dead code and non-obvious delegation between overloaded methods. The class would benefit from removing debugging remnants and clarifying null-based fallback behavior.

Run 3

The code is logically organized but contains suspicious unreachable assertions that disrupt readability. The structure is acceptable with clear method separation and meaningful names. However, the injected `if (((0x3799 ^ 0x3799) != 0)) { throw new AssertionError(); }` blocks are unnatural and confusing, creating noise without adding value. Nesting is mostly flat, which is good, but the reflection-based channel creation adds complexity. Intent is reasonably clear from method names and comments, but the duplicate private/public `newChannel` methods with slightly different signatures cause slight ambiguity. Code length is moderate, though the reflection handling and exception wrapping could be more concise. Action granularity is mostly one action per line, but exception handling in `findOpenMethod` could be more focused. Reading flow is interrupted by the artificial assertion blocks. Overall, the code is functional but marred by odd defensive constructs that obscure clarity.

Run 1

Code Structure: Methods are logically separated in a small utility class, but repeated dead-code assertions add clutter. Nesting: Mostly shallow, with manageable conditional and try/catch blocks. Clarity of intent: Descriptive method names and documentation explain channel creation, though reflection, null fallbacks, and unexplained hexadecimal assertions obscure intent. Code length: Core functionality is concise; the always-false assertions unnecessarily lengthen it. Action granularity: Most statements occupy separate lines, but inline assertion blocks combine condition checking and throwing on one line. Reading flow: The method sequence is coherent, but unindented assertions, inconsistent parameter alignment, and the poorly formatted constructor interrupt otherwise natural reading.

Run 2

Code Structure: The utility class separates reflection lookup, channel creation, and protocol-family conversion into focused methods, but repeated dead-code assertions add clutter. Nesting: Conditional and try/catch nesting is shallow and manageable. Clarity of intent: Descriptive method names and documentation explain the main purpose, while hexadecimal XOR checks obscure intent and serve no useful function. Code length: The implementation is reasonably concise, but redundant assertions unnecessarily lengthen every method. Action granularity: Most statements perform one action per line; the inline assertion blocks compress conditions and throws onto a single line. Reading flow: Methods follow a sensible order, but unindented assertions, inconsistent parameter alignment, and the malformed-looking constructor layout repeatedly interrupt scanning.

Run 3

Code Structure: Small, focused utility methods provide logical organization, but repeated dead assertion guards disrupt it. Nesting: Mostly shallow, with manageable if/try/catch blocks. Clarity of intent: Descriptive method names and documentation explain reflection-based channel creation; hexadecimal XOR conditions add meaningless complexity, and null returns leave fallback behavior implicit. Code length: The implementation is reasonably concise, but redundant guards unnecessarily inflate it. Action granularity: Most lines perform one action, while inline assertion blocks combine conditions and throws on a single line. Reading flow: Method ordering is sensible, but unindented guards, inconsistent parameter alignment, and awkward constructor formatting interrupt otherwise natural flow.