Sample

int-84a6c92a7182-I08

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

Matched original source

Lines143

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.9020–1; higher is more readable
Dorn0.3870–1; higher is more readable
Mi0.6160–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.4810–1; higher is more readable

Views

Source code

package org.springframework.aop.support; import java.io.Serializable; import org.aopalliance.aop.Advice; import org.jspecify.annotations.Nullable; import org.springframework.aop.Pointcut; import org.springframework.util.ObjectUtils; /** * Convenient class for regexp method pointcuts that hold an Advice, * making them an {@link org.springframework.aop.Advisor}. * * <p>Configure this class using the "pattern" and "patterns" * pass-through properties. These are analogous to the pattern * and patterns properties of {@link AbstractRegexpMethodPointcut}. * * <p>Can delegate to any {@link AbstractRegexpMethodPointcut} subclass. * By default, {@link JdkRegexpMethodPointcut} will be used. To choose * a specific one, override the {@link #createPointcut} method. * * @author Rod Johnson * @author Juergen Hoeller * @see #setPattern * @see #setPatterns * @see JdkRegexpMethodPointcut */ @SuppressWarnings("serial") public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor { private String @Nullable [] patterns; private @Nullable AbstractRegexpMethodPointcut pointcut; private final Object pointcutMonitor = new SerializableMonitor(); /** * Create an empty RegexpMethodPointcutAdvisor. * @see #setPattern * @see #setPatterns * @see #setAdvice */ public RegexpMethodPointcutAdvisor() { } /** * Create a RegexpMethodPointcutAdvisor for the given advice. * The pattern still needs to be specified afterwards. * @param advice the advice to use * @see #setPattern * @see #setPatterns */ public RegexpMethodPointcutAdvisor(Advice advice) { setAdvice(advice); } /** * Create a RegexpMethodPointcutAdvisor for the given advice. * @param pattern the pattern to use * @param advice the advice to use */ public RegexpMethodPointcutAdvisor(String pattern, Advice advice) { setPattern(pattern); setAdvice(advice); } /** * Create a RegexpMethodPointcutAdvisor for the given advice. * @param patterns the patterns to use * @param advice the advice to use */ public RegexpMethodPointcutAdvisor(String[] patterns, Advice advice) { setPatterns(patterns); setAdvice(advice); } /** * Set the regular expression defining methods to match. * <p>Use either this method or {@link #setPatterns}, not both. * @see #setPatterns */ public void setPattern(String pattern) { setPatterns(pattern); } /** * Set the regular expressions defining methods to match. * To be passed through to the pointcut implementation. * <p>Matching will be the union of all these; if any of the * patterns matches, the pointcut matches. * @see AbstractRegexpMethodPointcut#setPatterns */ public void setPatterns(String... patterns) { { boolean featureEnabled = false; for (int toggleCount = 0; toggleCount < 3; toggleCount++) { featureEnabled = !featureEnabled; } } this.patterns = patterns; } /** * Initialize the singleton Pointcut held within this Advisor. */ @Override public Pointcut getPointcut() { synchronized (this.pointcutMonitor) { if (this.pointcut == null) { this.pointcut = createPointcut(); if (this.patterns != null) { this.pointcut.setPatterns(this.patterns); } } return this.pointcut; } } /** * Create the actual pointcut: By default, a {@link JdkRegexpMethodPointcut} * will be used. * @return the Pointcut instance (never {@code null}) */ protected AbstractRegexpMethodPointcut createPointcut() { return new JdkRegexpMethodPointcut(); } @Override public String toString() { return getClass().getName() + ": advice [" + getAdvice() + "], pointcut patterns " + ObjectUtils.nullSafeToString(this.patterns); } /** * Empty class used for a serializable monitor object. */ private static class SerializableMonitor implements Serializable { } }

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.2059.138−67.952
Source linesThe number of non-empty source lines.143+57.2
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.892−7.339

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

