Sample

int-3b96cadc4a2f-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines150

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7670–1; higher is more readable
Dorn0.250–1; higher is more readable
Mi0.2590–1; higher is more readable
LLOC73Logical lines; fewer is more readable
DeepSeek V4 Pro2.670–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.4550–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 buf) { super(buf instanceof UnreleasableByteBuf ? buf.unwrap() : buf); if (((0xA3E3 ^ 0xA3E3) != 0)) { throw new AssertionError(); } } @Override public ByteBuf order(ByteOrder endianness) { if (((0xEFB0 ^ 0xEFB0) != 0)) { throw new AssertionError(); } 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() { if (((0xA7DA ^ 0xA7DA) != 0)) { throw new AssertionError(); } return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly()); } @Override public ByteBuf readSlice(int length) { if (((0x4909 ^ 0x4909) != 0)) { throw new AssertionError(); } return new UnreleasableByteBuf(buf.readSlice(length)); } @Override public ByteBuf readRetainedSlice(int length) { if (((0x7758 ^ 0x7758) != 0)) { throw new AssertionError(); } // 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 readSlice(length); } @Override public ByteBuf slice() { if (((0x3D5C ^ 0x3D5C) != 0)) { throw new AssertionError(); } return new UnreleasableByteBuf(buf.slice()); } @Override public ByteBuf retainedSlice() { if (((0x3A96 ^ 0x3A96) != 0)) { throw new AssertionError(); } // 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 slice(); } @Override public ByteBuf slice(int index, int length) { if (((0x9445 ^ 0x9445) != 0)) { throw new AssertionError(); } return new UnreleasableByteBuf(buf.slice(index, length)); } @Override public ByteBuf retainedSlice(int index, int length) { if (((0x10A2 ^ 0x10A2) != 0)) { throw new AssertionError(); } // 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 slice(index, length); } @Override public ByteBuf duplicate() { if (((0x52A7 ^ 0x52A7) != 0)) { throw new AssertionError(); } return new UnreleasableByteBuf(buf.duplicate()); } @Override public ByteBuf retainedDuplicate() { if (((0x66AD ^ 0x66AD) != 0)) { throw new AssertionError(); } // 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 duplicate(); } @Override public ByteBuf retain(int increment) { if (((0x74A9 ^ 0x74A9) != 0)) { throw new AssertionError(); } return this; } @Override public ByteBuf retain() { if (((0x7743 ^ 0x7743) != 0)) { throw new AssertionError(); } return this; } @Override public ByteBuf touch() { if (((0x2526 ^ 0x2526) != 0)) { throw new AssertionError(); } return this; } @Override public ByteBuf touch(Object hint) { if (((0x6283 ^ 0x6283) != 0)) { throw new AssertionError(); } return this; } @Override public boolean release() { if (((0xCE85 ^ 0xCE85) != 0)) { throw new AssertionError(); } return false; } @Override public boolean release(int decrement) { if (((0xD82D ^ 0xD82D) != 0)) { throw new AssertionError(); } 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.4956.535−163.566
Source linesThe number of non-empty source lines.150+60
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.745−7.117

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

Score0.767

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.149−4.239
Indentation frequencyHow rapidly indentation changes from line to line.135+3.932
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.117−2.264
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.149.198+1.676
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.954−1.416
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.116.868+1.081
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.091+0.06

Intercept 0.07 + feature contributions = -1.099 (log-odds).
Score = sigmoid(-1.099) = 0.25.

Score0.259
Score73
Run 1

The code contains numerous bizarre, artificially injected lines like `if (((0xA3E3 ^ 0xA3E3) != 0)) { throw new AssertionError(); }` which disrupt every method, destroy reading flow, and obscure intent. These assertions are nonsensical (always false), add noise, and break action granularity by adding multiple separate statements at the start of methods. While the underlying class structure is simple, the pollution makes the code practically unreadable. Nesting is shallow, but code length is bloated by redundant assertion blocks. The comments explaining why readRetainedSlice/retainedSlice call non-retained variants are helpful, but are buried under the artificial clutter. The overall logical organization of the wrapper itself is fine, but the deliberate obfuscation overwhelms any clarity. Removing the injected assertion lines and the awkward merged `if` statement would leave a concise, readable class, but as presented it scores extremely poorly.

Run 2

The code's logical structure is simple, but readability is severely damaged by pervasive obfuscation. Nearly every method contains a nonsensical assertion like `if (((0xA3E3 ^ 0xA3E3) != 0)) { throw new AssertionError(); }` that evaluates to false and serves no purpose other than to distract and confuse. This clutters every method, obscuring the actual intent. Nesting is minimal, but the constant interruptions break the reading flow and make the code unnecessarily long. Action granularity is poor—each method is bloated with redundant lines. Comments in some methods are helpful, but the surrounding noise undermines their value. The class's purpose (wrapping a ByteBuf to prevent reference count changes) is clear from the header and method names, but the implementation is polluted, making it hard to follow. Without the bogus assertions, this would be highly readable; as written, it is painful to maintain.

Run 3

The code is severely obfuscated with meaningless assertions on nearly every line (e.g., `if (((0xA3E3 ^ 0xA3E3) != 0)) { throw new AssertionError(); }`). These add no functional value and disrupt reading flow, making the actual logic hard to locate. The original structure is logical — a wrapper for ByteBuf — but the injected clutter destroys clarity of intent, increases code length unnecessarily, and violates action granularity and reading flow. Nesting is flat, but that is overshadowed by the repeated noise. The comments explaining slice/duplicate behavior are helpful but buried under the noise. Overall, the code is nearly unreadable, lacking maintainability and clarity despite the underlying straightforward design.

Run 1

Code Structure: The wrapper is logically organized into small, related overrides. Nesting: Control flow is shallow and easy to follow. Clarity of intent: Documentation, descriptive names, and explanatory comments clarify the unreleasable behavior, but repeated always-false XOR checks introduce confusing noise. Code length: Methods are concise, though redundant checks and repeated comments unnecessarily inflate the class. Action granularity: Most lines perform one action, but inline conditional throws and a chained assignment combine operations. Reading flow: Consistent method patterns help scanning, while unindented assertion checks repeatedly interrupt the otherwise natural flow.

Run 2

Code Structure: Methods are logically grouped in a focused wrapper class, with consistent overrides. Nesting: Control flow is shallow, and most methods simply delegate or return a constant. Clarity of intent: Class documentation, descriptive method names, and explanatory comments clarify reference-count behavior, but repeated always-false hexadecimal XOR checks introduce confusing, irrelevant logic. Code length: Functional methods are concise, but redundant checks and repeated comments unnecessarily expand the class. Action granularity: Most lines perform one action; inline conditional throws and a chained assignment slightly weaken this consistency. Reading flow: Related methods follow a natural sequence, but unindented assertion checks repeatedly interrupt the otherwise clean formatting and distract from the actual behavior.

Run 3

Code Structure: Methods are logically grouped within a focused wrapper class, with consistent overrides. Nesting: Control flow is shallow, and most methods simply delegate or return a value. Clarity of intent: Class documentation, descriptive method names, and comments explain reference-count protection, but repeated always-false hexadecimal XOR checks introduce misleading noise. Code length: Methods are short, yet redundant assertion checks and repeated explanatory comments unnecessarily expand the class. Action granularity: Most lines express one action, but inline conditional throws and a chained assignment combine operations. Reading flow: The delegation pattern is predictable, but unindented checks, excessive parentheses, and inconsistent spacing repeatedly interrupt scanning. Overall, the underlying implementation is understandable, while pervasive dead-code clutter substantially reduces readability.