Sample

int-58f3993d5ea4-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines39

Scores

MethodScoreScale
Posnett0.9270–1; higher is more readable
Dorn0.2450–1; higher is more readable
Mi0.2070–1; higher is more readable
LLOC1Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6140–1; higher is more readable

Views

Source code

package org.springframework.test.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Test annotation for use with JUnit 4 to indicate that a test method has to finish * execution in a {@linkplain #millis() specified time period}. * * <p>If the test execution takes longer than the specified time period, then * the test is considered to have failed. * * <p>Note that the time period includes execution of the test method itself, * any {@linkplain Repeat repetitions} of the test, and any <em>set up</em> or * <em>tear down</em> of the test fixture. * * <p>This annotation may be used as a <em>meta-annotation</em> to create custom * <em>composed annotations</em>. * * @author Rod Johnson * @author Sam Brannen * @since 2.0 * @see org.springframework.test.annotation.Repeat * @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner * @see org.springframework.test.context.junit4.rules.SpringMethodRule * @see org.springframework.test.context.junit4.statements.SpringFailOnTimeout * @deprecated since Spring Framework 7.0 in favor of the * {@link org.springframework.test.context.junit.jupiter.SpringExtension SpringExtension} * and JUnit Jupiter */ @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Deprecated(since = "7.0") public @interface Timed { /** * The maximum amount of time (in milliseconds) that a test execution can * take without being marked as failed due to taking too long. */ long millis(); }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.39+15.6
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.445−14.685
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.825−7.237

Intercept 8.87 + feature contributions = 2.548 (log-odds).
Score = sigmoid(2.548) = 0.927.

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.164−3.281
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.164+1.842
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.028+0.668
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.40−0.38
Indentation frequencyHow rapidly indentation changes from line to line.12−0.322
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.12+0.145
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.38.867+0.133

Intercept 0.07 + feature contributions = -1.124 (log-odds).
Score = sigmoid(-1.124) = 0.245.

Score0.207
Score1
Run 1

The code is well-structured overall, with clear section separators and Javadoc. However, the first line combines the package declaration and multiple imports on a single line, violating the 'one action per line' principle and reducing readability. The nesting is minimal and the intent is clear. The annotation definition is concise with appropriate documentation.

Run 2

The code is functional but readability suffers from poor structure. All imports are crammed onto one line, and the Javadoc block is extremely verbose, making the file feel dense. The annotation declaration itself is clear and well-organized, with sensible annotations and a simple method. However, the overly detailed Javadoc (including multiple @see references and deprecation notes) adds visual noise. Nesting is nonexistent, which is good, and the action granularity is appropriate. Reading flow is disrupted by the initial import line and the massive comment block before reaching the actual declaration. The code would benefit from one-import-per-line formatting and a more concise Javadoc summary, perhaps moving detailed explanation to external documentation.

Run 3

The code is highly readable. It has a clear, logical structure with standard package and import declarations, followed by comprehensive Javadoc that explains the annotation's purpose, constraints, and usage. Nesting is essentially non-existent as this is a simple annotation definition. The intent is unmistakable: define a timed test annotation with a millis attribute. The code is concise and contains no redundancy. Each significant piece of information (annotation target, retention, deprecation, method signature) is on its own line, aiding granularity. Reading flow is natural — from imports to documentation to type declaration to member. Minor deductions are only due to the compacted initial line (package and imports on one line) and the length of Javadoc, which slightly impacts initial scanability.

Run 1

Code Structure: The package, imports, documentation, metadata, and annotation declaration follow a logical order, but compressed header formatting weakens separation. Nesting: Essentially flat, with only one annotation member. Clarity of intent: Timed and millis(), supported by clear documentation, explicitly communicate the timeout purpose and scope. Code length: The implementation is minimal; the longer documentation provides useful lifecycle, usage, and deprecation context. Action granularity: Annotation metadata and the member declaration each occupy separate lines, but several imports and the package declaration share lines. Reading flow: Natural and easy to follow after the header; placing each import on its own line and separating the documentation would improve readability.

Run 2

Code Structure: The annotation follows a logical order: imports, documentation, metadata, and declaration, though the opening statements are crowded. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Timed, millis(), and the thorough documentation clearly explain the timeout behavior, scope, and deprecation. Code length: The implementation is concise; the longer documentation provides useful context rather than unnecessary complexity. Action granularity: Most declarations occupy separate lines, but multiple package/import statements share lines, reducing readability. Reading flow: The annotation body and metadata read naturally, while compressed imports and the Javadoc opening interrupt the otherwise clean flow.

Run 3

Code Structure: The annotation declaration is logically organized, but the package statement and several imports are compressed onto shared lines. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The Timed name, millis() member, and detailed Javadoc clearly explain the timeout behavior, scope, and deprecation. Code length: The implementation is concise; the documentation is longer but provides useful context. Action granularity: The annotation metadata and member declaration each occupy separate lines, while multiple import declarations on single lines reduce readability. Reading flow: Documentation, metadata, and declaration follow a natural sequence, though the crowded opening lines interrupt an otherwise clean presentation.