Sample

int-43a88a1523d1-I01

Remove line comments, block comments, and Javadoc

Matched original source

Lines116

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8470–1; higher is more readable
Dorn0.780–1; higher is more readable
Mi0.3480–1; higher is more readable
LLOC39Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6580–1; higher is more readable

Views

Source code

package io.netty.buffer; import io.netty.util.internal.ObjectUtil; import java.nio.ByteOrder; final class UnreleasableByteBuf extends WrappedByteBuf { private SwappedByteBuf swappedBuf; UnreleasableByteBuf(ByteBuf buf) { super(buf instanceof UnreleasableByteBuf ? buf.unwrap() : buf); } @Override public ByteBuf order(ByteOrder endianness) { if (ObjectUtil.checkNotNull(endianness, "endianness") == order()) { return this; } SwappedByteBuf swappedBuf = this.swappedBuf; if (swappedBuf == null) { this.swappedBuf = swappedBuf = new SwappedByteBuf(this); } return swappedBuf; } @Override public ByteBuf asReadOnly() { return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly()); } @Override public ByteBuf readSlice(int length) { return new UnreleasableByteBuf(buf.readSlice(length)); } @Override public ByteBuf readRetainedSlice(int length) { return readSlice(length); } @Override public ByteBuf slice() { return new UnreleasableByteBuf(buf.slice()); } @Override public ByteBuf retainedSlice() { return slice(); } @Override public ByteBuf slice(int index, int length) { return new UnreleasableByteBuf(buf.slice(index, length)); } @Override public ByteBuf retainedSlice(int index, int length) { return slice(index, length); } @Override public ByteBuf duplicate() { return new UnreleasableByteBuf(buf.duplicate()); } @Override public ByteBuf retainedDuplicate() { return duplicate(); } @Override public ByteBuf retain(int increment) { return this; } @Override public ByteBuf retain() { return this; } @Override public ByteBuf touch() { return this; } @Override public ByteBuf touch(Object hint) { return this; } @Override public boolean release() { return false; } @Override public boolean release(int decrement) { return false; } }

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.2218.293−73.204
Source linesThe number of non-empty source lines.116+46.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.27−6.405

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

Score0.847

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.116+3.275
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.116−3.071
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.115.583+1.206
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.82.897+0.154
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.093+0.04

Intercept 0.07 + feature contributions = 1.268 (log-odds).
Score = sigmoid(1.268) = 0.78.

Score0.348
Score39
Run 1

The code demonstrates good readability with clear class structure and intent. The purpose of each method is straightforward - making a ByteBuf unreleasable while maintaining standard buffer operations. Nesting is shallow with only one level of conditional logic in the order() method. Action granularity is excellent with single operations per line. The methods are concise and follow predictable patterns. However, there are minor issues: the empty comment blocks and multiple blank lines create visual noise. The order() method slightly violates the single responsibility principle by handling null checks, order comparison, and cache initialization together. The repeated pattern of wrapping returned buffers could be extracted to a helper method to reduce duplication. Reading flow is generally natural, though the empty comments in retainedSlice/readRetainedSlice/retainedDuplicate methods are distracting and unclear in purpose. Overall, the code is well-structured and readable but could benefit from removing unnecessary comments and minor refactoring.

Run 2

The code is generally well-structured and readable. It follows a logical class hierarchy and maintains flat nesting throughout. Method names clearly express intent, and each method performs a single action. The use of a lazy-initialized SwappedByteBuf is a clear, common pattern. However, readability is slightly reduced by the presence of empty multi-line comments in several methods (e.g., readRetainedSlice, retainedSlice, retainedDuplicate), which are ambiguous and break reading flow. These comments appear to be intentional placeholders or suppression markers, but without context they create visual noise. The constructor's ternary operation is concise but slightly reduces immediate clarity. Overall, the code is maintainable and easy to follow, with only minor stylistic inconsistencies.

Run 3

The code is highly readable with clear, logical structure and flat nesting. Each method performs a single, well-defined action, maintaining one action per line. The class purpose is evident: wrapping a ByteBuf to prevent reference counting operations. Methods like retain(), release(), and touch() are concise no-ops that clearly communicate intent. The order() method demonstrates good lazy initialization pattern without excessive nesting. One minor issue is the repeated pattern of three empty comment lines in readRetainedSlice(), retainedSlice(), and retainedDuplicate() methods, which slightly disrupts reading flow. The constructor's conditional unwrapping logic is slightly dense but acceptable given its brevity. Overall, the code is clean, maintainable, and follows good practices for wrapper class design in Java.

Run 1

Code Structure: Methods are logically grouped around byte ordering, buffer views, and reference-count operations. Nesting: Control flow is shallow, with simple conditionals and early returns. Clarity of intent: The class name and consistent overrides clearly convey an unreleasable wrapper, although retained methods delegating to non-retained variants and no-op reference-count methods would benefit from brief explanations. Code length: Most methods are concise; repetition largely follows the interface, but excessive blank lines add unnecessary length. Action granularity: Most lines perform one action, though the chained assignment in order() combines local assignment, field assignment, and object creation. Reading flow: Consistent formatting and predictable delegation make the code easy to follow, with minor interruptions from whitespace and the local variable shadowing swappedBuf.

Run 2

Code Structure: Methods are logically organized in a cohesive wrapper class, with related operations grouped together. Nesting: Control flow is shallow, using simple conditionals and direct returns. Clarity of intent: Class and method names clearly convey an unreleasable buffer wrapper, although the retained-operation delegation and no-op reference-counting methods could benefit from brief explanations. Code length: Methods are concise; repetitive overrides are appropriate for the wrapper interface, but excessive blank lines add unnecessary length. Action granularity: Most lines perform one action, though the chained assignment in order() combines local and field updates, and null validation is embedded in a comparison. Reading flow: Consistent signatures and straightforward delegation make the class easy to scan, with minor interruptions from whitespace and local variable shadowing.

Run 3

Code Structure: Methods are logically grouped around buffer views and reference-counting operations, with consistent overrides. Nesting: Control flow is shallow, using simple conditionals and early returns. Clarity of intent: The class name and no-op retain/release methods communicate an unreleasable wrapper, though retained-view behavior and swapped-buffer caching could benefit from brief explanations. Code length: Methods are concise; repetition largely reflects the overridden API, but excessive blank lines unnecessarily expand the code. Action granularity: Most lines perform one action, except the chained assignment in order(), which combines cache initialization and local assignment. Reading flow: Consistent method formatting and related-method grouping make scanning natural, while local field-name shadowing and irregular whitespace introduce minor friction.