Sample

int-f095cbfa2ccc-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines38

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.660–1; higher is more readable
Dorn0.7180–1; higher is more readable
Mi0.0760–1; higher is more readable
LLOC5Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6390–1; higher is more readable

Views

Source code

package io.netty.resolver.dns; import io.netty.channel.AddressedEnvelope; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.handler.codec.dns.DefaultDnsQuery; import io.netty.handler.codec.dns.DnsQuery; import io.netty.handler.codec.dns.DnsQuestion; import io.netty.handler.codec.dns.DnsRecord; import io.netty.handler.codec.dns.DnsResponse; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Promise; import java.net.InetSocketAddress; final class TcpDnsQueryContext extends DnsQueryContext { TcpDnsQueryContext(Channel channel, InetSocketAddress nameServerAddr, DnsQueryContextManager queryContextManager, DnsQueryLifecycleObserver lifecycleObserver, int maxPayLoadSize, boolean recursionDesired, long queryTimeoutMillis, DnsQuestion question, DnsRecord[] additionals, Promise<AddressedEnvelope<DnsResponse, InetSocketAddress>> promise) { super(channel, nameServerAddr, queryContextManager, lifecycleObserver, maxPayLoadSize, recursionDesired, // No retry via TCP. queryTimeoutMillis, question, additionals, promise, null, false); } @Override protected DnsQuery newQuery(int id, InetSocketAddress nameServerAddr) { return new DefaultDnsQuery(id); } @Override protected String protocol() { return "TCP"; } }

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.1438.566−47.473
Source linesThe number of non-empty source lines.38+15.2
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.553−6.83

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

Score0.66

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.111.974−1.078
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.112+1.003
Indentation frequencyHow rapidly indentation changes from line to line.37+0.543
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.39−0.345
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.074+0.222
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.37.92+0.12

Intercept 0.07 + feature contributions = 0.933 (log-odds).
Score = sigmoid(0.933) = 0.718.

Score0.076
Score5
Run 1

The code is well-structured and readable. It has a clear class hierarchy with a single inheritance from DnsQueryContext. The constructor is straightforward, with parameters clearly named and a concise super() call that uses a helpful comment to explain the null and false arguments. Methods are short and focused, each performing a single action. There is minimal nesting, with no conditional logic or loops. The code is concise and follows standard Java conventions. Minor deductions: the long constructor parameter list could be wrapped differently, and the 'protocol()' method is trivially simple. Overall, this code is easy to understand and maintain.

Run 2

The code is highly readable. It has a clear, logical structure with a single-purpose class extending a parent context. Imports are organized, and the constructor delegates cleanly to the superclass with a clarifying comment. Nesting is minimal, and action granularity is appropriate—each statement performs one clear action. The methods are concise and focused, with obvious intent (e.g., protocol() returns 'TCP'). The reading flow is natural: package, imports, class declaration, constructor, then overridden methods in logical order. Only minor deductions could be made for the long parameter list in the constructor, which slightly impacts readability, but overall this is exemplary code.

Run 3

The code is highly readable with a clear, focused purpose. It follows a logical structure with a single class extending a base context, minimal nesting, and concise method implementations. Each line performs a distinct action, and the constructor simply delegates to the superclass with a clear comment explaining the 'no retry' decision. Method names and return values are self-documenting, and the overall flow is natural and easy to follow. The only minor deductions are the slightly long constructor parameter list and a comment that could be more explicit about why retries are disabled for TCP, but these do not significantly impact readability.

Run 1

Code Structure: A focused class with a constructor and two small overrides is logically organized. Nesting: No nested control flow, making the code easy to scan. Clarity of intent: Class and method names clearly identify TCP DNS behavior, and the comment explains the lack of TCP retry. However, the long superclass argument list and trailing null and false require knowledge of the parent constructor. Code length: Concise overall, though unused ChannelFuture and Future imports add clutter. Action granularity: Each statement performs one action; wrapped constructor arguments remain understandable. Reading flow: The constructor followed by query creation and protocol identification is natural, with consistent indentation. The dense constructor signature slightly interrupts readability.

Run 2

Code Structure: The class is logically organized into a constructor and two focused overrides. Nesting: There is no nested control flow, making it easy to scan. Clarity of intent: Class and method names clearly identify a TCP DNS query context, and the comment explains the absence of TCP retries. However, the long superclass argument list, including null and false, requires knowledge of the parent constructor. Code length: The implementation is concise with no unnecessary logic, though ChannelFuture and Future imports are unused. Action granularity: Each method performs a single action, and statements are cleanly separated. Reading flow: The constructor followed by query creation and protocol identification provides a natural progression; dense parameter lists and inconsistent grouping of constructor parameters slightly reduce readability.

Run 3

Code Structure: The class is logically organized into a constructor and two small overrides. Nesting: There is no nested control flow, making it easy to scan. Clarity of intent: Descriptive class and method names clearly identify a TCP DNS query context; the comment explains the lack of TCP retry. However, the long superclass argument list, especially null and false, requires knowledge of the parent constructor. Code length: The implementation is concise with little unnecessary code, though two imports are unused. Action granularity: Each statement performs a single action; wrapping the constructor call improves readability. Reading flow: The constructor-to-overrides sequence is natural, but the lengthy parameter list and limited spacing around imports slightly interrupt scanning.