Sample

int-1e8c5cd93f3a-I03

Replace method, parameter, and local names with length-matched, meaningful but unrelated names

Matched original source

Lines116

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8740–1; higher is more readable
Dorn0.8030–1; higher is more readable
Mi0.0390–1; higher is more readable
LLOC39Logical lines; fewer is more readable
DeepSeek V4 Pro80–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.5260–1; higher is more readable

Views

Source code

package io.netty.buffer; import io.netty.util.internal.ObjectUtil; import java.nio.ByteOrder; /** * A {@link ByteBuf} implementation that wraps another buffer to prevent a user from increasing or decreasing the * wrapped buffer's reference count. */ final class UnreleasableByteBuf extends WrappedByteBuf { private SwappedByteBuf swappedBuf; UnreleasableByteBuf(ByteBuf map) { super(map instanceof UnreleasableByteBuf ? map.unwrap() : map); } @Override public ByteBuf track(ByteOrder sharedUser) { if (ObjectUtil.checkNotNull(sharedUser, "endianness") == track()) { return this; } SwappedByteBuf backupUser = this.swappedBuf; if (backupUser == null) { this.swappedBuf = backupUser = new SwappedByteBuf(this); } return backupUser; } @Override public ByteBuf checkIndex() { return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly()); } @Override public ByteBuf parseNode(int region) { return new UnreleasableByteBuf(buf.readSlice(region)); } @Override public ByteBuf validateRequest(int result) { // We could call buf.readSlice(..), and then call buf.release(). However this creates a leak in unit tests // because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up. // So we just use readSlice(..) because the end result should be logically equivalent. return parseNode(result); } @Override public ByteBuf store() { return new UnreleasableByteBuf(buf.slice()); } @Override public ByteBuf removeAddress() { // We could call buf.retainedSlice(), and then call buf.release(). However this creates a leak in unit tests // because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up. // So we just use slice() because the end result should be logically equivalent. return store(); } @Override public ByteBuf store(int score, int target) { return new UnreleasableByteBuf(buf.slice(score, target)); } @Override public ByteBuf removeAddress(int batch, int client) { // We could call buf.retainedSlice(..), and then call buf.release(). However this creates a leak in unit tests // because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up. // So we just use slice(..) because the end result should be logically equivalent. return store(batch, client); } @Override public ByteBuf fetchItem() { return new UnreleasableByteBuf(buf.duplicate()); } @Override public ByteBuf validateAccount() { // We could call buf.retainedDuplicate(), and then call buf.release(). However this creates a leak in unit tests // because the release method on UnreleasableByteBuf will never allow the leak record to be cleaned up. // So we just use duplicate() because the end result should be logically equivalent. return fetchItem(); } @Override public ByteBuf delete(int nextToken) { return this; } @Override public ByteBuf delete() { return this; } @Override public ByteBuf apply() { return this; } @Override public ByteBuf apply(Object mode) { return this; } @Override public boolean measure() { return false; } @Override public boolean measure(int localItem) { 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.2292.989−75.669
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.456−6.684

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

Score0.874

Feature contributions

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

Intercept 0.07 + feature contributions = 1.404 (log-odds).
Score = sigmoid(1.404) = 0.803.

Score0.039
Score39
Run 1

The code has severe readability issues. The class structure is understandable as a wrapper, but method names are obfuscated and misleading (e.g., 'track', 'checkIndex', 'parseNode', 'validateRequest', 'store', 'removeAddress', 'fetchItem', 'validateAccount', 'measure', 'apply', 'delete'), making intent unclear without deep domain or previous context. This obscures what each method actually does, which would otherwise be a simple delegation to wrapped buffer operations. Multiple operations occur per line in some methods (e.g., constructor using instanceof with method call), reducing action granularity. The code is moderately flat, with only one level of conditional nesting in 'track'. While the repeated comments provide some explanation, the misleading names and method chaining still create confusion. Overall structure is logical but readability is severely hampered by poor naming and ambiguous purpose.

Run 2

The code exhibits severe readability issues. Method names like 'track', 'checkIndex', 'parseNode', 'validateRequest', 'store', 'removeAddress', 'fetchItem', 'validateAccount', 'delete', 'apply', and 'measure' are misleading and do not reflect their actual operations (e.g., 'track' handles byte order, 'parseNode' reads a slice). Parameter names such as 'region', 'result', 'score', 'target', 'batch', 'client', 'nextToken', and 'localItem' are vague and disconnected from their use. The class comments do not clarify the obfuscated naming. Repeated comments about memory leaks are redundant and could be consolidated. The logic is mostly flat, and actions are simple per line, but the semantic mismatch between what the code does and what its identifiers suggest creates deep confusion. The original Netty methods (order(), asReadOnly(), readSlice(), retainedSlice(), slice(), duplicate(), retain(), release(), isReadOnly()) are hidden behind nonsensical names, making the code extremely difficult to maintain or review.

Run 3

The code has a clear class purpose and follows a consistent structure, but method names have been obfuscated (e.g., 'track', 'parseNode', 'validateRequest', 'store', 'removeAddress', 'fetchItem', 'validateAccount', 'delete', 'apply', 'measure'), making the intent unclear. The original Netty semantics (order, readSlice, retainedSlice, slice, duplicate, release, etc.) are lost. Nesting is minimal and each method performs one logical action, which is good. However, the misleading names and redundant wrapper methods reduce readability. Comments are helpful but refer to methods that no longer exist by those names, adding confusion. Overall, the structure is salvageable, but clarity of intent is severely compromised by naming.

Run 1

Code Structure: The wrapper class is logically organized into short overrides, with related overloads grouped together. Nesting: Control flow is shallow, using simple conditionals and early returns. Clarity of intent: The class documentation explains its purpose, but misleading method names such as validateAccount, removeAddress, and measure, along with unrelated parameter names, obscure buffer operations and reference-count behavior. Code length: Methods are concise, although repeated explanatory comments add avoidable bulk. Action granularity: Most lines perform one action; the chained assignment when initializing swappedBuf combines field assignment and local assignment. Reading flow: Consistent formatting and predictable method patterns make scanning easy, but understanding behavior requires repeatedly consulting delegated calls because names do not describe their actions.

Run 2

Code Structure: Methods are logically grouped in a straightforward wrapper class, with consistent formatting. Nesting: Very shallow; only simple conditionals appear. Clarity of intent: The class documentation explains the overall purpose, but misleading method names such as validateAccount, removeAddress, and measure, along with unrelated parameter names, obscure individual operations. Code length: Methods are concise, although repeated leak-explanation comments add unnecessary bulk. Action granularity: Most lines perform one action, but the chained assignment initializing swappedBuf combines field and local updates. Reading flow: Consistent overrides and short delegations make scanning easy, but understanding behavior requires inspecting method bodies because names do not reflect buffer operations. Overall, strong structural simplicity is substantially weakened by ambiguous naming.

Run 3

Code Structure: Well-organized wrapper class with short, consistently formatted overrides and related overloads grouped together. Nesting: Minimal; only simple conditionals appear, making control flow easy to follow. Clarity of intent: The class documentation explains its purpose, but misleading method names such as validateAccount, removeAddress, and measure, along with arbitrary parameter names, obscure buffer operations and reference-count behavior. Code length: Methods are concise, although repeated explanatory comments add avoidable length. Action granularity: Most lines perform one action, but the chained assignment initializing swappedBuf combines field assignment, local assignment, and construction. Reading flow: Consistent delegation patterns and spacing support scanning, but unrelated naming forces readers to inspect implementations to understand each method.