Sample

Schnappinger/junit4/junit.framework.AssertionFailedError

Human rating uses the original dataset scale.

Human4
Lines20

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.5050–1; higher is more readable
79.3Δ 11.2
Scalabrino0.8140–1; higher is more readable
66.1Δ 24.3
Dorn0.8560–1; higher is more readable
93.1Δ 2.6
Mi0.6890–1; higher is more readable
81.2Δ 9.2
LLOC5Logical lines; fewer is more readable
83.0Δ 7.4
DeepSeek V4 Pro18.330–20; mean of three runs
96.0Δ 5.6
GPT-6.1 Sol200–20; mean of three runs
99.3Δ 8.9
BTTF0.7740–1; higher is more readable
93.1Δ 2.6
Human41–4; original rating
90.4

Views

Source code

package junit.framework; /** * Thrown when an assertion failed. */ public class AssertionFailedError extends AssertionError { private static final long serialVersionUID = 1L; public AssertionFailedError() { } public AssertionFailedError(String message) { super(defaultString(message)); } private static String defaultString(String message) { return message == null ? "" : message; } }

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.302.206−9.973
Source linesThe number of non-empty source lines.20+8
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.585−6.878

Intercept 8.87 + feature contributions = 0.019 (log-odds).
Score = sigmoid(0.019) = 0.505.

Score0.814

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.57.9+1.213
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.20+0.328
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.067+0.291
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.18.746−0.148
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.58+0.131
Indentation frequencyHow rapidly indentation changes from line to line.18−0.115
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.18+0.008

Intercept 0.07 + feature contributions = 1.779 (log-odds).
Score = sigmoid(1.779) = 0.856.

Score0.689
Score5
Run 1

The code is well-structured and highly readable. It has a clear, single-purpose class with a logical organization: a class-level Javadoc comment, a serialVersionUID constant, a default constructor, a message-based constructor, and a private helper method. Nesting is minimal — only a single ternary expression with no deep blocks. Intent is unambiguous: it represents an assertion failure and ensures a non-null message. The code is concise without being cryptic, and each action (constructor delegation, null handling) is separated cleanly. Reading flow is natural: class declaration, documentation, constant, constructors, then helper. The only minor deduction is the absence of Javadoc on the constructors and helper method, but this is minor and does not hurt comprehension.

Run 2

The code is highly readable. Structure is clear: a single class extending AssertionError with a serialVersionUID, two constructors, and a helper method. Nesting is minimal with only a ternary expression in the helper. Intent is obvious from class name and Javadoc—it represents a failed assertion. Code length is concise with no redundancy. Each action is on separate lines, maintaining good granularity. Reading flow is natural: class declaration, fields, constructors, then helper method. The only minor deduction is that the helper method ‘defaultString’ could be inlined or named more intuitively, but this is negligible. Overall, it’s an exemplary piece of clear, maintainable Java code.

Run 3

The code is highly readable. Structure is clean, with a logical package declaration, a clear class-level Javadoc, and well-separated methods. Nesting is minimal (a single ternary), and the intent of each method is obvious. Length is concise and appropriate for a simple error type. Action granularity is good—each method performs one clear task. Reading flow is natural, from constructors to the private helper. Minor deductions: the redundant `defaultString` method could be inlined, and the empty no-argument constructor could be omitted, but these are negligible.

Run 1

Code Structure: The class is logically organized, with the serialization field followed by constructors and a helper method. Nesting: There is no unnecessary nesting; the null-handling expression is simple. Clarity of intent: The class name, documentation, and constructor parameter clearly communicate an assertion failure with an optional message. Code length: The implementation is concise without sacrificing clarity. Action granularity: Each statement performs one clear action. Reading flow: Consistent formatting and a natural declaration order make the code easy to follow.

Run 2

Code Structure: The class is logically organized into a serialization constant, constructors, and a small helper. Nesting: There is no deep nesting; the null check uses a simple ternary expression. Clarity of intent: The class name, documentation, and constructor parameter clearly communicate its purpose, while defaultString makes null handling explicit. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs a single clear action. Reading flow: Conventional Java formatting and member ordering make the code easy to follow.

Run 3

Code Structure: The class is logically organized into a serialization field, constructors, and a small helper. Nesting: There is no nested control flow; the null check uses a simple ternary expression. Clarity of intent: The class documentation, descriptive names, and superclass clearly communicate its purpose as an assertion failure error. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs one clear action, and the helper isolates message normalization. Reading flow: The progression from class declaration to constructors and helper is natural and easy to follow.