Sample

Schnappinger/junit4/org.junit.internal.Classes

Human rating uses the original dataset scale.

Human2.62
Lines18

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.4910–1; higher is more readable
77.9Δ 62.1
Scalabrino0.7390–1; higher is more readable
46.6Δ 30.7
Dorn0.7740–1; higher is more readable
79.5Δ 63.7
Mi0.7970–1; higher is more readable
95.4Δ 79.5
LLOC2Logical lines; fewer is more readable
94.6Δ 78.7
DeepSeek V4 Pro180–20; mean of three runs
91.4Δ 75.6
GPT-6.1 Sol190–20; mean of three runs
92.6Δ 76.7
BTTF0.7970–1; higher is more readable
95.7Δ 79.9
Human2.621–4; original rating
15.8

Views

Source code

package org.junit.internal; import static java.lang.Thread.currentThread; /** * Miscellaneous functions dealing with classes. */ public class Classes { /** * Returns Class.forName for {@code className} using the current thread's class loader. * * @param className Name of the class. * @throws ClassNotFoundException */ public static Class<?> getClass(String className) throws ClassNotFoundException { return Class.forName(className, true, currentThread().getContextClassLoader()); } }

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.277.442−9.156
Source linesThe number of non-empty source lines.18+7.2
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.633−6.949

Intercept 8.87 + feature contributions = -0.035 (log-odds).
Score = sigmoid(-0.035) = 0.491.

Score0.739

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.91+0.664
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.052+0.44
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.19+0.364
Indentation frequencyHow rapidly indentation changes from line to line.11−0.357
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.90.947−0.187
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.17.859−0.16

Intercept 0.07 + feature contributions = 1.232 (log-odds).
Score = sigmoid(1.232) = 0.774.

Score0.797
Score2
Run 1

The code is well-structured and readable. It has a clear package declaration and a single static import. The class has a single responsibility with a descriptive name. The method name and parameter are clear, and the Javadoc is concise but informative, including the @throws tag. The implementation is a single line, keeping the logic flat and direct. Action granularity is appropriate since the line performs one logical operation. The reading flow is natural, moving from documentation to implementation. Minor deductions: the method could be named more specifically (e.g., `getClassForName`), and no explicit handling or annotation for the checked exception beyond the throws clause.

Run 2

The code is highly readable. It has a clear, single-purpose class with a well-named utility method. The method body is concise, performing one logical action (class loading) on a single line without unnecessary nesting. Javadoc comments explain intent and exceptions clearly. The static import improves readability by shortening `Thread.currentThread()` to `currentThread()`. The structure is flat and logically organized, with a natural reading flow from package declaration to imports to class definition to method implementation. Minor deduction from a perfect score only because the method could be slightly more decomposed if error handling or validation were needed, but for its stated purpose it is nearly ideal.

Run 3

The code is highly readable. It uses a clear package and a single, well-named class with a single responsibility. The method is concise, has a clear name, and uses a static import to simplify the call to Thread.currentThread(). Javadoc provides clear intent and documents the exception. There is no significant nesting, and the one-line return statement keeps the action granularity appropriate for a simple wrapper. The reading flow is natural: package, imports, class, method, return.

Run 1

Code Structure: A well-organized utility class contains one clearly scoped method. Nesting: No nested control flow; the method is flat and easy to follow. Clarity of intent: Documentation and the descriptive className parameter explain the purpose, though Classes and getClass are somewhat generic names. Code length: Concise, with no unnecessary implementation. Action granularity: The single return statement performs one coherent class-loading operation; inline loader retrieval remains readable. Reading flow: Package, import, class documentation, and method appear in a natural order. Minor documentation gaps include the empty @throws description and omission of the fact that the loaded class is initialized.

Run 2

Code Structure: A focused utility class with one logically organized method. Nesting: No nested control flow; the method is flat. Clarity of intent: The method name and Javadoc clearly explain class loading, though the documentation does not mention that initialization is enabled. Code length: Minimal implementation with proportionate documentation. Action granularity: One return statement performs a single cohesive operation; the nested calls remain easy to understand. Reading flow: Conventional Java ordering and formatting make the code natural to scan.

Run 3

Code Structure: A logically organized utility class contains one focused method. Nesting: No nested control flow; the implementation is flat. Clarity of intent: Class and method documentation clearly explain the purpose, though the generic names Classes and getClass are less descriptive than alternatives such as loadClass. Code length: Compact, with no unnecessary implementation code. Action granularity: One return statement performs a single class-loading operation; inline argument expressions remain easy to follow. Reading flow: Package, import, class documentation, method documentation, and implementation appear in a natural order.