Sample

int-a2ac1d5dfc79-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines40

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.4590–1; higher is more readable
Dorn0.0590–1; higher is more readable
Mi0.0070–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro4.670–20; mean of three runs
GPT-6.1 Sol10.330–20; mean of three runs
BTTF0.3030–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 (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 (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 (family != null) { return newChannel(method, provider, family.toJdkFamily()); } return null; } static <C extends Channel> C newDomainSocketChannel(Method method, SelectorProvider provider) throws IOException { return newChannel(method, provider, StandardProtocolFamily.valueOf("UNIX")); } private SelectorProviderUtil() { } }

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.2345.937−77.416
Source linesThe number of non-empty source lines.40+16
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.782−7.173

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

Score0.459

Feature contributions

FeatureValueContribution
(log-odds)
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.218−5.569
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.218+2.713
Indentation frequencyHow rapidly indentation changes from line to line.35+0.473
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.35−0.382
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.077+0.191
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.895+0.148

Intercept 0.07 + feature contributions = -2.771 (log-odds).
Score = sigmoid(-2.771) = 0.059.

Score0.007
Score21
Run 1

The code suffers from severe formatting issues that harm readability. Multiple statements are crammed onto single lines, especially in the imports and method declarations, violating one-action-per-line expectations. The findOpenMethod and newChannel methods contain deep nesting and non-standard brace placement, making logical flow hard to follow. There is inconsistent spacing and indentation throughout, disrupting natural reading flow. While the code is functionally concise and has clear intent (reflection-based channel creation with fallback), the structural presentation significantly undermines clarity. The method overloading for different family types adds some confusion but is manageable. Overall, the logic is simple but the formatting choices make it needlessly difficult to read.

Run 2

The code suffers from severe readability issues. The structure is tangled with multiple statements crammed onto single lines, making it difficult to discern logical boundaries. Nesting is present in conditional blocks and the try-catch inside findOpenMethod but is obscured by the formatting. Intent is partially clear from method names but becomes ambiguous due to overloaded newChannel methods with subtle differences. Code length is not excessive, but the dense formatting makes it feel longer and harder to parse. Action granularity is poor—multiple operations per line obscure the flow. Reading flow is disorganized due to the lack of line breaks and indentation consistency. While the logic itself is not overly complex, the presentation makes it nearly unreadable and violates almost all readability criteria.

Run 3

The code is heavily compressed with multiple statements per line, severely impacting readability. While the logic is relatively simple, the formatting makes it extremely difficult to follow. The structure is tangled: class declaration, imports, fields, and methods are all crammed together without proper line breaks. Nesting is moderate but made worse by compressed conditional blocks. Intent is unclear due to formatting, though the method names hint at purpose. Code length is artificially condensed to reduce lines at the cost of clarity. Action granularity is violated throughout - try/catch blocks, returns, and conditionals share single lines. Reading flow is completely disrupted as the eye cannot easily scan logical blocks. The Javadoc is also jammed between methods. This code would need complete reformatting to be considered readable.

Run 1

Code Structure: A focused utility class with logically separated methods, but compressed formatting obscures their boundaries. Nesting: Relatively shallow conditional and try/catch nesting, though inline braces make it harder to follow. Clarity of intent: Descriptive method names, explicit types, logging, and documentation clarify channel creation; reflective invocation and null fallback behavior require closer inspection. Code length: Concise without substantial redundancy, but excessive compression sacrifices readability. Action granularity: Several imports, declarations, conditions, returns, and closing braces share lines, making individual operations difficult to scan. Reading flow: Method order is reasonable, but inconsistent indentation, long signatures, and comments attached to closing braces interrupt natural reading.

Run 2

Code Structure: The utility class has logically separated methods, but compressed declarations and misplaced line breaks obscure their boundaries. Nesting: Nesting is moderate, mainly conditionals containing try/catch blocks, though inline braces make it harder to follow. Clarity of intent: Descriptive method names, logging, and documentation explain the purpose; reflection, generics, and null-return behavior require additional attention. Code length: The implementation is concise without substantial redundancy, but excessive compression sacrifices readability. Action granularity: Several imports, declarations, conditionals, and returns share lines, making individual operations difficult to scan. Reading flow: Inconsistent indentation and adjacent closing braces, documentation, and method declarations interrupt otherwise logical execution flow.

Run 3

Code Structure: The utility class has logically separated methods, but compressed imports, declarations, and method boundaries obscure that organization. Nesting: Depth is modest, mainly conditionals containing try/catch blocks, though inline braces make it harder to follow. Clarity of intent: Descriptive method names, logging, and documentation explain reflection-based channel creation, but the generic Object family parameter and null-return behavior are less explicit. Code length: The implementation is concise without substantial unnecessary code; compression saves lines rather than improving readability. Action granularity: Several imports, declarations, conditionals, returns, and closing braces share lines, making individual operations difficult to scan. Reading flow: Inconsistent indentation and spacing disrupt an otherwise natural progression from method discovery to channel creation and specialized wrappers.