Sample

int-560dd64d79a3-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines77

Scores

MethodScoreScale
Posnett10–1; higher is more readable
Scalabrino0.9420–1; higher is more readable
Dorn0.7210–1; higher is more readable
Mi0.3970–1; higher is more readable
LLOC13Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.7140–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 previous, NetworkReceive network2, long now) { this.previousAuthenticator = Objects.requireNonNull(previous); this.networkReceive = network2; this.reauthenticationBeginNanos = now; } /** * 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 network() { 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 previous() { 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 reauthentication() { return reauthenticationBeginNanos; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.77+30.8
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.542.842−17.914
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.244−6.365

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

Score0.942

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.77−1.69
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.014+0.803
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.94.949+0.728
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.76.75+0.663
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.94.974−0.358
Indentation frequencyHow rapidly indentation changes from line to line.31+0.335

Intercept 0.07 + feature contributions = 0.95 (log-odds).
Score = sigmoid(0.95) = 0.721.

Score0.397
Score13
Run 1

The code demonstrates clear structure with a single class containing cohesive fields, a constructor, and simple getter methods. Nesting is minimal — there are no conditionals or loops, so no deep nesting exists. The intent is well-documented through Javadoc on the class, constructor, accessors, and fields, making the purpose unambiguous. Code length is appropriate; the extensive comments are verbose but reasonable for a public API. Action granularity is clean, with one meaningful operation per line. Reading flow is natural, with fields declared first, followed by the constructor and accessors. Minor deductions: parameter names in the constructor (previous, network2, now) are less descriptive than the field names, and the getter method names (network(), previous(), reauthentication()) are slightly opaque compared to more conventional names like getNetworkReceive(), getPreviousAuthenticator(), and getReauthenticationBeginNanos().

Run 2

The code demonstrates strong readability through clear structure, minimal nesting, and well-documented intent. The class is organized logically with a single constructor and three simple getter methods, each serving one purpose. Action granularity is appropriate - the constructor performs field assignments on separate lines with clear null-checking via Objects.requireNonNull. The Javadoc comments explain the complex domain context effectively, particularly for the NetworkReceive field's varied semantics. Minor deductions: parameter naming in the constructor (previous, network2, now) is inconsistent with the Javadoc parameter names and field names, creating slight cognitive friction. The method name 'reauthentication()' could be more explicit as 'reauthenticationBeginNanos()' to match its return type. The code is concise for its purpose, though the extensive Javadoc adds length - justified given the complex domain requirements. Reading flow is natural, moving from fields to constructor to accessors in a conventional order.

Run 3

The code is well-structured and readable. It follows a logical organization with a clear class purpose, well-named fields, and properly documented methods. The Javadoc is thorough but slightly verbose, which slightly impacts conciseness. The constructor uses parameter names (previous, network2, now) that are inconsistent with the field names and method names (previousAuthenticator, networkReceive, reauthenticationBeginNanos), which slightly obscures intent. Nesting is flat, each line performs a single action, and the reading flow is natural. Overall it is very readable despite minor naming inconsistencies and lengthy documentation.

Run 1

Code Structure: Clearly organized as a simple context class with immutable fields, a constructor, and getters. Nesting: Flat, with no conditional logic or nested blocks. Clarity of intent: Descriptive fields and detailed documentation explain the purpose, but vague parameter names such as network2 and now, abbreviated getter names, and Javadoc parameter names that do not match the constructor reduce clarity. Code length: Implementation is concise, though documentation repeats substantial details and dominates the class. Action granularity: Each assignment and return occupies its own line. Reading flow: Fields, construction, and accessors follow a natural order, but inconsistent naming and verbose comments interrupt otherwise straightforward reading.

Run 2

Code Structure: Fields, constructor, and accessors are logically organized in a simple context class. Nesting: Entirely flat, with no complex control flow. Clarity of intent: Descriptive field names and documentation explain the purpose, but constructor parameters such as network2 and now are vague, accessor names obscure some meaning, and Javadoc parameter names do not match the actual signature. Code length: Implementation is concise, though extensive, repeated documentation makes the class longer than necessary. Action granularity: Each assignment and return occupies its own line, making individual operations easy to follow. Reading flow: Conventional ordering supports natural reading, but verbose comments and inconsistent naming interrupt the flow.

Run 3

Code Structure: Logically organized as an immutable context object with fields, a constructor, and accessors. Nesting: Flat, with no nested control flow. Clarity of intent: Descriptive field names and documentation explain the purpose, but constructor names such as network2 and now are vague, accessor names omit useful context, and @param tags do not match the actual parameters. Code length: Implementation is concise, though lengthy, repeated documentation adds reading overhead. Action granularity: Each statement performs one clear action. Reading flow: Predictable field-to-constructor-to-accessor ordering makes navigation easy, but inconsistent naming and mismatched documentation interrupt comprehension.