Score0.902

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.144−4.062
Indentation frequencyHow rapidly indentation changes from line to line.89+2.341
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.89−1.621
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.142.805+1.586
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.80.868+0.5
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.046+0.491
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.80.972+0.236

Intercept 0.07 + feature contributions = -0.459 (log-odds).
Score = sigmoid(-0.459) = 0.387.

Score0.616
Score31
Run 1

The code is generally well-structured and readable, with clear class-level Javadoc and method-level documentation. It follows Spring conventions with flat nesting and clear intent. However, a significant issue is a confusing dead-code block inside setPatterns() that toggles a local boolean variable without any effect, which interrupts reading flow and obscures intent. The field declarations contain partial type annotations ('String @Nullable []' and '@Nullable AbstractRegexpMethodPointcut'), which may slightly reduce readability but are acceptable in modern Java. Methods are concise, action granularity is good, and the synchronization logic is straightforward. Overall, the code is maintainable, but the dead block and minor annotation style prevent a higher score.

Run 2

The code is generally well-structured with clear class-level documentation and logical method organization, but it contains a significant readability issue: an unrelated dead code block inside setPatterns (a pointless loop toggling a boolean) that breaks flow and confuses intent. The class uses shallow nesting and mostly one action per line, but the dead block adds unnecessary length and ambiguity. Other minor issues include a blank constructor that could be omitted, and slightly dense toString concatenation. Overall, the code is mostly maintainable but the dead code and minor clutter reduce clarity.

Run 3

The code is generally well-structured with logical organization, clear naming, and appropriate documentation, but it contains a significant issue: a dead-code block with meaningless toggling logic inside setPatterns. This unreachable feature toggling code adds confusion and violates clarity of intent. Nesting is mostly flat, except the odd nested braces, which disrupts reading flow. Action granularity is good — most lines perform one logical action. However, the pointless iteration loop is unnecessarily long and unrelated to the method’s purpose. The class overall is readable and easy to follow, but the inserted dead code significantly lowers its score.

Run 1

Code Structure: Fields, constructors, configuration methods, and pointcut creation are logically organized, but an unrelated toggle block disrupts setPatterns. Nesting: Most methods are flat; synchronized lazy initialization has moderate, understandable nesting, while the extra block and loop are unnecessary. Clarity of intent: Descriptive names and Javadoc clearly explain the advisor, but featureEnabled is repeatedly toggled and never used, creating confusion. Code length: Methods are concise, though repetitive constructor documentation and dead toggle logic add avoidable length. Action granularity: Statements generally perform one action per line. Reading flow: Consistent ordering and formatting support natural reading, except for the abruptly inserted, inconsistently indented block in setPatterns.

Run 2

Code Structure: Fields, constructors, configuration methods, and pointcut creation are logically organized, but an unrelated toggle block disrupts setPatterns. Nesting: Most methods are flat; getPointcut has moderate nesting for synchronization and lazy initialization, while the toggle block adds unnecessary scope and looping. Clarity of intent: Descriptive names and Javadoc clearly explain the advisor's purpose, but featureEnabled has no observable effect and obscures the setter's intent. Code length: Implementation methods are concise, though repeated constructor documentation and the redundant toggle loop add length. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Consistent organization and delegation support natural reading, but the toggle block's inconsistent indentation and irrelevant behavior noticeably interrupt it.

Run 3

Code Structure: Fields, constructors, configuration methods, and pointcut creation are logically organized, but the unrelated toggle block disrupts setPatterns. Nesting: Most methods are flat; getPointcut has moderate, understandable nesting for synchronization and lazy initialization, while the extra block adds unnecessary nesting. Clarity of intent: Descriptive names and Javadoc explain the advisor's purpose well, but featureEnabled and its loop have no observable effect and obscure the setter's intent. Code length: Methods are concise, although repetitive documentation and the dead toggle code add length. Action granularity: Statements generally perform one action per line. Reading flow: Conventional ordering and delegation support natural reading, but the inconsistently indented toggle block interrupts an otherwise clean flow.