Sample

int-18b0d11ac26d-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines52

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.1130–1; higher is more readable
Mi0.1430–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.6080–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))) {} else { 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.1588.828−52.431
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.726−7.089

Intercept 8.87 + feature contributions = -29.85 (log-odds).
Score = sigmoid(-29.85) = 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.833+0.315
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.094+0.03

Intercept 0.07 + feature contributions = -2.061 (log-odds).
Score = sigmoid(-2.061) = 0.113.

Score0.143
Score21
Run 1

The code is generally readable but has a few confusing constructs. The enum structure is logical with clear constants and fields. However, the findBySubProtocol method is needlessly convoluted: the condition `if (!((subProtocol != null))) {} else {` is an inverted, empty-if-block pattern that obscures intent and should be simplified to `if (subProtocol != null) { for loop }`. Nesting is shallow, and most methods are concise. The static initializer is clear enough, though it could use a stream for brevity. Overall structure is sound, but the unusual conditional logic in findBySubProtocol significantly reduces clarity of intent and reading flow, preventing a higher score.

Run 2

The enum is mostly readable with clear constants, simple fields, and a logical static initializer. However, `findBySubProtocol` contains an unnatural inverted null check (`if (!((subProtocol != null))) {} else { ... }`) which disrupts reading flow and obscures intent. The loop structure is flat and each action is on its own line, but the method could be clearer with a standard null guard. The `SUB_PROTOCOLS` creation is straightforward, though mixing `List` and `StringUtil.join` adds minor length. Overall, the code is understandable but has one awkward control flow that lowers clarity.

Run 3

The code has moderate readability. The enum structure is logical, methods are short, and one action per line is mostly followed. However, several issues reduce clarity: the if-else condition in findBySubProtocol is inverted and confusing (`if (!((subProtocol != null))) {} else { ... }`); the static block uses a mutable list unnecessarily; and imports/blank lines are slightly inconsistent. Nesting is shallow but the empty if block harms the reading flow. The enum constants are clear, but the code could be more concise and natural.

Run 1

Code Structure: The enum logically groups versions, constants, initialization, fields, and lookup behavior. Nesting: Mostly shallow, but findBySubProtocol unnecessarily nests its loop inside an else branch. Clarity of intent: Descriptive names and straightforward accessors clarify purpose; the negated null check, redundant parentheses, and empty if block obscure an otherwise simple lookup. Code length: Compact overall, though the lookup could be shorter and clearer with a direct null check. Action granularity: Most lines perform one action, but the inline empty if/else construction breaks this consistency. Reading flow: Declaration order is natural and initialization is easy to follow; the awkward null-handling condition interrupts the flow.

Run 2

Code Structure: The enum logically groups version constants, shared initialization, fields, accessors, and lookup behavior. Nesting: Most code is flat, but the lookup unnecessarily nests a loop and comparison inside an else branch. Clarity of intent: Names and immutable fields clearly express protocol-version mapping; however, the negated null check, redundant parentheses, and empty if block obscure straightforward logic. Code length: Generally concise, with minor verbosity in list construction and the null-handling conditional. Action granularity: Statements mostly perform one action per line, although the empty if and else share a line awkwardly. Reading flow: Organization is natural and consistent until findBySubProtocol, where an ordinary positive null check or guard clause would improve readability.

Run 3

Code Structure: The enum is logically organized into constants, initialization, fields, constructor, accessors, and lookup. Nesting: Most code is flat, but the lookup unnecessarily nests a loop and match check inside an else branch. Clarity of intent: Names and types clearly express STOMP version mappings; however, the negated null check, redundant parentheses, and empty if block obscure straightforward null handling. Code length: Compact overall, with minor unnecessary syntax in the lookup. Action granularity: Statements generally perform one action per line, although the empty conditional and else share a line awkwardly. Reading flow: Organization and spacing support natural reading, but the unusual conditional interrupts the lookup's flow. A direct null check or early rejection would improve readability.