Sample

int-2015b05c08c4-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines98

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6530–1; higher is more readable
Dorn0.0690–1; higher is more readable
Mi0.0230–1; higher is more readable
LLOC51Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.4230–1; higher is more readable

Views

Source code

package io.netty.handler.codec.socksx.v5; import io.netty.handler.codec.DecoderResult; import io.netty.util.NetUtil; import io.netty.util.internal.ObjectUtil; import io.netty.util.internal.StringUtil; import java.net.IDN; public final class DefaultSocks5CommandResponse extends AbstractSocks5Message implements Socks5CommandResponse { private final Socks5CommandStatus status; private final Socks5AddressType bndAddrType; private final String bndAddr; private final int bndPort; public DefaultSocks5CommandResponse(Socks5CommandStatus status, Socks5AddressType bndAddrType) { this(status, bndAddrType, null, 0); } public DefaultSocks5CommandResponse( Socks5CommandStatus status, Socks5AddressType bndAddrType, String bndAddr, int bndPort) { ObjectUtil.checkNotNull(status, "status"); ObjectUtil.checkNotNull(bndAddrType, "bndAddrType"); if (bndAddr != null) { if (bndAddrType == Socks5AddressType.IPv4) { if (!NetUtil.isValidIpV4Address(bndAddr)) { throw new IllegalArgumentException("bndAddr: " + bndAddr + " (expected: a valid IPv4 address)"); } } else if (bndAddrType == Socks5AddressType.DOMAIN) { bndAddr = IDN.toASCII(bndAddr); if (bndAddr.length() > 255) { throw new IllegalArgumentException("bndAddr: " + bndAddr + " (expected: less than 256 chars)"); } } else if (bndAddrType == Socks5AddressType.IPv6) { if (!NetUtil.isValidIpV6Address(bndAddr)) { throw new IllegalArgumentException("bndAddr: " + bndAddr + " (expected: a valid IPv6 address)"); } } } if (bndPort < 0 || bndPort > 65535) { throw new IllegalArgumentException("bndPort: " + bndPort + " (expected: 0~65535)"); } this.status = status; this.bndAddrType = bndAddrType; this.bndAddr = bndAddr; this.bndPort = bndPort; } @Override public Socks5CommandStatus status() { return status; } @Override public Socks5AddressType bndAddrType() { return bndAddrType; } @Override public String bndAddr() { return bndAddr; } @Override public int bndPort() { return bndPort; } @Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", status: "); } else { buf.append("(status: "); } buf.append(status()); buf.append(", bndAddrType: "); buf.append(bndAddrType()); buf.append(", bndAddr: "); buf.append(bndAddr()); buf.append(", bndPort: "); buf.append(bndPort()); buf.append(')'); return buf.toString(); } }

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.3307.446−109.146
Source linesThe number of non-empty source lines.98+39.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.646−6.969

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

Score0.653

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.98+2.653
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.99−2.469
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.98−1.828
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.115.98−1.247
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.97.897+0.959
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.09+0.069

Intercept 0.07 + feature contributions = -2.598 (log-odds).
Score = sigmoid(-2.598) = 0.069.

Score0.023
Score51
Run 1

The code is generally readable with clear structure and naming, but suffers from some nested validation logic that reduces clarity. The constructor uses a three-level nested if statement for address validation, which could be flattened using early returns or separate validation methods. Intent is mostly clear through descriptive variable names like bndAddrType and bndPort, and each line generally performs a single action. The toString method is verbose with repeated StringBuilder append calls, which could be more concise using string concatenation or a formatted string. The constructor has multiple overloads and the parameter alignment is good, but the validation logic is mixed with assignment, making it harder to follow the flow. Overall, the code follows Java conventions well but lacks the polish of top-tier readable code due to nesting and verbosity in certain sections.

Run 2

The code is generally readable and well-structured. It follows common Java conventions, has clear naming, and separates concerns logically. The constructor validation has moderate nesting (3 levels deep) but remains understandable. Each line performs a single action, and the flow is natural. String validation logic is slightly verbose but clear. Minor issues include some nested conditionals that could be extracted into helper methods, and the toString() method has slightly awkward branching but remains readable. Overall, it's solid production code with good clarity and organization.

Run 3

The code is well-structured and follows clear conventions. The constructor validates inputs logically with shallow nesting (only one level of 'if' inside a type check), and each validation maps to a single concern. Getters are concise and direct, and toString is flat and readable. Minor issues: the address validation block could be extracted into a private helper to reduce constructor length, and a few comments explaining non-obvious validation rules (e.g., IDN conversion) would improve clarity. Overall, the code is highly readable with clear intent and natural flow.

Run 1

Code Structure: Well organized into immutable fields, constructors, accessors, and string formatting. Nesting: Address validation reaches three conditional levels, adding moderate complexity, while other methods remain flat. Clarity of intent: Class and method names clearly convey a SOCKS5 command response; abbreviated field names such as bndAddr require protocol familiarity. Explicit validation messages clarify constraints. Code length: Reasonably concise, though repetitive validation and StringBuilder calls add some verbosity, and excess blank lines near the imports are distracting. Action granularity: Statements generally perform one action per line, making validation and field assignment easy to inspect. Reading flow: Construction proceeds naturally from null checks through address and port validation to assignment, followed by straightforward accessors and formatting.

Run 2

Code Structure: Fields, constructors, accessors, and string formatting are logically grouped. Nesting: Address validation reaches three conditional levels, adding moderate complexity, while other methods remain flat. Clarity of intent: Types, validation checks, and descriptive exception messages make the purpose clear, although abbreviated names such as bndAddr require domain familiarity. Code length: Generally appropriate, with some repetitive validation and verbose string-building statements. Action granularity: Each statement performs one clear action, making execution easy to follow. Reading flow: Construction proceeds naturally from validation to assignment, followed by accessors and formatting. Excess blank lines near the imports and long exception lines slightly reduce visual consistency.

Run 3

Code Structure: Fields, constructors, accessors, and string formatting are logically organized, with validation grouped before assignment. Nesting: Address validation reaches three conditional levels, adding moderate complexity, but remains manageable. Clarity of intent: Types, method names, and descriptive exception messages communicate purpose clearly; abbreviated bnd names require some protocol familiarity. Code length: Mostly concise, though repetitive validation branches and individual string-builder calls add verbosity, while excess blank lines introduce minor clutter. Action granularity: Each statement performs a single clear action, making execution easy to follow. Reading flow: Constructor delegation, validation, initialization, and straightforward accessors create a natural progression; toString is sequential and predictable.