Sample

int-eb7152c0f179-I10

Remove about 40% of line-break groups while retaining structure

Matched original source

Lines46

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6550–1; higher is more readable
Dorn0.0190–1; higher is more readable
Mi0.0050–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro6.670–20; mean of three runs
GPT-6.1 Sol110–20; mean of three runs
BTTF0.3570–1; higher is more readable

Views

Source code

package io.netty.handler.codec.quic; import io.netty.util.concurrent.FastThreadLocal; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.nio.ByteBuffer; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Arrays; final class Hmac { private static final String ALGORITHM = "HmacSHA256"; // Two independent keys so that CID signing and reset-token signing are // cryptographically decoupled: an observer cannot derive one output from // the other even when both use the same input value (RFC 9000 §21.11). private static final byte[] CID_KEY = new byte[32]; private static final byte[] TOKEN_KEY = new byte[32]; static { SecureRandom rng = new SecureRandom(); rng.nextBytes(CID_KEY); rng.nextBytes(TOKEN_KEY); } private static final FastThreadLocal<Mac> CID_MACS = new FastThreadLocal<Mac>() { @Override protected Mac initialValue() { return newMac(CID_KEY); } }; private static final FastThreadLocal<Mac> TOKEN_MACS = new FastThreadLocal<Mac>() { @Override protected Mac initialValue() { return newMac(TOKEN_KEY); } }; private static Mac newMac(byte[] key) { try { SecretKeySpec keySpec = new SecretKeySpec(key, ALGORITHM); Mac mac = Mac.getInstance(ALGORITHM); mac.init(keySpec); return mac; } catch (NoSuchAlgorithmException | InvalidKeyException exception) { throw new IllegalStateException(exception); } } private static ByteBuffer sign(Mac mac, ByteBuffer input, int outLength) { mac.reset(); mac.update(input); byte[] signBytes = mac.doFinal(); if (signBytes.length != outLength) { signBytes = Arrays.copyOf(signBytes, outLength); } return ByteBuffer.wrap(signBytes); } static ByteBuffer signCid(ByteBuffer input, int outLength) { return sign(CID_MACS.get(), input, outLength); } static ByteBuffer signToken(ByteBuffer input, int outLength) { return sign(TOKEN_MACS.get(), input, outLength); } private Hmac() { } }

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.2518.573−83.113
Source linesThe number of non-empty source lines.46+18.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.5.016−7.524

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

Score0.655

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.253.979−7.092
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.254+3.294
Indentation frequencyHow rapidly indentation changes from line to line.43+0.75
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.47−0.628
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.43−0.566
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.45.824+0.231
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.095+0.022

Intercept 0.07 + feature contributions = -3.919 (log-odds).
Score = sigmoid(-3.919) = 0.019.

Score0.005
Score31
Run 1

The code has a clear purpose (HMAC helper) and uses some good practices like comments and static constants, but it is severely undermined by formatting and structural issues. Multiple statements are crammed onto single lines, and unrelated class members (like the FastThreadLocal anonymous classes) are tangled together, hurting logical organization and reading flow. Deeply nested anonymous classes, combined with horizontal crowding, make the code hard to follow. Although individual methods are short, the intentional compression to save vertical space reduces clarity. The comment explaining key separation is helpful, but it does not compensate for the inconsistent indentation and lack of whitespace between logical blocks.

Run 2

The code has mixed readability. It has clear intent with comments and separates concerns, but the formatting severely hurts readability: multiple statements are crammed onto single lines, try-catch blocks are compressed, indentation is inconsistent, and thread-local anonymous class declarations are hard to parse. Variable names like CID_KEY and TOKEN_KEY are clear, and methods are logically organized, but the overall structure feels tangled and dense. Action granularity is low in many places, making the code harder to scan. The use of static final fields and separation of signing routes is good, but the presentation forces the reader to work hard to extract meaning. Overall, it's functional but not cleanly formatted.

Run 3

The code is poorly readable due to several significant issues. Multiple statements are crammed onto single lines, especially in the static initializers and catch blocks, making it hard to follow. There is inconsistent indentation and spacing (e.g., fields with odd alignment vs inline thread locals). Nested or multi-action lines hide logic — for example, the sign() method has a conditional and copy operation all on one line. The FastThreadLocal anonymous classes are compressed, harming clarity. Imports are jumbled with a class declaration after them on the same line, a major structural flaw. Method bodies lack whitespace around logical blocks, and the single-line if and catch blocks reduce readability, especially for error handling. While names and some comments are helpful, the overall structure, formatting, and action granularity severely undercut the readability.

Run 1

1. Code Structure: Logically organized around key initialization, thread-local MAC instances, and shared signing helpers, but cramped formatting obscures boundaries. 2. Nesting: Shallow overall; anonymous classes and try/catch introduce manageable nesting. 3. Clarity of intent: Descriptive names, a clear algorithm constant, and the key-separation comment make the purpose understandable. 4. Code length: Concise, with shared helpers avoiding duplication; however, excessive compression reduces readability rather than improving it. 5. Action granularity: Multiple imports, assignments, method calls, returns, and declarations share lines, making individual actions harder to scan. 6. Reading flow: The conceptual progression is natural, but inconsistent indentation, inline braces, and adjacent method declarations repeatedly interrupt reading.

Run 2

Code Structure: Sensible separation of key initialization, MAC creation, shared signing logic, and purpose-specific entry points, but cramped formatting obscures these boundaries. Nesting: Shallow overall; anonymous classes and exception handling add only modest complexity. Clarity of intent: Descriptive constants and method names, plus the key-separation comment, make the purpose clear. Code length: Concise without substantial duplication, although excessive compression hurts readability. Action granularity: Multiple imports, statements, declarations, and closing braces share lines, making individual actions harder to distinguish. Reading flow: The conceptual progression is natural, but inconsistent indentation and abrupt transitions between methods and fields interrupt scanning.

Run 3

Code Structure: Constants, key initialization, thread-local MACs, and signing helpers are logically organized, but compressed declarations obscure their boundaries. Nesting: Shallow overall; anonymous classes and exception handling add only modest complexity. Clarity of intent: Descriptive names and the key-separation comment clearly explain the purpose. Code length: Appropriately short with shared helpers avoiding duplication, though excessive compression sacrifices readability. Action granularity: Multiple imports, initialization calls, declarations, and operations share lines, making individual actions harder to scan. Reading flow: The conceptual sequence is natural, but inconsistent line breaks, inline annotations, and crowded closing braces repeatedly interrupt it.