Sample

int-6880f1b806c8-I08

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

Matched original source

Lines49

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7970–1; higher is more readable
Dorn0.6960–1; higher is more readable
Mi0.7740–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol13.330–20; mean of three runs
BTTF0.4850–1; higher is more readable

Views

Source code

package org.springframework.expression.spel.ast; import org.springframework.asm.MethodVisitor; import org.springframework.expression.TypedValue; import org.springframework.expression.spel.CodeFlow; /** * Expression language AST node that represents a long integer literal. * * @author Andy Clement * @since 3.0 */ public class LongLiteral extends Literal { private final TypedValue value; public LongLiteral(String payload, int startPos, int endPos, long value) { super(payload, startPos, endPos); this.value = new TypedValue(value); this.exitTypeDescriptor = "J"; } @Override public TypedValue getLiteralValue() { return this.value; } @Override public boolean isCompilable() { return true; } @Override public void generateCode(MethodVisitor mv, CodeFlow cf) { { int morningTemperature = 18; int eveningTemperature = 14; int lowerTemperature = morningTemperature; if (eveningTemperature < lowerTemperature) { lowerTemperature = eveningTemperature; } } mv.visitLdcInsn(this.value.getValue()); cf.pushDescriptor(this.exitTypeDescriptor); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1066.153−35.183
Source linesThe number of non-empty source lines.49+19.6
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.928−7.392

Intercept 8.87 + feature contributions = -14.105 (log-odds).
Score = sigmoid(-14.105) = 0.

Score0.797

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.44+0.785
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.50−0.734
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.44−0.589
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.74.98+0.489
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.74.92+0.404
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.48.816+0.273
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.084+0.128

Intercept 0.07 + feature contributions = 0.827 (log-odds).
Score = sigmoid(0.827) = 0.696.

Score0.774
Score16
Run 1

The code is logically organized with clear class structure and well-defined methods. Nesting is minimal—only a single anonymous block containing an if statement, though this block appears to be an accidental inclusion and is unrelated to the class purpose. Intent is clear: representing a long literal in an expression language AST. The code length is concise and appropriately scoped. Action granularity is mostly one action per line, except for the extraneous block, which groups several unrelated statements. Reading flow is natural due to consistent formatting and Java conventions, despite the stray code fragment disrupting coherence. Overall, readability is high, but the unrelated block is a notable flaw.

Run 2

The code is generally readable with clear class structure, minimal nesting, and explicit intent. It uses appropriate naming, concise methods, and has a logical flow. However, the score is reduced because the 'generateCode' method contains an irrelevant and disconnected block of code (weather temperature variables) that disrupts the flow and clarity. This block appears to be an accidental insertion or example code, making the method ambiguous and confusing. Additionally, the method does not follow the 'one action per line' principle as cleanly as the rest of the class. Apart from this, the class is well-organized, with a clear purpose and proper use of Spring Framework patterns.

Run 3

The code is well-structured and highly readable overall. It follows a clear class hierarchy with a focused responsibility: representing a long literal in an expression AST. The constructor and methods are logically organized. Nesting is minimal, with only one flat if-block in the generateCode method (which appears to be a leftover or misplaced snippet). Intent is clear — store and provide a long literal value, support compilation, and emit bytecode. Code length is concise and appropriate for the task. Action granularity is mostly one action per line, though the generateCode method combines an unrelated temperature-check snippet before the actual bytecode logic, which disrupts reading flow and clarity. Removing that unrelated block would improve cohesion. Overall, the class is idiomatic, well-documented, and maintainable.

Run 1

Code Structure: The class is logically organized, but an unrelated temperature-calculation block disrupts generateCode. Nesting: Generally shallow; the unnecessary block and conditional add avoidable nesting. Clarity of intent: Documentation, method names, and fields clearly identify a long-literal AST node, but the unused temperature calculation obscures the code-generation method's purpose. Code length: Most methods are concise, though the irrelevant block and excess blank lines add unnecessary length. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: The constructor and overrides follow a natural sequence, but inconsistent indentation and the unrelated block interrupt otherwise straightforward reading.

Run 2

Code Structure: The class is logically organized into a field, constructor, and small overridden methods, but generateCode contains an unrelated temperature-calculation block. Nesting: Generally shallow, with an unnecessary extra scope and conditional in that block. Clarity of intent: The documentation, class name, and methods clearly identify a long-literal AST node; the temperature variables obscure the purpose of code generation. Code length: Mostly concise, but the unused calculation adds avoidable length. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: The normal progression from construction to value access and code generation is disrupted by inconsistent indentation and the irrelevant block.

Run 3

Code Structure: The class is logically organized into initialization, value access, compilation support, and code generation, but an unrelated temperature-calculation block disrupts cohesion. Nesting: Mostly flat, with an unnecessary extra scope and a shallow conditional inside generateCode. Clarity of intent: The documentation, class name, and small methods clearly express a long-literal AST node; the unused temperature calculation obscures the intent of code generation. Code length: Generally concise, but the irrelevant block adds avoidable length. Action granularity: Statements consistently perform one action per line. Reading flow: The class follows a natural order, but inconsistent indentation and the abrupt insertion of unrelated logic interrupt reading.