Sample

Schnappinger/junit4/org.junit.internal.runners.statements.RunAfters

Human rating uses the original dataset scale.

Human3.99
Lines41

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
56.9Δ 31.6
Scalabrino0.5190–1; higher is more readable
10.3Δ 78.2
Dorn0.570–1; higher is more readable
64.7Δ 23.8
Mi0.6710–1; higher is more readable
77.9Δ 10.6
LLOC17Logical lines; fewer is more readable
64.0Δ 24.4
DeepSeek V4 Pro17.330–20; mean of three runs
73.9Δ 14.5
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 14.7
BTTF0.6140–1; higher is more readable
60.1Δ 28.4
Human3.991–4; original rating
88.4

Views

Source code

package org.junit.internal.runners.statements; import java.util.ArrayList; import java.util.List; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.MultipleFailureException; import org.junit.runners.model.Statement; public class RunAfters extends Statement { private final Statement fNext; private final Object fTarget; private final List<FrameworkMethod> fAfters; public RunAfters(Statement next, List<FrameworkMethod> afters, Object target) { fNext = next; fAfters = afters; fTarget = target; } @Override public void evaluate() throws Throwable { List<Throwable> errors = new ArrayList<Throwable>(); try { fNext.evaluate(); } catch (Throwable e) { errors.add(e); } finally { for (FrameworkMethod each : fAfters) { try { each.invokeExplosively(fTarget); } catch (Throwable e) { errors.add(e); } } } MultipleFailureException.assertEmpty(errors); } }

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.1167.835−38.539
Source linesThe number of non-empty source lines.41+16.4
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.425−6.638

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

Score0.519

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.41+0.681
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.927+0.153
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.762+0.146
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.091+0.055

Intercept 0.07 + feature contributions = 0.283 (log-odds).
Score = sigmoid(0.283) = 0.57.

Score0.671
Score17
Run 1

The code is well-structured and readable. It follows a clear logical flow: try to execute the next statement, collect any exceptions, run after methods in finally, then assert no errors occurred. Nesting is minimal with only two levels (try-finally and for-loop with try-catch). The intent is clear from class and method names (RunAfters, evaluate, fNext, fAfters). Variable names use a somewhat cryptic 'f' prefix convention but are otherwise descriptive. Each line generally handles one action, and the reading flow progresses naturally from setup through execution to cleanup and validation. The use of MultipleFailureException.assertEmpty is concise and clear. Minor improvements could include removing the 'f' prefix or adding brief comments, but overall this is clean, maintainable test infrastructure code.

Run 2

The code is well-structured with clear separation of concerns. The class has a single responsibility - running after-methods - and uses logical field names (fNext, fTarget, fAfters) consistent with JUnit conventions. The evaluate() method is flat with only two levels of nesting (try-catch and for loop). Action granularity is good: each statement performs one logical operation. The reading flow follows the natural execution order: create errors list, execute next statement, collect errors, then run afters, finally assert no errors. The only slight drawbacks are the single-letter variable name 'e' (common for exceptions but less descriptive) and the lack of comments explaining the error collection strategy. The method length is appropriate (15 lines), and the code avoids unnecessary complexity. Overall, highly readable with minor room for improvement.

Run 3

The code is highly readable due to its clear structure, flat nesting, and concise implementation. The class has a single responsibility: running after-methods after a statement. Field names use a consistent prefix ('f') convention, and the constructor is straightforward. The evaluate() method follows a logical flow: execute the next statement, collect failures, run all after-methods in a finally block, then assert no failures occurred. Nesting is minimal (only one level inside loops/catch blocks), and each line performs a single action. Intent is evident from class and method names. The only minor drawbacks are the use of abbreviated field names (fNext, fTarget, fAfters) which may require familiarity with JUnit's internal conventions, and the slightly terse exception handling pattern. Overall, the code is nearly ideal in readability.

Run 1

Code Structure: Fields, constructor, and evaluation logic are logically organized, with failure aggregation handled consistently. Nesting: The try/finally, loop, and inner try/catch introduce moderate nesting, but it is justified by cleanup requirements. Clarity of intent: The code clearly runs the next statement, executes all after-methods regardless of failure, and reports collected errors; legacy f-prefixed fields and the generic variable name each slightly reduce clarity. Code length: Concise, with no unnecessary logic or repetition beyond essential exception handling. Action granularity: Each statement performs one clear action. Reading flow: Execution proceeds naturally from the main statement through cleanup to final failure reporting.

Run 2

Code Structure: Fields, constructor, and evaluation logic are logically organized, with failure collection handled consistently. Nesting: The try/catch/finally containing a loop and another try/catch adds moderate nesting, but it is justified by cleanup requirements. Clarity of intent: The code clearly runs the next statement, executes all after-methods even on failure, and reports collected errors; legacy f-prefixed fields and the generic variable name 'each' slightly reduce clarity. Code length: Compact and purposeful, with no unnecessary logic. Action granularity: Each statement performs one action, making execution easy to follow. Reading flow: Initialization, primary execution, cleanup, and failure reporting form a natural sequence.

Run 3

Code Structure: Fields, constructor, and execution method are logically organized, with failure collection handled consistently. Nesting: The try/finally, loop, and inner try/catch introduce moderate nesting, but it is justified by cleanup requirements. Clarity of intent: The code clearly runs the primary statement, executes all after-methods regardless of failure, and reports accumulated errors; legacy f-prefixed fields and the generic name 'each' slightly reduce clarity. Code length: Compact without unnecessary logic or repetition. Action granularity: Each line performs a single clear action. Reading flow: Execution proceeds naturally from the primary statement through cleanup to final error reporting, although understanding the final assertion depends on familiarity with MultipleFailureException.