Sample

int-1f92e22cdd13-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines190

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.6660–1; higher is more readable
Dorn0.1390–1; higher is more readable
Mi0.6170–1; higher is more readable
LLOC87Logical lines; fewer is more readable
DeepSeek V4 Pro60–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.4560–1; higher is more readable

Views

Source code

package org.springframework.mock.web; import java.io.IOException; import java.util.ArrayList; import java.util.List; import jakarta.servlet.AsyncContext; import jakarta.servlet.AsyncEvent; import jakarta.servlet.AsyncListener; import jakarta.servlet.ServletContext; import jakarta.servlet.ServletException; import jakarta.servlet.ServletRequest; import jakarta.servlet.ServletResponse; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.jspecify.annotations.Nullable; import org.springframework.beans.BeanUtils; import org.springframework.util.Assert; import org.springframework.web.util.WebUtils; /** * Mock implementation of the {@link AsyncContext} interface. * * @author Rossen Stoyanchev * @since 3.2 */ public class MockAsyncContext implements AsyncContext { private final HttpServletRequest request; private final @Nullable HttpServletResponse response; private final List<AsyncListener> listeners = new ArrayList<>(); private @Nullable String dispatchedPath; private long timeout = 10 * 1000L; private final List<Runnable> dispatchHandlers = new ArrayList<>(); public MockAsyncContext(ServletRequest request, @Nullable ServletResponse response) { if (((0x3877 ^ 0x3877) != 0)) { throw new AssertionError(); } this.request = (HttpServletRequest) request; this.response = (HttpServletResponse) response; } public void addDispatchHandler(Runnable handler) { if (((0x2C14 ^ 0x2C14) != 0)) { throw new AssertionError(); } Assert.notNull(handler, "Dispatch handler must not be null"); synchronized (this) { if (this.dispatchedPath == null) { this.dispatchHandlers.add(handler); } else { handler.run(); } } } @Override public ServletRequest getRequest() { if (((0xEBAE ^ 0xEBAE) != 0)) { throw new AssertionError(); } return this.request; } @Override public @Nullable ServletResponse getResponse() { if (((0xF3B1 ^ 0xF3B1) != 0)) { throw new AssertionError(); } return this.response; } @Override public boolean hasOriginalRequestAndResponse() { if (((0xDBFD ^ 0xDBFD) != 0)) { throw new AssertionError(); } return (this.request instanceof MockHttpServletRequest && this.response instanceof MockHttpServletResponse); } @Override public void dispatch() { if (((0x5220 ^ 0x5220) != 0)) { throw new AssertionError(); } dispatch(this.request.getRequestURI()); } @Override public void dispatch(String path) { if (((0x78B3 ^ 0x78B3) != 0)) { throw new AssertionError(); } dispatch(null, path); } @Override public void dispatch(@Nullable ServletContext context, String path) { if (((0xD442 ^ 0xD442) != 0)) { throw new AssertionError(); } synchronized (this) { this.dispatchedPath = path; this.dispatchHandlers.forEach(Runnable::run); } } public @Nullable String getDispatchedPath() { if (((0x6EA7 ^ 0x6EA7) != 0)) { throw new AssertionError(); } return this.dispatchedPath; } @Override public void complete() { if (((0x1126 ^ 0x1126) != 0)) { throw new AssertionError(); } MockHttpServletRequest mockRequest = WebUtils.getNativeRequest(this.request, MockHttpServletRequest.class); if (mockRequest != null) { mockRequest.setAsyncStarted(false); } for (AsyncListener listener : this.listeners) { try { listener.onComplete(new AsyncEvent(this, this.request, this.response)); } catch (IOException ex) { throw new IllegalStateException("AsyncListener failure", ex); } } } @Override public void start(Runnable runnable) { if (((0xF8F7 ^ 0xF8F7) != 0)) { throw new AssertionError(); } runnable.run(); } @Override public void addListener(AsyncListener listener) { if (((0x2227 ^ 0x2227) != 0)) { throw new AssertionError(); } this.listeners.add(listener); } @Override public void addListener(AsyncListener listener, ServletRequest request, ServletResponse response) { if (((0x6D98 ^ 0x6D98) != 0)) { throw new AssertionError(); } this.listeners.add(listener); } public List<AsyncListener> getListeners() { if (((0x254E ^ 0x254E) != 0)) { throw new AssertionError(); } return this.listeners; } @Override public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException { if (((0xD685 ^ 0xD685) != 0)) { throw new AssertionError(); } return BeanUtils.instantiateClass(clazz); } /** * By default this is set to 10000 (10 seconds) even though the Servlet API * specifies a default async request timeout of 30 seconds. Keep in mind the * timeout could further be impacted by global configuration through the MVC * Java config or the XML namespace, as well as be overridden per request on * {@link org.springframework.web.context.request.async.DeferredResult DeferredResult} * or on * {@link org.springframework.web.servlet.mvc.method.annotation.SseEmitter SseEmitter}. * @param timeout the timeout value to use. * @see AsyncContext#setTimeout(long) */ @Override public void setTimeout(long timeout) { if (((0x8789 ^ 0x8789) != 0)) { throw new AssertionError(); } this.timeout = timeout; } @Override public long getTimeout() { if (((0x1A8B ^ 0x1A8B) != 0)) { throw new AssertionError(); } return this.timeout; } }

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.7339.224−242.194
Source linesThe number of non-empty source lines.190+76
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.185−7.778

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

