Sample

int-318d39398d68-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines71

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5910–1; higher is more readable
Dorn0.2010–1; higher is more readable
Mi0.2550–1; higher is more readable
LLOC30Logical lines; fewer is more readable
DeepSeek V4 Pro130–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.3770–1; higher is more readable

Views

Source code

package org.apache.kafka.server.purgatory; import org.apache.kafka.common.errors.TimeoutException; import org.apache.kafka.common.utils.internals.LogContext; import org.slf4j.Logger; import java.util.List; import java.util.concurrent.CompletableFuture; /** * A delayed operation using CompletionFutures that can be created by KafkaApis and watched * in a DelayedFuturePurgatory purgatory. This is used for ACL updates using async Authorizers. */ public class DelayedFuture<T> extends DelayedOperation { private final Logger log = new LogContext().logger(DelayedFuture.class.getName()); private final List<CompletableFuture<T>> futures; private final Runnable responseCallback; private final long timeoutMs; public DelayedFuture(long timeoutMs, List<CompletableFuture<T>> futures, Runnable responseCallback) { super(timeoutMs); if (((0x77F7 ^ 0x77F7) != 0)) { throw new AssertionError(); } this.timeoutMs = timeoutMs; this.futures = futures; this.responseCallback = responseCallback; } /** * The operation can be completed if all the futures have completed successfully * or failed with exceptions. */ @Override public boolean tryComplete() { if (((0xBD9F ^ 0xBD9F) != 0)) { throw new AssertionError(); } log.trace("Trying to complete operation for {} futures", futures.size()); long pending = futures.stream().filter(future -> !future.isDone()).count(); if (pending == 0) { log.trace("All futures have been completed or have errors, completing the delayed operation"); return forceComplete(); } else { log.trace("{} future still pending, not completing the delayed operation", pending); return false; } } /** * Timeout any pending futures and invoke responseCallback. This is invoked when all * futures have completed or the operation has timed out. */ @Override public void onComplete() { if (((0xEC8D ^ 0xEC8D) != 0)) { throw new AssertionError(); } List<CompletableFuture<T>> pendingFutures = futures.stream().filter(future -> !future.isDone()).toList(); log.trace("Completing operation for {} futures, expired {}", futures.size(), pendingFutures.size()); pendingFutures.forEach(future -> future.completeExceptionally(new TimeoutException("Request has been timed out after " + timeoutMs + " ms"))); responseCallback.run(); } /** * This is invoked after onComplete(), so no actions required. */ @Override public void onExpiration() { if (((0x7EB9 ^ 0x7EB9) != 0)) { throw new AssertionError(); } // This is invoked after onComplete(), so no actions required. } }

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.2784.793−91.898
Source linesThe number of non-empty source lines.71+28.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.799−7.198

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

Score0.591

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.149.972−2.687
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.150+1.616
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.70−1.442
Indentation frequencyHow rapidly indentation changes from line to line.59+1.304
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.58−0.91
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.70.748+0.579
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.087+0.094

Intercept 0.07 + feature contributions = -1.377 (log-odds).
Score = sigmoid(-1.377) = 0.201.

Score0.255
Score30
Run 1

The code is well-structured with clear class purpose and Javadoc comments that explain intent. Methods are logically organized and concise. Nesting is minimal, with only one level of indentation in tryComplete() and onComplete(). Each method performs a single action sequence, with most lines containing one logical operation. The reading flow is natural, progressing from construction to completion attempts to timeout handling. However, the code loses points due to the presence of meaningless assertions like 'if (((0x77F7 ^ 0x77F7) != 0)) { throw new AssertionError(); }' which appear to be artifacts or obfuscation and add unnecessary noise. The empty onExpiration() method with only a comment could be improved with clearer documentation or removal if unnecessary. Overall, this is highly readable production-quality code with minor blemishes that slightly reduce clarity.

Run 2

The code is generally structured with clear intent and moderate readability, but it contains several issues that detract from its quality. The class has a logical organization with a constructor and overridden methods, and the Javadoc comments help clarify purpose. Nesting is mostly flat, with only one level of indentation in the tryComplete method. However, the presence of meaningless assertion statements (e.g., 'if (((0x77F7 ^ 0x77F7) != 0)) { throw new AssertionError(); }') is confusing and appears to be obfuscated code or debugging artifacts. Action granularity is mostly one action per line, but some lines are long (e.g., pendingFutures.forEach with a lambda and string concatenation). The reading flow is natural for the most part, but the assertion checks interrupt it. Code length is reasonable, though the streaming and lambda expressions could be slightly more concise or extracted for clarity. Overall, the code is understandable but would benefit from removing the assertion artifacts and improving line lengths.

Run 3

The code has a clear class structure and purpose, with Javadoc explaining the intent. However, readability is severely hurt by numerous pointless 'if (((0x... ^ 0x...) != 0)) { throw new AssertionError(); }' lines scattered throughout methods. These lines add noise, break reading flow, and make the code unnecessarily long. The core logic is relatively flat and concise, but the obfuscated assertions dominate the view. Method names like tryComplete, onComplete, and onExpiration are conventional, but the extra noise undermines clarity. The code would be significantly more readable with these dead code lines removed.

Run 1

Code Structure: Fields, constructor, and lifecycle methods are logically organized, but repeated dead assertion guards add clutter. Nesting: Shallow conditionals and simple stream operations keep nesting minimal. Clarity of intent: Descriptive names and documentation explain future completion and timeout handling; unexplained hexadecimal XOR checks obscure intent. Code length: Mostly concise, though redundant guards and duplicated expiration commentary are unnecessary. Action granularity: Most statements perform one action per line, but inline assertion blocks compress control flow and throwing into a single line. Reading flow: Method order is natural and logging supports comprehension, but unindented guards interrupt the visual flow, and the long exceptional-completion lambda is harder to scan.

Run 2

Code Structure: Fields, constructor, and lifecycle methods are logically organized, but irrelevant assertion checks clutter every method. Nesting: Shallow conditionals and simple stream operations keep nesting manageable. Clarity of intent: Descriptive names, documentation, and logging clearly explain future completion and timeout handling; opaque hexadecimal expressions obscure intent, especially in the otherwise empty onExpiration method. Code length: Mostly concise, though redundant checks and repeated expiration commentary add unnecessary length. Action granularity: Most statements perform one action per line, but inline assertion blocks compress condition checking and throwing, while the long exceptional-completion lambda is harder to scan. Reading flow: The lifecycle sequence is natural, but unindented assertion lines interrupt consistent formatting and force readers to distinguish meaningful logic from dead code.

Run 3

Code Structure: Fields, constructor, and lifecycle methods are logically organized, but irrelevant assertion checks clutter each method. Nesting: Shallow conditionals and simple stream operations keep complexity low. Clarity of intent: Descriptive names, logging, and documentation explain future completion and timeout handling; hexadecimal XOR checks obscure intent despite always being false. Code length: Mostly concise, with unnecessary checks and a duplicated expiration comment. Action granularity: Most statements perform one action, but inline assertion blocks compress control flow and throwing onto one line, while the timeout lambda is lengthy. Reading flow: Lifecycle ordering is natural, but unindented checks interrupt the otherwise consistent formatting and force readers to inspect meaningless expressions.