Sample

Schnappinger/junit4/org.junit.internal.builders.AnnotatedBuilder

Human rating uses the original dataset scale.

Human3.87
Lines41

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
52.2Δ 5.1
Scalabrino0.5420–1; higher is more readable
12.7Δ 34.4
Dorn0.0760–1; higher is more readable
30.4Δ 16.7
Mi0.0520–1; higher is more readable
6.6Δ 40.4
LLOC16Logical lines; fewer is more readable
64.9Δ 17.8
DeepSeek V4 Pro16.670–20; mean of three runs
59.9Δ 12.9
GPT-6.1 Sol17.670–20; mean of three runs
62.2Δ 15.2
BTTF0.5270–1; higher is more readable
46.2Δ 0.8
Human3.871–4; original rating
47.0

Views

Source code

package org.junit.internal.builders; import org.junit.runner.RunWith; import org.junit.runner.Runner; import org.junit.runners.model.InitializationError; import org.junit.runners.model.RunnerBuilder; public class AnnotatedBuilder extends RunnerBuilder { private static final String CONSTRUCTOR_ERROR_FORMAT = "Custom runner class %s should have a public constructor with signature %s(Class testClass)"; private final RunnerBuilder fSuiteBuilder; public AnnotatedBuilder(RunnerBuilder suiteBuilder) { fSuiteBuilder = suiteBuilder; } @Override public Runner runnerForClass(Class<?> testClass) throws Exception { RunWith annotation = testClass.getAnnotation(RunWith.class); if (annotation != null) { return buildRunner(annotation.value(), testClass); } return null; } public Runner buildRunner(Class<? extends Runner> runnerClass, Class<?> testClass) throws Exception { try { return runnerClass.getConstructor(Class.class).newInstance(testClass); } catch (NoSuchMethodException e) { try { return runnerClass.getConstructor(Class.class, RunnerBuilder.class).newInstance(testClass, fSuiteBuilder); } catch (NoSuchMethodException e2) { String simpleName = runnerClass.getSimpleName(); throw new InitializationError(String.format( CONSTRUCTOR_ERROR_FORMAT, simpleName, simpleName)); } } } }

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.1398.684−46.157
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.563−6.844

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

Score0.542

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.151.951−2.771
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
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.076+0.199
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.824+0.147

Intercept 0.07 + feature contributions = -2.496 (log-odds).
Score = sigmoid(-2.496) = 0.076.

Score0.052
Score16
Run 1

The code is well-structured and readable. It has a clear logical organization with a single public method entry point and a focused helper. Nesting is shallow, with only one nested try-catch inside the main try. Intent is clear: build a runner from the @RunWith annotation, falling back from a simple constructor to one accepting a RunnerBuilder. Action granularity is mostly one operation per line, though the constructor calls are somewhat dense. Naming is conventional and descriptive, though `fSuiteBuilder` uses an older prefix style. Minor deductions: the nested catch has duplicate logic and the constructor fallback could be refactored, but overall this is concise (< 30 lines of logic) and flows naturally from annotation detection to construction to error handling.

Run 2

The code is well-structured and readable. It follows a clear logical organization with a single purpose class. Nesting is limited to two levels within a try-catch, which is acceptable for the exception-handling logic. Intent is clear through descriptive method names like runnerForClass and buildRunner, and the error message constant contributes to clarity. Code length is concise, avoiding unnecessary verbosity. However, action granularity is somewhat mixed: the nested getConstructor/newInstance call combines multiple actions on one line, which slightly reduces readability. Overall reading flow is natural, progressing from annotation lookup to runner construction, with adequate exception handling. The main deductions come from the slightly dense constructor invocation lines and the moderate nesting in the catch block, but these are minor issues in an otherwise clean implementation.

Run 3

The code is well-structured with clear separation of concerns, minimal nesting (only two levels deep), and concise methods. Each line performs a single logical action, maintaining good action granularity. The use of a descriptive constant for the error message improves clarity. The reading flow is natural: annotation check, then builder invocation. The nested try-catch in buildRunner adds slight complexity but remains readable. Naming is clear except for 'fSuiteBuilder' (a legacy prefix), which is a minor issue. Overall, the code demonstrates high readability with only minor stylistic concerns.

Run 1

Code Structure: Well organized, separating annotation lookup from runner construction and centralizing the error message. Nesting: Mostly shallow, though nested try-catch blocks make constructor fallback slightly harder to follow. Clarity of intent: Method names, types, and the error message clearly communicate the purpose; fSuiteBuilder and generic exception names are less descriptive. Code length: Concise, with no unnecessary logic. Action granularity: Statements generally perform one action, although chained reflection calls combine constructor lookup and instantiation. Reading flow: Natural progression from annotation detection to preferred constructor, fallback constructor, and initialization error; line wrapping and nested exception handling introduce minor friction.

Run 2

Code Structure: Well organized, with annotation detection and runner construction separated into focused methods. Nesting: Mostly shallow, though nested try-catch blocks add complexity to constructor fallback handling. Clarity of intent: Method names, types, and the descriptive error message clearly communicate the purpose; fSuiteBuilder and generic exception names are slightly less expressive. Code length: Concise, with little unnecessary code. Action granularity: Statements generally perform one logical action, although chained reflection calls combine constructor lookup and instantiation. Reading flow: Natural progression from annotation lookup to preferred constructor, fallback constructor, and error reporting. Line wrapping slightly interrupts the reflection expressions but remains understandable.

Run 3

Code Structure: Well organized into annotation detection and runner construction, with a shared error-message constant. Nesting: Mostly shallow, though the nested try/catch adds complexity to constructor fallback handling. Clarity of intent: Descriptive method names and explicit constructor signatures make the purpose clear; fSuiteBuilder and generic exception names are slightly less intuitive. Code length: Concise, with no unnecessary logic or duplication. Action granularity: Statements generally perform one clear action, although reflection calls chain constructor lookup and instantiation. Reading flow: Natural progression from annotation lookup to preferred constructor, fallback constructor, and informative failure. Long lines and wrapped reflection calls slightly reduce scanning ease.