Sample

int-a5b482fd7696-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines45

Scores

MethodScoreScale
Posnett0.5450–1; higher is more readable
Scalabrino0.8530–1; higher is more readable
Dorn0.730–1; higher is more readable
Mi0.7340–1; higher is more readable
LLOC10Logical lines; fewer is more readable
DeepSeek V4 Pro50–20; mean of three runs
GPT-6.1 Sol11.330–20; mean of three runs
BTTF0.1710–1; higher is more readable

Views

Source code

package io.netty.handler.codec; /** * An {@link CodecException} which is thrown by an encoder. */ public class EncoderException extends CodecException { private static final long serialVersionUID = -5086121160476476774L; /** * Creates a new instance. */ public EncoderException() { } /** * Creates a new instance. */ public EncoderException(String message, Throwable cause) { super(message, cause); } /** * Creates a new instance. */ public EncoderException(String message) { super(message); { int evenNumberCount = 0; for (int candidateNumber = 0; candidateNumber < 6; candidateNumber++) { if (candidateNumber % 2 == 0) { evenNumberCount++; } } } } /** * Creates a new instance. */ public EncoderException(Throwable cause) { super(cause); } }

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.598.547−19.752
Source linesThe number of non-empty source lines.45+18
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.625−6.937

Intercept 8.87 + feature contributions = 0.181 (log-odds).
Score = sigmoid(0.181) = 0.545.

Score0.853

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.46−0.592
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.72.935+0.576
Indentation frequencyHow rapidly indentation changes from line to line.35+0.473
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.35−0.382
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.73+0.373
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.07+0.259
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.44.838+0.217

Intercept 0.07 + feature contributions = 0.994 (log-odds).
Score = sigmoid(0.994) = 0.73.

Score0.734
Score10
Run 1

The code is partially readable. It has a logical class structure with appropriate constructors and documentation, and the nesting is shallow. However, there is a major flaw: a block of unrelated code is embedded inside the `EncoderException(String message)` constructor, before its closing brace. This introduces an incorrect method body and an extra closing brace, breaking the code structure and making intent ambiguous. The embedded loop is not relevant to the exception class, harming clarity and reading flow. Otherwise, the exception class features are clear, concise, and follow standard patterns for a custom exception. The code would be much more readable and correct if the erroneous embedded block were removed.

Run 2

The code contains a critical syntax error: a random block of Java code is inserted inside the EncoderException(String message) constructor, breaking the class structure. This makes the code uncompilable and completely unreadable. Additionally, while the original Netty exception class follows good practices such as clear naming, flat structure, and concise constructors, the erroneous inserted loop and misplaced braces destroy all readability. The code structure is tangled, nesting is broken, clarity of intent is lost, and action granularity is violated due to multiple unrelated statements placed arbitrarily. Reading flow is severely disrupted. No score above zero is justified until the stray code is removed and the constructor's closing brace is restored.

Run 3

The code is severely undermined by a malformed block inserted into the EncoderException(String) constructor. This block contains unrelated logic (counting even numbers) that is neither valid Java nor appropriate in this context, creating a syntax error and breaking the logical structure. The surrounding exception class is otherwise minimal and clear, with standard constructors and Javadoc, but the embedded loop destroys the reading flow, clarity of intent, and code structure. Action granularity is also harmed since the loop's purpose is disconnected from the class. Overall, this appears to be an accidental paste or generated mistake, making the code unreadable and non-functional despite the rest being simple and idiomatic.

Run 1

Code Structure: The exception class and constructor overloads are logically organized, but an unrelated counting block disrupts the message constructor. Nesting: Most code is flat; the extra block, loop, and conditional introduce unnecessary nesting. Clarity of intent: The exception wrapper's purpose is clear, but counting even numbers serves no apparent purpose and the result is unused. Code length: The class is otherwise concise, but the counting block adds needless length and repetitive constructor comments offer little value. Action granularity: Statements generally perform one action per line, with only the conventional loop header combining control operations. Reading flow: Constructor ordering is natural, but inconsistent indentation and the unexpected counting logic interrupt the flow.

Run 2

Code Structure: The exception class and constructor overloads are logically organized, but an unrelated counting block disrupts one constructor. Nesting: Most code is flat, while the inserted block adds unnecessary block, loop, and conditional nesting. Clarity of intent: The class purpose and super calls are clear; counting even numbers without using the result has no apparent purpose. Code length: The exception boilerplate is concise, but the counting logic and repetitive generic comments add unnecessary length. Action granularity: Statements generally perform one action per line, though the loop header combines initialization, testing, and incrementing conventionally. Reading flow: Constructor ordering is easy to follow, but inconsistent indentation and the unexpected counting block interrupt the otherwise natural flow.

Run 3

Code Structure: The exception class and constructor overloads are logically organized, but an unrelated counting block disrupts the message constructor. Nesting: Most code is flat; the inserted block adds unnecessary block, loop, and conditional nesting. Clarity of intent: The class purpose and superclass delegation are clear, but counting even numbers without using the result has no apparent purpose. Code length: The exception implementation is concise, while the counting block and repetitive constructor documentation add unnecessary length. Action granularity: Statements generally perform one action per line, with a conventional multi-part loop header. Reading flow: Constructor ordering is easy to follow, but inconsistent indentation and the unexpected counting block interrupt an otherwise natural flow.