Sample

int-64866ea0e3ae-I13

Lower every eligible classic and enhanced for loop to a while loop

Matched original source

Lines36

Scores

MethodScoreScale
Posnett0.9870–1; higher is more readable
Scalabrino0.9170–1; higher is more readable
Dorn0.8090–1; higher is more readable
Mi0.7930–1; higher is more readable
LLOC5Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.4560–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); } /** * Creates a new instance. */ public EncoderException(Throwable cause) { super(cause); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.36+14.4
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.368.017−12.145
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.535−6.803

Intercept 8.87 + feature contributions = 4.322 (log-odds).
Score = sigmoid(4.322) = 0.987.

Score0.917

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.70.973+0.659
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.052+0.432
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.70.946+0.34
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.26−0.176
Indentation frequencyHow rapidly indentation changes from line to line.26+0.162
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.33−0.132
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.35.708+0.089

Intercept 0.07 + feature contributions = 1.445 (log-odds).
Score = sigmoid(1.445) = 0.809.

Score0.793
Score5
Run 1

The code is highly readable. It has a clear, single-purpose structure as a custom exception class. Nesting is non-existent, with a flat class hierarchy and straightforward constructors. Each constructor's intent is unambiguous, following standard Java exception patterns. The code is concise, avoiding unnecessary boilerplate while providing all standard constructor variants. Each action (constructor call) is on its own line, maintaining clean separation. The reading flow is natural: class declaration, serialVersionUID, then constructors in a logical order. The Javadoc comments, while repetitive, are clear and consistent with the codebase style. The only minor drawback is the repetitive 'Creates a new instance' documentation, which adds little value and could be more descriptive, but this does not significantly impact readability.

Run 2

The code is highly readable. It follows a clear, standard structure for a custom exception class, extending CodecException with no complex logic. Nesting is completely flat. The intent is unambiguous: it defines an EncoderException with four standard constructors. Code length is concise and appropriate for the functionality. Each constructor is a single action on its own line, maintaining clean action granularity. Reading flow is natural, with each constructor grouped logically and documented succinctly. The only minor issue is the repetitive Javadoc comments ('Creates a new instance.'), which could be more descriptive, but this is a negligible readability concern.

Run 3

This code is highly readable. It follows a clear and logical structure: package declaration, imports, Javadoc, class declaration, serialVersionUID, and four constructors in a sensible order. Nesting is essentially flat, with no conditional or loop complexity. Intent is obvious—it's a specialized exception for encoder failures. Code length is minimal and appropriately concise for an exception class. Each constructor is a single action, delegating to the parent class, maintaining one action per line. Reading flow is natural, as constructors are ordered intuitively (empty, message+cause, message, cause). Javadoc is present, albeit repetitive, which slightly reduces polish but aids clarity. Overall, this is an exemplary model of clean, maintainable code.

Run 1

Code Structure: Logically organized, with the serialization field followed by constructor overloads. Nesting: Minimal, limited to the class and constructor bodies. Clarity of intent: The class name, inheritance, and class documentation clearly identify an encoder-specific exception. Code length: Concise and appropriate for a standard exception class, though repeated constructor comments add little value. Action granularity: Each nonempty constructor performs one superclass call on its own line. Reading flow: Consistent formatting and straightforward delegation make the code easy to follow.

Run 2

Code Structure: The class is logically organized, with its serialization field followed by constructor overloads. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, inheritance, and class-level documentation clearly identify an encoder-specific exception. Code length: The implementation is concise, although repeated constructor comments add little information. Action granularity: Each constructor performs at most one action, with superclass calls on separate lines. Reading flow: Consistent formatting and conventional Java structure provide a natural reading flow.

Run 3

Code Structure: A logically organized exception class with a serialization identifier followed by constructors. Nesting: Minimal, limited to class and constructor scopes. Clarity of intent: The class name, inheritance, and class documentation clearly identify an encoder-specific exception; constructor documentation is generic rather than informative. Code length: Concise implementation, though repeated constructor comments add minor verbosity. Action granularity: Each nonempty constructor performs a single superclass call on its own line. Reading flow: Consistent formatting and straightforward constructor overloads make the code easy to scan and understand.