Sample

int-c19be7e3e79e-I13

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

Matched original source

Lines51

Scores

MethodScoreScale
Posnett10–1; higher is more readable
Scalabrino0.8990–1; higher is more readable
Dorn0.7280–1; higher is more readable
Mi0.3990–1; higher is more readable
LLOC1Logical lines; fewer is more readable
DeepSeek V4 Pro18.330–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.7470–1; higher is more readable

Views

Source code

package org.springframework.jdbc.core; import java.sql.PreparedStatement; import java.sql.SQLException; import org.jspecify.annotations.Nullable; import org.springframework.jdbc.support.JdbcUtils; /** * Interface to be implemented for setting values for more complex database-specific * types not supported by the standard {@code setObject} method. This is * effectively an extended variant of {@link org.springframework.jdbc.support.SqlValue}. * * <p>Implementations perform the actual work of setting the actual values. They must * implement the callback method {@code setTypeValue} which can throw SQLExceptions * that will be caught and translated by the calling code. This callback method has * access to the underlying Connection via the given PreparedStatement object, if that * should be needed to create any database-specific objects. * * @author Thomas Risberg * @author Juergen Hoeller * @since 1.1 * @see java.sql.Types * @see java.sql.PreparedStatement#setObject * @see JdbcOperations#update(String, Object[], int[]) * @see org.springframework.jdbc.support.SqlValue */ public interface SqlTypeValue { /** * Constant that indicates an unknown (or unspecified) SQL type. * Passed into {@code setTypeValue} if the original operation method * does not specify an SQL type. * @see java.sql.Types * @see JdbcOperations#update(String, Object[]) */ int TYPE_UNKNOWN = JdbcUtils.TYPE_UNKNOWN; /** * Set the type value on the given PreparedStatement. * @param ps the PreparedStatement to work on * @param paramIndex the index of the parameter for which we need to set the value * @param sqlType the SQL type of the parameter we are setting * @param typeName the type name of the parameter (optional) * @throws SQLException if an SQLException is encountered while setting parameter values * @see java.sql.Types * @see java.sql.PreparedStatement#setObject */ void setTypeValue(PreparedStatement ps, int paramIndex, int sqlType, @Nullable String typeName) throws SQLException; }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.51+20.4
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.382.574−12.625
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.905−7.358

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

Score0.899

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.52−0.805
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.015+0.793
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.95.962+0.744
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.95.981−0.4
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.50.845+0.301
Indentation frequencyHow rapidly indentation changes from line to line.18−0.115

Intercept 0.07 + feature contributions = 0.986 (log-odds).
Score = sigmoid(0.986) = 0.728.

Score0.399
Score1
Run 1

This code demonstrates excellent readability. The interface is well-structured with clear separation between documentation, constants, and the method signature. Javadoc comments are thorough and explain the purpose, parameters, and exceptions in detail. The method signature is concise yet descriptive, with clear parameter names (ps, paramIndex, sqlType, typeName) and proper use of @Nullable annotation. Nesting is minimal since this is a single interface declaration. The code follows Spring Framework conventions, making it familiar to experienced Java developers. While the Javadoc is comprehensive, it's not excessive for a public API. The single constant TYPE_UNKNOWN is well-documented. The code achieves strong clarity of intent - it clearly defines a callback interface for setting complex SQL type values. Overall, this is exemplary Java API code that balances thorough documentation with clean implementation.

Run 2

The code is highly readable. It is a well-structured Spring interface with clear purpose and minimal complexity. The Javadoc is thorough, explaining intent, parameters, and exceptions. The single method declaration is concise, with one action (the method signature) clearly presented. Nesting is absent, and the reading flow is natural: package, imports, documentation, then the interface definition. Naming is consistent and descriptive, and the use of a constant improves clarity. The only minor deduction is due to the multi-line method signature wrapping, which is necessary for parameter documentation but slightly reduces visual simplicity.

Run 3

The code is highly readable. It is a well-documented interface with a single method, which keeps the structure flat and the intent clear. The use of Javadoc explains the purpose and parameters concisely, adhering to standard Java conventions. The method signature is compact, with each parameter clearly named and annotated, and the action granularity is appropriate for an interface definition. The reading flow is natural: package and imports first, followed by interface declaration, constants, and the method. There is no unnecessary complexity or nesting. Minor deductions could be made because the typeName parameter might benefit from more explanatory documentation or a clearer usage example, but overall the code is concise, maintainable, and easy to understand.

Run 1

Code Structure: Cleanly organized into imports, interface documentation, a constant, and a single callback declaration. Nesting: Minimal, with only the interface scope and no nested logic. Clarity of intent: Descriptive names and detailed Javadoc clearly explain the interface's purpose, parameters, optional type name, and exception behavior. Code length: The implementation is concise; documentation is useful but slightly repetitive. Action granularity: Each declaration occupies its own logical unit, with no multiple actions compressed onto a line. Reading flow: Natural top-to-bottom progression and consistent formatting make scanning easy. Minor drawbacks include the lack of spacing between the package and imports, an extra blank line between members, and somewhat verbose documentation.

Run 2

Code Structure: Clearly organized into imports, interface documentation, a constant, and a single method contract. Nesting: Flat, with no nested control flow. Clarity of intent: Descriptive interface and method names, detailed Javadoc, and the Nullable annotation make the purpose and parameter expectations clear; 'ps' is slightly abbreviated. Code length: The implementation is concise, although some documentation is repetitive. Action granularity: Each declaration has a single responsibility, and the wrapped method signature remains easy to read. Reading flow: Natural progression from the interface's purpose to its constant and callback method, with only minor spacing and documentation verbosity detracting from readability.

Run 3

Code Structure: Logically organized into package, imports, interface documentation, constant, and method declaration. Nesting: Minimal, with only the interface scope and no nested control flow. Clarity of intent: The interface name, method signature, nullable annotation, and detailed Javadoc clearly explain its database-specific parameter-setting role. Code length: The implementation is concise; documentation is useful but slightly verbose and repetitive. Action granularity: Each declaration occupies its own logical unit, with no combined actions. Reading flow: Conventional Java ordering and consistent formatting make the code easy to scan. Minor drawbacks include the abbreviated parameter name 'ps', extra blank lines, and repetitive wording in the interface documentation.