Sample
int-2791dcba2bfd-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.854 | 0–1; higher is more readable |
| Dorn | 0.497 | 0–1; higher is more readable |
| Mi | 0.584 | 0–1; higher is more readable |
| LLOC | 23 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.448 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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. | 1795.802 | −59.261 |
| Source linesThe number of non-empty source lines. | 53 | +21.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.895 | −7.343 |
Intercept 8.87 + feature contributions = -36.534 (log-odds).
Score = sigmoid(-36.534) = 0.
| Score | 0.854 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 54 | −0.876 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 97.981 | +0.776 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 43 | +0.75 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 43 | −0.566 |
| 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. | 97.981 | −0.485 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 52.848 | +0.329 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.098 | −0.012 |
Intercept 0.07 + feature contributions = -0.013 (log-odds).
Score = sigmoid(-0.013) = 0.497.
| Score | 0.584 |
|---|
| Score | 23 |
|---|
Run 1
The code is highly readable. It has a clear structure with a single-purpose class, a private constructor preventing instantiation, and well-named constants. The defaultValue method is flat, using a straightforward if-else chain for primitive types, which is easy to follow. Intent is explicit via Javadoc and method naming. Granularity is excellent, with one logical action per line. The only slight complexity is the unchecked cast and suppression annotations, but these are necessary due to Java generics and are documented. Overall, it is concise, conventional, and easy for a Java developer to understand.
Run 2
The code is well-structured with clear intent. The class has a single responsibility, and the utility method is logically organized. The primitive type checks form a flat if-else chain rather than deep nesting, aiding readability. Each return statement is concise and clearly expresses one action per line. The Javadoc and annotations provide helpful context, and the constants for DOUBLE_DEFAULT and FLOAT_DEFAULT avoid repetition. However, the long if-else chain could be slightly improved by grouping types or using a lookup map, and the unchecked cast pattern, while documented, requires careful reading. Overall, the code is highly readable with minor room for structural optimization.
Run 3
The code is well-structured with clear purpose and excellent documentation. The class and method names are self-explanatory (Defaults, defaultValue), and the Javadoc clearly explains what the method does. The logic is straightforward: check for primitive types and return appropriate default values. While there is a chain of else-if statements for type checking, this is a common pattern for type-based dispatch and remains readable since each branch handles a single type. The constants for DOUBLE_DEFAULT and FLOAT_DEFAULT are appropriately used to avoid magic numbers. The nesting level is shallow (two levels maximum). Each action is on its own line, making the flow easy to follow. The private constructor properly prevents instantiation of this utility class. The suppression annotations are documented with a comment explaining why BooleanLiteral warning is suppressed. Overall, this demonstrates clean, maintainable code that follows good practices for utility classes.
Run 1
Code Structure: A focused utility class with logically grouped constants and a single clearly defined method. Nesting: Shallow overall, though the primitive check adds a nesting level around the conditional chain. Clarity of intent: Descriptive names and precise documentation explain default values, including null for reference types and void; generic casts add minor complexity. Code length: Appropriately concise, with some repetitive but understandable type checks. Action granularity: Each statement performs one clear action, making validation and returns easy to follow. Reading flow: The method progresses naturally from null validation to primitive-type handling and a final null fallback. Minor drawbacks are the lengthy else-if chain and limited visual separation between the package and imports.
Run 2
Code Structure: A focused utility class with a single public method, clearly separated constants, and a private constructor. Nesting: Only two levels deep; the primitive guard adds modest nesting, while the else-if chain remains easy to follow. Clarity of intent: Descriptive names and precise Javadoc explain default values, including null for reference types and void. Generic casts and suppression annotations introduce minor complexity. Code length: Appropriately concise, though primitive cases repeat a similar pattern. Action granularity: Each statement performs one clear action, with validation and returns on separate lines. Reading flow: Validation, primitive checks, and the null fallback form a natural sequence. Minor formatting limitations, such as missing separation between the package and imports, slightly reduce polish.
Run 3
Code Structure: A focused utility class with logically organized constants and a single public method. Nesting: Only two conditional levels, though an early return for non-primitive types could flatten the method. Clarity of intent: Descriptive names and precise documentation clearly explain default values, including null for reference types and void. Code length: Appropriately concise; the repetitive conditional chain is justified by explicit handling of each primitive type. Action granularity: Each statement performs one clear action, with checks and returns separated. Reading flow: Validation, primitive-type dispatch, and the null fallback follow a natural sequence. Minor readability costs come from repeated generic casts, the long else-if chain, and tightly spaced package/import declarations.