Sample
int-b163199e94ff-I13
Lower every eligible classic and enhanced for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Scalabrino | 0.642 | 0–1; higher is more readable |
| Dorn | 0.424 | 0–1; higher is more readable |
| Mi | 0.055 | 0–1; higher is more readable |
| LLOC | 21 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.488 | 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. | 2345.937 | −77.416 |
| Source linesThe number of non-empty source lines. | 61 | +24.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.633 | −6.949 |
Intercept 8.87 + feature contributions = -51.095 (log-odds).
Score = sigmoid(-51.095) = 0.
| Score | 0.642 |
|---|
Feature contributions
| Feature | Value | Contribution (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. | 117.952 | −1.331 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 56 | +1.2 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 62 | −1.159 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 117.871 | +1.097 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 56 | −0.864 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 60.857 | +0.441 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.072 | +0.239 |
Intercept 0.07 + feature contributions = -0.306 (log-odds).
Score = sigmoid(-0.306) = 0.424.
| Score | 0.055 |
|---|
| Score | 21 |
|---|
Run 1
The code is well-structured and highly readable. It is organized logically with clear separation of concerns: one public helper method, one private overloaded method, and a small wrapper. Nesting is minimal, with only one level of try-catch inside an if-block. Intent is clear from method names and comments; the Javadoc explains the rationale for using SelectorProvider directly. Code length is appropriate, with no unnecessary repetition. Action granularity is generally good, with one operation per line, although method.invoke and assignment are combined in one line, which slightly reduces readability. Reading flow is natural, moving from version check to method resolution to invocation. Error handling is concise and consistent. Overall, the code is easy to follow, well-documented, and maintains a clean separation of logic, with only minor room for improvement in granularity of the reflective call.
Run 2
The code demonstrates good structure and readability with clear separation of public and private methods. It uses early returns effectively, avoiding deep nesting. The intent of each method is clear - finding reflection methods, creating channels, and handling protocol families. Method names are descriptive and follow standard Java conventions. The code is concise without being overly compressed. One minor issue is that the newDomainSocketChannel method uses `StandardProtocolFamily.valueOf("UNIX")` which could be a constant for better clarity. The reflection usage with generics and type casting adds slight complexity, but it's handled with appropriate warnings suppression. Overall, the flat structure, clear error handling, and logical organization make this code highly readable for systems-level Java code.
Run 3
The code is well-structured and highly readable. It has a clear single responsibility: finding and invoking SelectorProvider methods. The nesting is minimal, with only one or two levels in conditional blocks and try-catch statements. Intent is clearly expressed through descriptive method names and concise Javadoc explaining the rationale. Code length is appropriate—no unnecessary verbosity. Each line generally performs a single action, especially in the reflective invocation logic. The reading flow is natural, progressing from method lookup to invocation helpers. The use of helper methods avoids duplication and keeps the public API clean. Minor deductions for the slight indirection between newChannel overloads and the reliance on reflection (though unavoidable here), but overall this is exceptionally clear, maintainable code.
Run 1
Code Structure: A focused utility class with logically separated method discovery, channel creation, and protocol-family conversion. Nesting: Shallow overall, with only modest if/try nesting. Clarity of intent: Descriptive names and a rationale comment help, though reflection, generic casts, and null-based fallback behavior require interpretation. Code length: Concise, with little unnecessary code. Action granularity: Statements generally perform one action per line; compact delegation remains easy to follow. Reading flow: Methods progress naturally from discovery to creation and specialized wrappers. Minor distractions include inconsistent parameter indentation, missing spacing between package and imports, and an awkwardly worded comment.
Run 2
Code Structure: A focused utility class with small, logically separated methods and a private constructor. Nesting: Shallow overall, with only straightforward conditionals containing try/catch blocks. Clarity of intent: Descriptive names and a contextual comment explain channel creation, though reflection, generic casts, null-based fallbacks, and the Object family parameter require extra interpretation. Code length: Concise, with little unnecessary code. Action granularity: Statements generally perform one action per line, making execution easy to follow. Reading flow: Method discovery leads naturally into channel creation helpers and specialized wrappers. Minor drawbacks include uneven continuation indentation, tightly grouped imports, and a comment whose wording could explain the optimization more clearly.
Run 3
Code Structure: A focused utility class with small, logically separated methods and a private constructor. Nesting: Shallow overall, with only simple conditionals around try/catch blocks. Clarity of intent: Descriptive method names and a rationale comment explain channel creation, although reflective invocation, generic casts, and null-based fallback behavior require extra interpretation. Code length: Concise, with little duplication or unnecessary code. Action granularity: Statements generally perform one action per line, making operations easy to distinguish. Reading flow: Method discovery precedes channel creation helpers, providing a natural progression. Minor distractions include inconsistent continuation indentation, densely grouped imports, and an awkwardly worded comment. Overall, readable and well organized despite the inherent complexity of reflection.