Sample

int-3addba0e0cd4-I13

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

Matched original source

Lines27

Scores

MethodScoreScale
Posnett0.3260–1; higher is more readable
Scalabrino0.9490–1; higher is more readable
Dorn0.7290–1; higher is more readable
Mi0.8070–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro18.670–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.8920–1; higher is more readable

Views

Source code

package org.apache.kafka.clients.admin; import org.apache.kafka.common.annotation.InterfaceAudience; import java.util.Collection; /** * Options for {@link Admin#alterClientQuotas(Collection, AlterClientQuotasOptions)}. */ @InterfaceAudience.Public public class AlterClientQuotasOptions extends AbstractOptions<AlterClientQuotasOptions> { private boolean validateOnly = false; /** * Returns whether the request should be validated without altering the configs. */ public boolean validateOnly() { return this.validateOnly; } /** * Sets whether the request should be validated without altering the configs. */ public AlterClientQuotasOptions validateOnly(boolean validateOnly) { this.validateOnly = validateOnly; return this; } }

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.406.997−13.431
Source linesThe number of non-empty source lines.27+10.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.645−6.967

Intercept 8.87 + feature contributions = -0.728 (log-odds).
Score = sigmoid(-0.728) = 0.326.

Score0.949

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.046+0.496
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.58.071+0.133
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.88.964−0.103
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.28+0.045
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.26.678−0.037
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = 0.991 (log-odds).
Score = sigmoid(0.991) = 0.729.

Score0.807
Score6
Run 1

The code is well-structured and highly readable. It follows a clear class definition pattern with a single private field, a getter-like method, and a fluent setter. The nesting is flat, with no conditional or loop structures. Intent is explicit through descriptive method names and Javadoc comments. The code is concise, containing only essential logic without redundancy. Each method performs one clear action. The reading flow is natural, moving from field declaration to accessor to mutator. Minor deductions relate to the lack of null checks or validation (though not required for a boolean) and the absence of additional documentation for edge cases, but overall this is exemplary, idiomatic Java code.

Run 2

The code is highly readable. Structure is logical with clear separation of fields and methods. Nesting is flat—no conditional or loop nesting. Intent is unambiguous: a simple options class with a fluent 'validateOnly' flag. Code length is minimal and appropriate. Each line performs a distinct action, and reading flow follows Java conventions (field, getter, setter, builder-style return). Javadoc and annotations enhance clarity without clutter.

Run 3

The code demonstrates excellent readability. It starts with a clear package and a minimal import section. The class-level Javadoc precisely explains its purpose with a direct link to the relevant Admin API method. The class extends a clearly named AbstractOptions class, indicating a builder pattern. The single field `validateOnly` has a descriptive name and a sensible default. The getter method `validateOnly()` and the setter method `validateOnly(boolean)` are well-named and follow a fluent API style by returning `this`. Javadoc comments on both methods clearly distinguish between querying and configuring the validation behavior. The structure is flat, each method contains a single action, and the overall length is very concise. The only minor deduction is the lack of an explicit constructor, though the default constructor is perfectly sufficient for this use case.

Run 1

Code Structure: The class is logically organized, with one option field followed by its getter and fluent setter. Nesting: Methods are flat, with no conditional or loop nesting. Clarity of intent: Descriptive names, the class-level API link, and method documentation clearly communicate purpose; however, 'configs' is slightly less precise than 'client quotas.' Code length: The implementation is concise, with no unnecessary logic. Action granularity: Each statement performs one action, and assignment and return are on separate lines. Reading flow: The progression from field to getter to setter is natural and easy to follow. Minor formatting improvements, such as separating the package declaration from imports, would improve visual organization.

Run 2

Code Structure: A logically organized options class with a single field, getter, and fluent setter. Nesting: Flat, with no nested control flow. Clarity of intent: Descriptive names and Javadoc make validation-only behavior clear, though 'configs' is less precise than 'client quotas.' Code length: Concise, with no unnecessary logic; explicit initialization to false is slightly redundant. Action granularity: Each statement performs one action on its own line. Reading flow: Natural progression from state to access and mutation, with consistent formatting; separating the package declaration from imports would improve presentation.

Run 3

Code Structure: Logically organized as a small options class with a field, getter, and fluent setter. Nesting: Flat, with no conditional branches or nested control flow. Clarity of intent: Descriptive naming and Javadoc clearly explain validation-only behavior, though 'configs' is slightly imprecise for client quotas. Code length: Concise, with no unnecessary complexity. Action granularity: Each statement performs one action on its own line. Reading flow: Natural progression from state to access and modification; additional spacing around the package and import sections would slightly improve presentation.