Sample

int-29738b504777-SRC

Unmodified source class

Lines98

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6530–1; higher is more readable
Dorn0.3240–1; higher is more readable
Mi0.0340–1; higher is more readable
LLOC51Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.4280–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; /** * The default {@link Socks5CommandResponse}. */ 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.668−7.002

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

Score0.653

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.96+2.583
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.96−1.782
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
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.116+1.067
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.97.897+0.959
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.088+0.084

Intercept 0.07 + feature contributions = -0.735 (log-odds).
Score = sigmoid(-0.735) = 0.324.

Score0.034
Score51
Run 1

The code is well-structured and readable. It logically groups fields, constructor, accessors, and toString. Nesting in the constructor reaches 4 levels but remains understandable. Intent is clear through method names and validation messages. Code length is reasonable; each line performs a single action. Minor drawbacks: the constructor's nested if-else blocks for address validation could be extracted for improved readability, and the toString method's conditional formatting adds slight complexity. Overall, this is clean, maintainable code.

Run 2

The code is well-structured and readable. It follows clear class organization with fields, constructors, and accessor methods logically arranged. Validation logic in the constructor is explicit, though the address validation has three levels of nesting, which slightly reduces readability. Each validation action is on its own line, and method names clearly indicate intent. The constructor is somewhat long but handles necessary validation. The toString() method flows naturally with a clear if-else structure. Overall, this is clean, maintainable code that would be easily understood by most Java developers, with only minor nesting in the validation block preventing a higher score.

Run 3

The code demonstrates good structure with a clear class hierarchy, well-named fields, and a logical constructor validation flow. Nesting is moderate (3 levels in address validation) but reasonable for the domain logic. Intent is clear throughout - socket address validation and response object creation. The code is appropriately concise with no unnecessary duplication. Action granularity is largely one action per line, especially in the toString method. Reading flow is natural, with validation logic grouped by address type and accessor methods following a standard pattern. The constructor is well-organized with validation before field assignment. Minor improvements could flatten the nested address validation using helper methods, but overall the code is highly maintainable and readable.

Run 1

Code Structure: Fields, constructors, accessors, and string formatting are logically organized, with validation localized in the main constructor. Nesting: Address validation reaches three conditional levels, but the branches remain easy to follow. Clarity of intent: Types, method names, and descriptive exception messages clearly communicate purpose; abbreviated names such as bndAddr require some SOCKS familiarity. Code length: Mostly concise, though repetitive StringBuilder calls make toString somewhat verbose. Action granularity: Statements generally perform one action per line, simplifying scanning. Reading flow: Validation proceeds naturally from null checks through address and port checks to field assignment, followed by straightforward accessors and diagnostic formatting.

Run 2

Code Structure: Fields, constructors, accessors, and string formatting are logically organized with clear separation of responsibilities. Nesting: Address validation reaches three conditional levels, but remains manageable; helper methods could flatten it. Clarity of intent: Descriptive types, straightforward validation, and informative exception messages make the purpose clear, although abbreviated 'bnd' names require some protocol familiarity. Code length: Mostly concise; accessors are appropriate boilerplate, while repetitive StringBuilder calls slightly lengthen toString(). Action granularity: Statements generally perform one action per line, making validation and assignments easy to inspect. Reading flow: The constructor naturally progresses from null checks through address and port validation to field assignment, followed by accessors and formatting. Consistent indentation and spacing support readability.

Run 3

Code Structure: Well organized into immutable fields, constructors, accessors, and string formatting, with validation grouped before initialization. Nesting: Address validation reaches three conditional levels, but the branches remain easy to follow; other methods are flat. Clarity of intent: Types, method names, and descriptive exception messages clearly convey purpose, although abbreviated names such as bndAddr require SOCKS familiarity. Code length: Reasonably concise for the functionality; repetitive accessors and StringBuilder calls add some verbosity. Action granularity: Statements generally perform one action per line, making validation and output construction easy to inspect. Reading flow: The progression from validation to assignment, accessors, and representation is natural, with consistent formatting. Minor drawbacks include dense import spacing, long exception lines, and repetitive address-validation branches.