Sample

int-1781f869b466-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines52

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.1170–1; higher is more readable
Mi0.1430–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6160–1; higher is more readable

Views

Source code

package io.netty.example.stomp.websocket; import io.netty.util.AttributeKey; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; public enum StompVersion { STOMP_V11("1.1", "v11.stomp"), STOMP_V12("1.2", "v12.stomp"); public static final AttributeKey<StompVersion> CHANNEL_ATTRIBUTE_KEY = AttributeKey.valueOf("stomp_version"); public static final String SUB_PROTOCOLS; static { List<String> subProtocols = new ArrayList<String>(values().length); for (StompVersion stompVersion : values()) { subProtocols.add(stompVersion.subProtocol); } SUB_PROTOCOLS = StringUtil.join(",", subProtocols).toString(); } private final String version; private final String subProtocol; StompVersion(String version, String subProtocol) { this.version = version; this.subProtocol = subProtocol; } public String version() { return version; } public String subProtocol() { return subProtocol; } public static StompVersion findBySubProtocol(String subProtocol) { if (subProtocol != null) { for (StompVersion stompVersion : values()) { if (stompVersion.subProtocol().equals(subProtocol)) { return stompVersion; } } } throw new IllegalArgumentException("Not found StompVersion for '" + subProtocol + "'"); } }

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.1529.232−50.465
Source linesThe number of non-empty source lines.52+20.8
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.719−7.078

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

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.112.962−1.119
Indentation frequencyHow rapidly indentation changes from line to line.52+1.061
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.53−0.84
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.52−0.772
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.51.816+0.314
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.021 (log-odds).
Score = sigmoid(-2.021) = 0.117.

Score0.143
Score21
Run 1

The code is well-structured with clear separation of enum constants, static initializer, fields, constructor, and methods. Nesting is minimal and shallow, with only a single if-statement inside a loop. Intent is unambiguous: representing STOMP protocol versions with associated sub-protocol strings. The code is concise without sacrificing readability. Each line generally performs one action, and the reading flow moves naturally from constants to static initialization to instance methods. Minor improvements could include a blank line before the static initializer block for visual separation or using streams for the sub-protocol joining, but these are negligible. Overall, highly readable.

Run 2

The code is well-structured and highly readable. It uses a logical enum organization with clear constant naming. Nesting is minimal (only one level inside the loop in findBySubProtocol). Intent is explicit through descriptive method names and constants. Code length is appropriately concise without unnecessary redundancy. Each action is generally on its own line, especially in the static initializer and lookup method, which aids clarity. Reading flow is natural: constants, static block, fields, constructor, accessors, then utility method. Minor deductions: the static block slightly interrupts the flow before instance fields, and the exception message could be clearer. Overall, the code is straightforward and maintainable.

Run 3

The code is well-structured and highly readable. It follows a clear logical organization with an enum, static fields, and methods. Nesting is minimal, with only one level in the findBySubProtocol method. Intent is clear: defining STOMP versions, their subprotocols, and a lookup method. Code length is appropriate and concise, with no unnecessary verbosity. Action granularity is good—each line performs a single logical action. Reading flow is natural, progressing from enum constants to static fields, constructor, accessors, and utility method. Minor improvements could include using streams for subprotocol collection and avoiding the null-check by using Objects.requireNonNull, but overall the code is very readable.

Run 1

Code Structure: The enum is logically organized into constants, static initialization, fields, constructor, accessors, and lookup. Nesting: Most code is flat, although findBySubProtocol nests a loop and match condition inside a null check; an early guard could simplify it. Clarity of intent: Descriptive names and immutable fields clearly convey version and subprotocol mapping. Code length: The implementation is concise, with little unnecessary code. Action granularity: Statements generally perform one action per line, and the static initializer separates collection building from joining. Reading flow: The ordering is natural and consistent, though spacing between the package declaration and imports would improve presentation. Overall, the code is highly readable with minor formatting and nesting improvements possible.

Run 2

Code Structure: The enum is logically organized into constants, static initialization, fields, constructor, accessors, and lookup logic. Nesting: Most code is flat, though findBySubProtocol nests a loop and condition inside a null check; a guard clause could simplify it. Clarity of intent: Descriptive names clearly convey version mapping, subprotocol aggregation, and lookup behavior. Code length: Concise overall, with little unnecessary code. Action granularity: Each statement performs a single clear action, making operations easy to follow. Reading flow: Conventional ordering and consistent formatting support natural reading, although the static initialization introduces a small interruption before the instance fields. The exception message is understandable but awkwardly phrased.

Run 3

Code Structure: The enum is logically organized into constants, static initialization, fields, constructor, accessors, and lookup method. Nesting: Most code is flat; the lookup has three nested control structures, which a null guard could simplify. Clarity of intent: Descriptive names and straightforward operations clearly communicate version-to-subprotocol mapping and lookup behavior. Code length: Concise overall, with only minor verbosity in building the subprotocol list. Action granularity: Each statement performs one clear action, with no compressed multi-statement lines. Reading flow: The declaration order and consistent formatting make the code easy to follow, though spacing between the package and imports would improve presentation.