Sample

int-f8024c44cb26-I06

Invert eligible conditions and exchange their branches

Matched original source

Lines136

Scores

MethodScoreScale
Posnett0.0020–1; higher is more readable
Scalabrino0.9070–1; higher is more readable
Dorn0.8150–1; higher is more readable
Mi0.6160–1; higher is more readable
LLOC27Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.5730–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) { this.patterns = patterns; } /** * Initialize the singleton Pointcut held within this Advisor. */ @Override public Pointcut getPointcut() { synchronized (this.pointcutMonitor) { if (!((this.pointcut == null))) {} else { 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.1881.464−62.088
Source linesThe number of non-empty source lines.136+54.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.883−7.325

Intercept 8.87 + feature contributions = -6.143 (log-odds).
Score = sigmoid(-6.143) = 0.002.

Score0.907

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.137−3.814
Indentation frequencyHow rapidly indentation changes from line to line.82+2.099
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.135.817+1.489
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.045+0.502
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.80.92+0.501
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.964+0.236

Intercept 0.07 + feature contributions = 1.481 (log-odds).
Score = sigmoid(1.481) = 0.815.

Score0.616
Score27
Run 1

The code is generally well-structured and readable. It follows a clear, logical organization with fields, constructors, and methods grouped logically. Nesting is minimal, with only one synchronized block containing a single if-else. The intent is clear due to good naming and comprehensive Javadoc. Code length is concise for the functionality provided. Action granularity is mostly one action per line. The reading flow is natural and follows standard Java conventions. However, there are a few minor readability issues: the `if (!((this.pointcut == null))) {} else { ... }` in `getPointcut()` is awkward and harder to parse than a standard `if (this.pointcut == null) { ... }` would be. Additionally, the `@SuppressWarnings("serial")` annotation and the `SerializableMonitor` class add a small amount of complexity that could be simplified. Overall, the code is highly readable but could be improved slightly.

Run 2

The code is generally well-structured and readable. It clearly separates constructors, setters, and overridden methods with logical grouping. Nesting is minimal, with only one synchronized block containing a simple if-else. The intent of each method and field is documented with concise Javadoc, and method names clearly convey their purpose. Code length is appropriate for the functionality provided. However, the readability score is slightly reduced by the awkward `if (!((this.pointcut == null))) {} else { ... }` construct, which is unnecessarily convoluted and non-standard; a simple `if (this.pointcut == null) { ... }` would be clearer. Additionally, the placement of type-use annotations (`String @Nullable []`) may be slightly less intuitive for some readers, and the empty default constructor is redundant, adding minor noise. Overall, the class is highly readable with only minor stylistic issues.

Run 3

The code is well-structured with clear separation of concerns, logical method organization, and comprehensive Javadoc documentation. Class fields are logically grouped, and constructors are neatly arranged by complexity. Nesting is minimal, with only one synchronization block and a single conditional. The intent of each method is clear from its name and documentation. However, the conditional logic in getPointcut() is unnecessarily awkward: the negated condition with an empty if-block and else-branch hurts readability and should simply use a direct null check. The code is mostly concise, though the toString() method has a slightly unnatural line break. Action granularity is generally good, with one meaningful operation per line. Reading flow follows a natural top-down progression from fields to constructors to methods. Minor improvements could be made by simplifying the null-check logic in getPointcut() and slightly restructuring the return statement formatting.

Run 1

Code Structure: Fields, constructors, setters, initialization, and helpers are logically grouped. Nesting: Mostly shallow, although getPointcut nests synchronization and two conditionals. Clarity of intent: Descriptive names and useful Javadoc explain the advisor's purpose, but the negated null check with redundant parentheses and an empty if branch obscures straightforward lazy initialization. Code length: Methods are concise; constructor overloads and documentation add length but serve clear purposes. Action granularity: Statements generally perform one action per line, though the compressed empty if/else reduces readability. Reading flow: Consistent formatting and method ordering support natural reading, interrupted primarily by the unusual conditional in getPointcut. Replacing it with a direct if (this.pointcut == null) would substantially improve clarity.

Run 2

Code Structure: Fields, constructors, configuration methods, and helper methods are logically organized. Nesting: Mostly shallow, although synchronized lazy initialization adds several levels. Clarity of intent: Descriptive names and useful Javadoc clearly explain the advisor and pattern configuration, but the negated null check, redundant parentheses, and empty if branch obscure getPointcut(); a direct if (this.pointcut == null) would be clearer. Code length: Implementation methods are concise, though repeated constructor documentation adds some bulk. Action granularity: Most lines perform one action; the compressed empty if/else statement is a notable exception. Reading flow: Consistent formatting and sensible method ordering support natural reading, interrupted primarily by the awkward initialization conditional.

Run 3

Code Structure: Fields, constructors, configuration methods, and helpers are logically organized. Nesting: Generally shallow, although getPointcut nests initialization and pattern configuration within synchronization. Clarity of intent: Descriptive names and useful Javadoc explain the advisor's purpose, but the negated null check with redundant parentheses and an empty if branch obscures straightforward lazy initialization. Code length: Implementation methods are concise; repeated constructor documentation adds some bulk. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: Consistent formatting and method ordering support natural reading, but the unusual if/else in getPointcut interrupts the flow; a direct if (this.pointcut == null) would be clearer.