Sample

int-973ee185cc2d-I10

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

Matched original source

Lines39

Scores

MethodScoreScale
Posnett10–1; higher is more readable
Scalabrino0.9840–1; higher is more readable
Dorn0.8060–1; higher is more readable
Mi0.7390–1; higher is more readable
LLOC9Logical lines; fewer is more readable
DeepSeek V4 Pro11.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.6940–1; higher is more readable

Views

Source code

package org.springframework.context; /** * Strategy interface for processing Lifecycle beans within the ApplicationContext. * * @author Mark Fisher * @author Juergen Hoeller * @since 3.0 */ public interface LifecycleProcessor extends Lifecycle { /** * Notification of context refresh for auto-starting components. * @see ConfigurableApplicationContext#refresh() */ default void onRefresh() { start(); } /** * Notification of context restart for auto-stopping and subsequently * auto-starting components. * @since 7.0 * @see ConfigurableApplicationContext#restart() */ default void onRestart() { stop(); start(); } /** * Notification of context pause for auto-stopping components. * @since 7.0 * @see ConfigurableApplicationContext#pause() */ default void onPause() { stop(); } /** * Notification of context close phase for auto-stopping components * before destruction. * @see ConfigurableApplicationContext#close() */ default void onClose() { stop(); } }

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.280.461−9.255
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.784−7.176

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

Score0.984

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.036+0.59
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.83+0.535
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.38−0.309
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.82.875+0.155
Indentation frequencyHow rapidly indentation changes from line to line.17−0.149
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.38.774+0.132

Intercept 0.07 + feature contributions = 1.422 (log-odds).
Score = sigmoid(1.422) = 0.806.

Score0.739
Score9
Run 1

The code defines a clear lifecycle processing interface with understandable method purposes, but formatting issues significantly harm readability. The placement of Javadoc comments and method braces breaks the natural reading flow - for example, the onRefresh() method's opening brace is on the same line as its Javadoc comment, and onClose() follows on the same line as onPause()'s closing brace. Inconsistent indentation and spacing throughout make the structure feel disorganized despite logical organization. Nesting is flat, and action granularity is appropriate with one action per line in the methods, but the code length is slightly affected by verbose comments. The intent of each method is clear from naming and documentation, but the presentation undermines what could otherwise be highly readable Spring framework code.

Run 2

The code is generally readable but has several formatting inconsistencies. The interface has a clear purpose and follows a logical structure with related lifecycle methods. Default methods are concise and each performs a single action. However, the code suffers from inconsistent Javadoc and brace placement — some methods start on the same line as the comment, while others are on new lines. The onRestart() method places two method calls on one line, breaking the one-action-per-line principle. Overall nesting is flat and intent is clear, but the irregular formatting disrupts natural reading flow.

Run 3

The code has clear intent with a simple interface and helpful Javadoc, but formatting severely hurts readability. Comments are attached inconsistently to methods, with one inline comment preceding a default method on the same line. The onRestart() method places two method calls on a single line, violating the 'one action per line' criterion, and onPause() places the closing brace of its body immediately after its single statement on the same line. Braces and method declarations are uneven across methods, making the reading flow disorganized. While the structure is logical and nesting is flat, the irregular formatting obscures clarity.

Run 1

Code Structure: The interface logically groups lifecycle callbacks, but compressed declarations and adjacent documentation obscure method boundaries. Nesting: Minimal nesting makes the implementation easy to follow. Clarity of intent: Descriptive method names and Javadoc clearly explain each callback. Code length: Concise, with no unnecessary implementation logic. Action granularity: Operations are simple, but placing calls beside method declarations and closing braces reduces visual separation. Reading flow: The callback sequence is natural, but inconsistent line breaks and formatting interrupt scanning. Standard formatting would substantially improve readability.

Run 2

Code Structure: The interface groups related lifecycle callbacks logically, but inconsistent placement of comments, declarations, and braces weakens visual organization. Nesting: Methods are flat and contain no nested control flow. Clarity of intent: Descriptive method names and Javadoc clearly explain each callback and its start/stop behavior. Code length: The implementation is concise, with little unnecessary code. Action granularity: Calls generally occupy separate lines, but onRestart places stop() on the declaration line, and other methods combine calls with closing braces or comments. Reading flow: The callback order is natural, but cramped formatting and comments attached to braces interrupt scanning. Overall, the code is semantically clear and structurally simple, yet inconsistent formatting substantially reduces readability.

Run 3

Code Structure: Methods are logically grouped in a small lifecycle interface, but inconsistent placement of comments and braces obscures boundaries. Nesting: Minimal nesting makes the code easy to understand. Clarity of intent: Descriptive method names and Javadoc clearly explain lifecycle behavior. Code length: Concise, with no unnecessary implementation complexity. Action granularity: Some declarations and actions share lines, particularly onRestart(), reducing scanability, although individual calls remain simple. Reading flow: The lifecycle sequence is natural, but comments attached to closing braces and uneven formatting interrupt reading. Consistent line breaks and brace placement would substantially improve readability.