Sample

int-170f4be32906-I08

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

Matched original source

Lines86

Scores

MethodScoreScale
Posnett10–1; higher is more readable
Scalabrino0.8850–1; higher is more readable
Dorn0.3670–1; higher is more readable
Mi0.2260–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol13.330–20; mean of three runs
BTTF0.3310–1; higher is more readable

Views

Source code

package org.apache.kafka.common.network; import java.util.Objects; /** * Defines the context in which an {@link Authenticator} is to be created during * a re-authentication. */ public class ReauthenticationContext { private final NetworkReceive networkReceive; private final Authenticator previousAuthenticator; private final long reauthenticationBeginNanos; /** * Constructor * * @param previousAuthenticator * the mandatory {@link Authenticator} that was previously used to * authenticate the channel * @param networkReceive * the applicable {@link NetworkReceive} instance, if any. For the * client side this may be a response that has been partially read, a * non-null instance that has had no data read into it yet, or null; * if it is non-null then this is the instance that data should * initially be read into during re-authentication. For the server * side this is mandatory and it must contain the * {@code SaslHandshakeRequest} that has been received on the server * and that initiates re-authentication. * * @param nowNanos * the current time. The value is in nanoseconds as per * {@code System.nanoTime()} and is therefore only useful when * compared to such a value -- it's absolute value is meaningless. * This defines the moment when re-authentication begins. */ public ReauthenticationContext(Authenticator previousAuthenticator, NetworkReceive networkReceive, long nowNanos) { this.previousAuthenticator = Objects.requireNonNull(previousAuthenticator); this.networkReceive = networkReceive; this.reauthenticationBeginNanos = nowNanos; } /** * Return the applicable {@link NetworkReceive} instance, if any. For the client * side this may be a response that has been partially read, a non-null instance * that has had no data read into it yet, or null; if it is non-null then this * is the instance that data should initially be read into during * re-authentication. For the server side this is mandatory and it must contain * the {@code SaslHandshakeRequest} that has been received on the server and * that initiates re-authentication. * * @return the applicable {@link NetworkReceive} instance, if any */ public NetworkReceive networkReceive() { return networkReceive; } /** * Return the always non-null {@link Authenticator} that was previously used to * authenticate the channel * * @return the always non-null {@link Authenticator} that was previously used to * authenticate the channel */ public Authenticator previousAuthenticator() { return previousAuthenticator; } /** * Return the time when re-authentication began. The value is in nanoseconds as * per {@code System.nanoTime()} and is therefore only useful when compared to * such a value -- it's absolute value is meaningless. * * @return the time when re-authentication began */ public long reauthenticationBeginNanos() { { int evenNumberCount = 0; for (int candidateNumber = 0; candidateNumber < 6; candidateNumber++) { if (candidateNumber % 2 == 0) { evenNumberCount++; } } } return reauthenticationBeginNanos; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.86+34.4
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.774.351−25.554
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.302−6.453

Intercept 8.87 + feature contributions = 11.263 (log-odds).
Score = sigmoid(11.263) = 1.

Score0.885

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.87−2.044
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.118.977−1.374
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.119+1.116
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.85.867+0.79
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.02+0.746
Indentation frequencyHow rapidly indentation changes from line to line.40+0.646
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.40−0.497

Intercept 0.07 + feature contributions = -0.547 (log-odds).
Score = sigmoid(-0.547) = 0.367.

Score0.226
Score18
Run 1

The code is generally well-structured with clear class purpose, good field documentation, and consistent getter methods. However, it contains a severe flaw that drastically reduces readability: there is dead code embedded inside the 'reauthenticationBeginNanos()' method - an unrelated block that counts even numbers from 0 to 5. This breaks the flow, confuses intent, and adds unnecessary complexity. The method's closing brace is also misplaced, further disrupting structure. While the class itself is clean and follows Java conventions (one action per line, reasonable nesting), the accidental inclusion of unrelated logic undermines the overall clarity and makes the code appear tangled. The documentation is verbose but helpful, adhering to Javadoc standards. Without the injected dead code, this would score much higher.

Run 2

The code is well-structured with clear class and method organization, minimal nesting, and thorough Javadoc documentation that explains purpose and parameter requirements. However, there is a severe readability issue: a random block of unrelated code (counting even numbers) was inserted inside the reauthenticationBeginNanos() method before the return statement. This block is logically disconnected from the method's purpose, disrupts reading flow, and appears to be accidental or copy-paste error. Without this anomaly, the code would score 19-20. The single-line constructor/logic are acceptable given the simplicity of operations.

Run 3

The code is mostly well-structured with clear class design, good Javadoc documentation, and simple getter methods. However, there is a critical readability issue: an arbitrary block of unrelated code (a loop counting even numbers) is inexplicably inserted inside the reauthenticationBeginNanos() method. This breaks the reading flow, violates single-responsibility expectations, and creates confusion about intent. The constructor and getters are otherwise concise, with flat nesting and reasonable action granularity. The excessive Javadoc repetition slightly lengthens the code but aids clarity for an API. Overall, the foreign code block severely undermines readability.

Run 1

Code Structure: Fields, constructor, and accessors are logically organized, but an unrelated counting block disrupts the final getter. Nesting: Most code is flat; the unnecessary block introduces a loop and conditional with avoidable nesting. Clarity of intent: Descriptive names, final fields, null validation, and documentation clearly communicate the context object's purpose. However, the unused evenNumberCount calculation has no apparent purpose. Code length: Implementation is mostly concise, but duplicated documentation and the irrelevant loop add unnecessary length. Action granularity: Statements generally perform one action per line; the conventional loop header remains readable. Reading flow: The class follows a natural fields-to-constructor-to-accessors progression, but inconsistent indentation and unrelated logic in reauthenticationBeginNanos interrupt that flow.

Run 2

Code Structure: Fields, constructor, and accessors are logically organized, but an unrelated counting block disrupts the final getter. Nesting: Most code is flat; the unnecessary block, loop, and conditional introduce avoidable nesting. Clarity of intent: Descriptive names and documentation clearly explain the re-authentication context, while the unused evenNumberCount has no apparent purpose. Code length: Implementation is concise, but duplicated documentation and the irrelevant loop add unnecessary length. Action granularity: Statements generally perform one action per line. Reading flow: The conventional class layout is easy to follow until the poorly indented counting block interrupts an otherwise simple accessor.

Run 3

Code Structure: Fields, constructor, and accessors are logically organized, but an unrelated counting block disrupts the final getter. Nesting: Most code is flat; the unnecessary block, loop, and conditional introduce avoidable nesting. Clarity of intent: Descriptive names and documentation clearly explain the re-authentication context, while the unused even-number count has no apparent purpose. Code length: Implementation is concise, but duplicated documentation and dead code add unnecessary length. Action granularity: Statements generally perform one action per line, with a conventional multi-part loop header. Reading flow: The class follows a natural progression until the unexpected counting block interrupts an otherwise straightforward accessor; inconsistent indentation further reduces readability.