Sample

int-73b91471e4ef-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines61

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7970–1; higher is more readable
Dorn0.7440–1; higher is more readable
Mi0.0440–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro110–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.6450–1; higher is more readable

Views

Source code

package io.netty.channel.uring; final class RingBuffer { private final SubmissionQueue ioUringSubmissionQueue; private final CompletionQueue ioUringCompletionQueue; private final int features; private boolean closed; RingBuffer(SubmissionQueue ioUringSubmissionQueue, CompletionQueue ioUringCompletionQueue, int features) { this.ioUringSubmissionQueue = ioUringSubmissionQueue; this.ioUringCompletionQueue = ioUringCompletionQueue; this.features = features; } /** * Enable ring. This method must be called from the same method that will call {@link SubmissionQueue#submit()} and * {@link SubmissionQueue#submitAndWait()}. */ void enable() { // We create our ring in disabled mode and so need to enable it first. Native.ioUringRegisterEnableRings(fd()); // Now also register the ring filedescriptor itself. This needs to happen in the same thread // that will also call the io_uring_enter(...) ioUringSubmissionQueue.tryRegisterRingFd(); } int fd() { return ioUringCompletionQueue.ringFd; } int features() { return features; } SubmissionQueue ioUringSubmissionQueue() { return this.ioUringSubmissionQueue; } CompletionQueue ioUringCompletionQueue() { return this.ioUringCompletionQueue; } void close() { if (!((closed))) {} else { return; } closed = true; ioUringSubmissionQueue.close(); ioUringCompletionQueue.close(); Native.ioUringExit( ioUringSubmissionQueue.submissionQueueArrayAddress(), ioUringSubmissionQueue.ringEntries, ioUringSubmissionQueue.ringAddress, ioUringSubmissionQueue.ringSize, ioUringCompletionQueue.ringAddress, ioUringCompletionQueue.ringSize, ioUringSubmissionQueue.ringFd, ioUringSubmissionQueue.enterRingFd); } }

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.1120.338−36.971
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.366−6.549

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

Score0.797

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.118.968−1.374
Indentation frequencyHow rapidly indentation changes from line to line.55+1.165
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.119+1.116
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.60.9+0.441
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.055+0.408
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398

Intercept 0.07 + feature contributions = 1.065 (log-odds).
Score = sigmoid(1.065) = 0.744.

Score0.044
Score26
Run 1

The code is generally well-structured with clear class organization and method separation. However, several issues hurt readability. The `close()` method contains awkward logic (`if (!((closed))) {} else { return; }`) which should be a simple early return. Variable naming is verbose but clear. There's a missing space in the comment 'filedescriptor'. The code is mostly flat with minimal nesting, and actions are appropriately granularized per line. The `enable()` method has a clear purpose with good comments explaining the ordering constraints. The constructor and getters are straightforward. Overall, the code is approachable but the convoluted close guard and redundant parentheses reduce clarity. It would benefit from cleaner boolean logic and minor comment fixes.

Run 2

The code is structured reasonably well with clear class organization and method separation, but falls short in readability due to several issues. The close() method's condition `if (!((closed))) {} else { return; }` is unnecessarily convoluted and hard to parse. The class fields have verbose names (ioUringSubmissionQueue, ioUringCompletionQueue) that add clarity but hurt conciseness. Native method calls contain many parameters, making lines long and difficult to follow. While methods are short and focused (good granularity), the enable() method mixes concerns (registering rings and registering FD). The overall flow is acceptable but the conditional logic in close() breaks natural reading flow. Comments are helpful but could be more concise. The code demonstrates reasonable organization but would benefit from simplification of the boolean logic, shorter variable names, and breaking down the long Native method calls.

Run 3

The code has some positive aspects: short class, clear field names, and mostly one action per line. However, several issues harm readability. The close() method has a bizarre, inverted conditional with an empty if-block and an else-block with the actual logic — this is a confusing anti-pattern that obscures intent. The method's long Native.ioUringExit call with 8 arguments creates a dense, hard-to-scan block. The variable names ioUringSubmissionQueue and ioUringCompletionQueue are repeated excessively, making lines long. The constructor parameters shadow field names, but this is acceptable in Java. The enable() method has an unclear ordering comment that does not fully explain why the ring fd must be registered in the same thread. The class lacks a clear separation between lifecycle methods and simple accessors, though this is minor. Overall, the code is functional but needs cleanup to be easily understood by another developer.

Run 1

Code Structure: Fields, constructor, accessors, and lifecycle methods are logically organized. Nesting: Mostly flat, but close() uses an awkward empty conditional with an else-return instead of a simple guard clause. Clarity of intent: Descriptive names and comments explain ring initialization and cleanup, although the redundant parentheses and negation around closed obscure a straightforward check. The enable() documentation also says 'same method' while its comment says 'same thread,' introducing ambiguity. Code length: Compact overall, with minor verbosity in names and the conditional. Action granularity: Statements generally perform one action each, and the long native call presents one argument per line. Reading flow: Natural initialization-to-cleanup progression, interrupted mainly by the unusual close() guard and the positional native-call arguments.

Run 2

Code Structure: Fields, constructor, accessors, and lifecycle methods are logically organized. Nesting: Mostly flat, but close() introduces an unnecessary empty branch and else instead of a simple guard clause. Clarity of intent: Descriptive names and comments explain ring operations, although redundant parentheses around closed obscure a straightforward check, and the enable() documentation says 'same method' while its comment says 'same thread.' Code length: Concise overall; repetitive queue names and the long native-call argument list add some visual bulk. Action granularity: Most lines perform one action, with native-call arguments clearly separated; the inline empty branch is awkward. Reading flow: Generally natural and easy to follow, but the unusual close() condition interrupts the flow.

Run 3

Code Structure: Well-organized class with constructor, initialization, accessors, and cleanup clearly separated. Nesting: Mostly flat, although close() uses an awkward empty if branch and else-return instead of a straightforward guard clause. Clarity of intent: Descriptive names and comments explain ring initialization, but redundant parentheses obscure the closed check, and the enable() documentation says 'same method' while the comment specifies 'same thread.' Code length: Concise overall, with minor unnecessary syntax in close(). Action granularity: Most lines perform one action; the long native cleanup call is sensibly split across lines. Reading flow: Methods follow a natural lifecycle-oriented progression, but the unusual close() condition interrupts comprehension, and the positional native-call arguments require attention.