Sample

int-4d3ae8ae49d0-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines119

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.8770–1; higher is more readable
Dorn0.4460–1; higher is more readable
Mi0.850–1; higher is more readable
LLOC49Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.4230–1; higher is more readable

Views

Source code

package io.netty.buffer; import java.nio.ByteBuffer; /** * Abstract base class for {@link ByteBuf} implementations that wrap another * {@link ByteBuf}. * * @deprecated Do not use. */ @Deprecated public abstract class AbstractDerivedByteBuf extends AbstractByteBuf { protected AbstractDerivedByteBuf(int maxCapacity) { super(maxCapacity); } @Override final boolean isAccessible() { return isAccessible0(); } boolean isAccessible0() { return unwrap().isAccessible(); } @Override public final int refCnt() { return refCnt0(); } int refCnt0() { { int runningTotal = 0; for (int currentNumber = 1; currentNumber <= 5; currentNumber++) { runningTotal += currentNumber; } } return unwrap().refCnt(); } @Override public final ByteBuf retain() { return retain0(); } ByteBuf retain0() { unwrap().retain(); return this; } @Override public final ByteBuf retain(int increment) { return retain0(increment); } ByteBuf retain0(int increment) { unwrap().retain(increment); return this; } @Override public final ByteBuf touch() { return touch0(); } ByteBuf touch0() { unwrap().touch(); return this; } @Override public final ByteBuf touch(Object hint) { return touch0(hint); } ByteBuf touch0(Object hint) { unwrap().touch(hint); return this; } @Override public final boolean release() { return release0(); } boolean release0() { return unwrap().release(); } @Override public final boolean release(int decrement) { return release0(decrement); } boolean release0(int decrement) { return unwrap().release(decrement); } @Override public boolean isReadOnly() { return unwrap().isReadOnly(); } @Override public ByteBuffer internalNioBuffer(int index, int length) { return nioBuffer(index, length); } @Override public ByteBuffer nioBuffer(int index, int length) { return unwrap().nioBuffer(index, length); } @Override public boolean isContiguous() { return unwrap().isContiguous(); } }

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.2390.912−78.9
Source linesThe number of non-empty source lines.119+47.6
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.409−6.614

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

Score0.877

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.120−3.212
Indentation frequencyHow rapidly indentation changes from line to line.114+3.206
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.114−2.195
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.118.649+1.249
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.75.967+0.448
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.67.175+0.279
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.103−0.061

Intercept 0.07 + feature contributions = -0.217 (log-odds).
Score = sigmoid(-0.217) = 0.446.

Score0.85
Score49
Run 1

The code is generally readable and well-structured, with clear method delegation patterns and consistent naming conventions. It follows a flat hierarchy with minimal nesting, and each method performs one clear action. However, there is a significant issue: a stray block of code (a for loop calculating a running total) appears inside the refCnt0() method, which is completely unrelated to the surrounding logic and disrupts the reading flow. This appears to be an accidental paste or merge error. Excluding that anomaly, the code demonstrates good practices such as final methods delegating to overrideable '0' suffixed methods, clear Javadoc, and appropriate use of @Deprecated and @Override annotations. The length is appropriate for the functionality.

Run 2

The code is generally well-structured and follows a consistent pattern, but it contains a stray, unrelated code block inside refCnt0() that breaks the logical flow and severely hurts readability. The class structure is clear with logical method organization, and most methods are flat and follow a one-action-per-line pattern. However, the misplaced loop block is confusing and appears to be an accidental insertion, making the intent ambiguous at that point. Method naming and delegation patterns are clear, but the error significantly impacts the reading flow. Without the stray block, the code would score higher due to its clean delegation pattern and consistent style.

Run 3

The code demonstrates a clear, consistent structure with a logical pattern of delegation methods. Most methods are flat with minimal nesting. The class purpose is clear: it provides a base for derived ByteBuf implementations that delegate to an underlying buffer. Method names like retain0, refCnt0, and isAccessible0 indicate intent well. Action granularity is mostly one action per line. However, readability is significantly reduced by an extraneous, non-functional code block containing a loop (runningTotal) that appears to be accidental and has no relation to the class's purpose, disrupting reading flow. The class is concise overall, with minimal repetition beyond the delegation pattern. The deprecated annotation and Javadoc are helpful. Without the extraneous block, this would score higher, as the delegation pattern is clean and consistent.

Run 1

Code Structure: Methods are logically organized around delegation to the wrapped buffer, but refCnt0 contains an unrelated computation. Nesting: Most methods are flat; the unnecessary block and loop in refCnt0 introduce avoidable nesting. Clarity of intent: Descriptive method names and class documentation make the wrapper purpose clear, though the unused runningTotal obscures intent and the 0-suffixed helper names are less informative. Code length: Methods are concise individually, but repetitive forwarding layers and the irrelevant loop add length. Action granularity: Statements generally perform one action per line. Reading flow: Consistent override/helper pairs and formatting support predictable reading, except for the poorly indented block in refCnt0, which interrupts the otherwise natural flow.

Run 2

Code Structure: Methods are logically grouped around delegation to the wrapped buffer, but refCnt0 contains an unrelated calculation block. Nesting: Most methods are flat; the unnecessary block and loop introduce localized nesting. Clarity of intent: Method names and delegation clearly communicate purpose, although the unused runningTotal calculation is distracting and unexplained. Code length: Individual methods are concise, but repeated forwarding methods add verbosity, and the calculation adds needless length. Action granularity: Statements generally perform one action per line, with a conventional loop header. Reading flow: Consistent method patterns and annotations support natural scanning, but the poorly indented block in refCnt0 abruptly interrupts that flow.

Run 3

Code Structure: Methods are logically organized around delegation to the wrapped buffer, but refCnt0() contains an unrelated calculation block. Nesting: Most methods are flat; the unnecessary block and loop introduce avoidable nesting. Clarity of intent: Documentation, method names, and consistent delegation make the class purpose clear, while the unused runningTotal calculation is confusing. Code length: Methods are concise individually, though repeated wrapper/helper pairs add boilerplate and the unrelated loop adds needless length. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: Consistent method patterns support predictable reading, but the poorly indented calculation block abruptly disrupts that flow.