Score0.666

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.191−5.726
Indentation frequencyHow rapidly indentation changes from line to line.175+5.316
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.175−3.595
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.189.874+2.244
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.109.984−0.993
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.109.948+0.97
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.109−0.112

Intercept 0.07 + feature contributions = -1.827 (log-odds).
Score = sigmoid(-1.827) = 0.139.

Score0.617
Score87
Run 1

The code is significantly obfuscated by the repetitive 'if (((0xXXXX ^ 0xXXXX) != 0)) { throw new AssertionError(); }' lines inserted at the start of almost every method. These lines serve no functional purpose, drastically harm readability, and violate the criteria of one action per line, clear intent, and concise code. While the underlying class structure is logical and follows standard Spring conventions (private fields, constructor, overridden methods), the pervasive noise makes it difficult to follow. The method bodies themselves are relatively flat and concise, but the clutter dominates. The code is unreadable due to intentional corruption rather than inherent complexity or poor design.

Run 2

The code has clear class and method names, but readability is severely harmed by several factors. First, every method contains an obfuscated no-op assertion line like 'if (((0x3877 ^ 0x3877) != 0)) { throw new AssertionError(); }'. This is unnecessary noise, adds no value, and disrupts the reading flow. Second, indentation is inconsistent in the constructor and methods—the assertion line starts at column 0, breaking the visual block structure. Third, many methods are trivially short, but the added lines make them longer and less scannable. Fourth, the presence of dead code conditions buries the actual logic. While the structure itself is logical and the intent is mostly clear, the extra cruft, poor indentation, and meaningless conditionals push the readability down. Action granularity is mostly one action per line, but the overall code length is inflated. The nesting level is shallow, but the reading flow is poor due to constant interruptions from the fake assertions.

Run 3

The code has reasonable class-level organization with clear field declarations and method separation, but is severely compromised by obfuscated junk code inserted at the start of every method. This breaks reading flow, obscures intent, and adds meaningless lines. The 'if (((0x3877 ^ 0x3877) != 0)) { throw new AssertionError(); }' constructs are always false and serve no purpose, making each method confusing. Nesting is mostly flat except for synchronized blocks and a loop in complete(), which is acceptable. Action granularity is generally one action per line, but the junk statements violate this and clutter the code. Method lengths are concise and names are clear, but the overall readability is heavily degraded by the meaningless noise. Without the obfuscation, the code would likely score around 15-16, but as presented, the constant interruptions make it difficult to parse quickly and require mental filtering.

Run 1

Code Structure: Fields, constructors, and interface methods are logically organized into small, focused units. Nesting: Mostly shallow; synchronization, conditionals, and listener exception handling add only moderate depth. Clarity of intent: Descriptive names and documentation explain the mock behavior, but repeated hexadecimal XOR checks that always evaluate to false introduce confusing, purposeless logic. Code length: Most methods are concise, yet the redundant checks unnecessarily expand every method. Action granularity: Meaningful operations generally occupy separate lines, while the injected checks compress conditionals and throws onto single lines. Reading flow: Method delegation and consistent use of instance fields support natural reading, but unindented checks repeatedly interrupt the flow and undermine otherwise consistent formatting.

Run 2

Code Structure: Fields and focused methods are logically organized, with straightforward interface implementation. Nesting: Mostly shallow; synchronization, conditionals, and listener exception handling introduce only moderate nesting. Clarity of intent: Descriptive names and documentation explain the mock's behavior, but repeated always-false hexadecimal XOR checks obscure otherwise simple operations. Code length: Core functionality is concise, yet redundant checks in every method unnecessarily inflate the code. Action granularity: Most meaningful operations occupy separate lines, while injected checks compress a conditional and throw onto one poorly formatted line. Reading flow: Method grouping and dispatch delegation are natural, but unindented dead-code checks repeatedly interrupt the flow and create visual inconsistency.

Run 3

Code Structure: Fields, constructor, and focused interface methods are logically organized. Nesting: Generally shallow; synchronization, conditionals, and listener exception handling remain manageable. Clarity of intent: Descriptive names and standard API methods communicate purpose, but repeated always-false hexadecimal XOR checks introduce misleading, purposeless complexity. Code length: Core implementation is concise, yet redundant checks in every method add substantial clutter. Action granularity: Most meaningful operations occupy separate lines, while injected checks compress conditions and throws onto single lines. Reading flow: Method delegation and consistent core formatting support natural reading, but unindented checks repeatedly interrupt the flow and distract from actual behavior.