Switch to JSpecify annotations
This commit updates the whole Spring Framework codebase to use JSpecify annotations instead of Spring null-safety annotations with JSR 305 semantics. JSpecify provides signficant enhancements such as properly defined specifications, a canonical dependency with no split-package issue, better tooling, better Kotlin integration and the capability to specify generic type, array and varargs element null-safety. Generic type null-safety is not defined by this commit yet and will be specified later. A key difference is that Spring null-safety annotations, following JSR 305 semantics, apply to fields, parameters and return values, while JSpecify annotations apply to type usages. That's why this commit moves nullability annotations closer to the type for fields and return values. See gh-28797
This commit is contained in:
parent
fcb8aed03f
commit
bc5d771a06
|
@ -107,7 +107,8 @@ configure([rootProject] + javaProjects) { project ->
|
|||
// Previously there could be a split-package issue between JSR250 and JSR305 javax.annotation packages,
|
||||
// but since 6.0 JSR 250 annotations such as @Resource and @PostConstruct have been replaced by their
|
||||
// JakartaEE equivalents in the jakarta.annotation package.
|
||||
//"https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/"
|
||||
//"https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/",
|
||||
"https://jspecify.dev/docs/api/"
|
||||
] as String[]
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,7 @@ class CustomCacheConfiguration {
|
|||
// tag::snippet[]
|
||||
@Bean
|
||||
fun cacheManager(): CacheManager {
|
||||
return CaffeineCacheManager().apply {
|
||||
cacheNames = listOf("default", "books")
|
||||
}
|
||||
return CaffeineCacheManager("default", "books")
|
||||
}
|
||||
// end::snippet[]
|
||||
}
|
|
@ -131,6 +131,7 @@ dependencies {
|
|||
api("org.htmlunit:htmlunit:4.6.0")
|
||||
api("org.javamoney:moneta:1.4.4")
|
||||
api("org.jruby:jruby:9.4.9.0")
|
||||
api("org.jspecify:jspecify:1.0.0")
|
||||
api("org.junit.support:testng-engine:1.0.5")
|
||||
api("org.mozilla:rhino:1.7.15")
|
||||
api("org.ogce:xpp3:1.1.6")
|
||||
|
|
|
@ -13,8 +13,8 @@ dependencies {
|
|||
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
|
||||
jmh 'org.openjdk.jmh:jmh-generator-bytecode:1.37'
|
||||
jmh 'net.sf.jopt-simple:jopt-simple'
|
||||
errorprone 'com.uber.nullaway:nullaway:0.10.26'
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.9.0'
|
||||
errorprone 'com.uber.nullaway:nullaway:0.12.2'
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.35.1'
|
||||
}
|
||||
|
||||
pluginManager.withPlugin("kotlin") {
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
|
@ -31,7 +32,6 @@ import org.springframework.beans.factory.BeanFactory;
|
|||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.testfixture.beans.ITestBean;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.NoTransactionException;
|
||||
import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||
import org.springframework.transaction.testfixture.CallCountingTransactionManager;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.springframework.aop;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* After returning advice is invoked only on normal method return, not if an
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.springframework.aop;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Advice invoked before a method is invoked. Such advices cannot
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
package org.springframework.aop;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Extension of the AOP Alliance {@link org.aopalliance.intercept.MethodInvocation}
|
||||
|
@ -83,7 +82,6 @@ public interface ProxyMethodInvocation extends MethodInvocation {
|
|||
* @return the value of the attribute, or {@code null} if not set
|
||||
* @see #setUserAttribute
|
||||
*/
|
||||
@Nullable
|
||||
Object getUserAttribute(String key);
|
||||
@Nullable Object getUserAttribute(String key);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.aop;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Minimal interface for exposing the target class behind a proxy.
|
||||
|
@ -36,7 +36,6 @@ public interface TargetClassAware {
|
|||
* (typically a proxy configuration or an actual proxy).
|
||||
* @return the target Class, or {@code null} if not known
|
||||
*/
|
||||
@Nullable
|
||||
Class<?> getTargetClass();
|
||||
@Nullable Class<?> getTargetClass();
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.aop;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A {@code TargetSource} is used to obtain the current "target" of
|
||||
|
@ -42,8 +42,7 @@ public interface TargetSource extends TargetClassAware {
|
|||
* @return the type of targets returned by this {@link TargetSource}
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
Class<?> getTargetClass();
|
||||
@Nullable Class<?> getTargetClass();
|
||||
|
||||
/**
|
||||
* Will all calls to {@link #getTarget()} return the same object?
|
||||
|
@ -64,8 +63,7 @@ public interface TargetSource extends TargetClassAware {
|
|||
* or {@code null} if there is no actual target instance
|
||||
* @throws Exception if the target object can't be resolved
|
||||
*/
|
||||
@Nullable
|
||||
Object getTarget() throws Exception;
|
||||
@Nullable Object getTarget() throws Exception;
|
||||
|
||||
/**
|
||||
* Release the given target object obtained from the
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.aspectj.lang.JoinPoint;
|
|||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.weaver.tools.JoinPointMatch;
|
||||
import org.aspectj.weaver.tools.PointcutParameter;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AopInvocationException;
|
||||
import org.springframework.aop.MethodMatcher;
|
||||
|
@ -42,7 +43,6 @@ import org.springframework.aop.support.MethodMatchers;
|
|||
import org.springframework.aop.support.StaticMethodMatcher;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -118,16 +118,13 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
* This will be non-null if the creator of this advice object knows the argument names
|
||||
* and sets them explicitly.
|
||||
*/
|
||||
@Nullable
|
||||
private String[] argumentNames;
|
||||
private @Nullable String @Nullable [] argumentNames;
|
||||
|
||||
/** Non-null if after throwing advice binds the thrown value. */
|
||||
@Nullable
|
||||
private String throwingName;
|
||||
private @Nullable String throwingName;
|
||||
|
||||
/** Non-null if after returning advice binds the return value. */
|
||||
@Nullable
|
||||
private String returningName;
|
||||
private @Nullable String returningName;
|
||||
|
||||
private Class<?> discoveredReturningType = Object.class;
|
||||
|
||||
|
@ -145,13 +142,11 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
*/
|
||||
private int joinPointStaticPartArgumentIndex = -1;
|
||||
|
||||
@Nullable
|
||||
private Map<String, Integer> argumentBindings;
|
||||
private @Nullable Map<String, Integer> argumentBindings;
|
||||
|
||||
private boolean argumentsIntrospected = false;
|
||||
|
||||
@Nullable
|
||||
private Type discoveredReturningGenericType;
|
||||
private @Nullable Type discoveredReturningGenericType;
|
||||
// Note: Unlike return type, no such generic information is needed for the throwing type,
|
||||
// since Java doesn't allow exception types to be parameterized.
|
||||
|
||||
|
@ -212,8 +207,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
/**
|
||||
* Return the ClassLoader for aspect instances.
|
||||
*/
|
||||
@Nullable
|
||||
public final ClassLoader getAspectClassLoader() {
|
||||
public final @Nullable ClassLoader getAspectClassLoader() {
|
||||
return this.aspectInstanceFactory.getAspectClassLoader();
|
||||
}
|
||||
|
||||
|
@ -318,8 +312,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
return this.discoveredReturningType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Type getDiscoveredReturningGenericType() {
|
||||
protected @Nullable Type getDiscoveredReturningGenericType() {
|
||||
return this.discoveredReturningGenericType;
|
||||
}
|
||||
|
||||
|
@ -657,8 +650,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
/**
|
||||
* Get the current join point match at the join point we are being dispatched on.
|
||||
*/
|
||||
@Nullable
|
||||
protected JoinPointMatch getJoinPointMatch() {
|
||||
protected @Nullable JoinPointMatch getJoinPointMatch() {
|
||||
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
|
||||
if (!(mi instanceof ProxyMethodInvocation pmi)) {
|
||||
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
|
||||
|
@ -672,8 +664,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
// 'last man wins' which is not what we want at all.
|
||||
// Using the expression is guaranteed to be safe, since 2 identical expressions
|
||||
// are guaranteed to bind in exactly the same way.
|
||||
@Nullable
|
||||
protected JoinPointMatch getJoinPointMatch(ProxyMethodInvocation pmi) {
|
||||
protected @Nullable JoinPointMatch getJoinPointMatch(ProxyMethodInvocation pmi) {
|
||||
String expression = this.pointcut.getExpression();
|
||||
return (expression != null ? (JoinPointMatch) pmi.getUserAttribute(expression) : null);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interface implemented to provide an instance of an AspectJ aspect.
|
||||
|
@ -44,7 +45,6 @@ public interface AspectInstanceFactory extends Ordered {
|
|||
* @return the aspect class loader (or {@code null} for the bootstrap loader)
|
||||
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
|
||||
*/
|
||||
@Nullable
|
||||
ClassLoader getAspectClassLoader();
|
||||
@Nullable ClassLoader getAspectClassLoader();
|
||||
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ import org.aspectj.lang.JoinPoint;
|
|||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.weaver.tools.PointcutParser;
|
||||
import org.aspectj.weaver.tools.PointcutPrimitive;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -157,22 +157,19 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
|
||||
|
||||
/** The pointcut expression associated with the advice, as a simple String. */
|
||||
@Nullable
|
||||
private final String pointcutExpression;
|
||||
private final @Nullable String pointcutExpression;
|
||||
|
||||
private boolean raiseExceptions;
|
||||
|
||||
/** If the advice is afterReturning, and binds the return value, this is the parameter name used. */
|
||||
@Nullable
|
||||
private String returningName;
|
||||
private @Nullable String returningName;
|
||||
|
||||
/** If the advice is afterThrowing, and binds the thrown value, this is the parameter name used. */
|
||||
@Nullable
|
||||
private String throwingName;
|
||||
private @Nullable String throwingName;
|
||||
|
||||
private Class<?>[] argumentTypes = new Class<?>[0];
|
||||
|
||||
private String[] parameterNameBindings = new String[0];
|
||||
private @Nullable String[] parameterNameBindings = new String[0];
|
||||
|
||||
private int numberOfRemainingUnboundArguments;
|
||||
|
||||
|
@ -221,8 +218,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* @return the parameter names
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterNames(Method method) {
|
||||
public @Nullable String @Nullable [] getParameterNames(Method method) {
|
||||
this.argumentTypes = method.getParameterTypes();
|
||||
this.numberOfRemainingUnboundArguments = this.argumentTypes.length;
|
||||
this.parameterNameBindings = new String[this.numberOfRemainingUnboundArguments];
|
||||
|
@ -289,8 +285,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* {@link #setRaiseExceptions(boolean) raiseExceptions} has been set to {@code true}
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterNames(Constructor<?> ctor) {
|
||||
public String @Nullable [] getParameterNames(Constructor<?> ctor) {
|
||||
if (this.raiseExceptions) {
|
||||
throw new UnsupportedOperationException("An advice method can never be a constructor");
|
||||
}
|
||||
|
@ -453,8 +448,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
/**
|
||||
* If the token starts meets Java identifier conventions, it's in.
|
||||
*/
|
||||
@Nullable
|
||||
private String maybeExtractVariableName(@Nullable String candidateToken) {
|
||||
private @Nullable String maybeExtractVariableName(@Nullable String candidateToken) {
|
||||
if (AspectJProxyUtils.isVariableName(candidateToken)) {
|
||||
return candidateToken;
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ import java.lang.reflect.Method;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring AOP advice wrapping an AspectJ after advice method.
|
||||
|
@ -43,8 +43,7 @@ public class AspectJAfterAdvice extends AbstractAspectJAdvice
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
try {
|
||||
return mi.proceed();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.aop.AfterReturningAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.TypeUtils;
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import java.lang.reflect.Method;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring AOP advice wrapping an AspectJ after-throwing advice method.
|
||||
|
@ -58,8 +58,7 @@ public class AspectJAfterThrowingAdvice extends AbstractAspectJAdvice
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
try {
|
||||
return mi.proceed();
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
package org.springframework.aop.aspectj;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.aop.BeforeAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Utility methods for dealing with AspectJ advisors.
|
||||
|
@ -59,8 +59,7 @@ public abstract class AspectJAopUtils {
|
|||
* If neither the advisor nor the advice have precedence information, this method
|
||||
* will return {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
public static AspectJPrecedenceInformation getAspectJPrecedenceInformationFor(Advisor anAdvisor) {
|
||||
public static @Nullable AspectJPrecedenceInformation getAspectJPrecedenceInformationFor(Advisor anAdvisor) {
|
||||
if (anAdvisor instanceof AspectJPrecedenceInformation ajpi) {
|
||||
return ajpi;
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ import org.aopalliance.intercept.MethodInterceptor;
|
|||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.weaver.tools.JoinPointMatch;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ProxyMethodInvocation;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring AOP around advice (MethodInterceptor) that wraps
|
||||
|
@ -61,8 +61,7 @@ public class AspectJAroundAdvice extends AbstractAspectJAdvice implements Method
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
if (!(mi instanceof ProxyMethodInvocation pmi)) {
|
||||
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.aspectj.weaver.tools.PointcutParser;
|
|||
import org.aspectj.weaver.tools.PointcutPrimitive;
|
||||
import org.aspectj.weaver.tools.ShadowMatch;
|
||||
import org.aspectj.weaver.tools.UnsupportedPointcutPrimitiveException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.aop.IntroductionAwareMethodMatcher;
|
||||
|
@ -54,7 +55,6 @@ import org.springframework.beans.factory.BeanFactoryUtils;
|
|||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
@ -99,8 +99,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
|
||||
private static final Log logger = LogFactory.getLog(AspectJExpressionPointcut.class);
|
||||
|
||||
@Nullable
|
||||
private Class<?> pointcutDeclarationScope;
|
||||
private @Nullable Class<?> pointcutDeclarationScope;
|
||||
|
||||
private boolean aspectCompiledByAjc;
|
||||
|
||||
|
@ -108,14 +107,11 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
|
||||
private Class<?>[] pointcutParameterTypes = new Class<?>[0];
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
@Nullable
|
||||
private transient ClassLoader pointcutClassLoader;
|
||||
private transient @Nullable ClassLoader pointcutClassLoader;
|
||||
|
||||
@Nullable
|
||||
private transient PointcutExpression pointcutExpression;
|
||||
private transient @Nullable PointcutExpression pointcutExpression;
|
||||
|
||||
private transient boolean pointcutParsingFailed = false;
|
||||
|
||||
|
@ -207,8 +203,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
/**
|
||||
* Determine the ClassLoader to use for pointcut evaluation.
|
||||
*/
|
||||
@Nullable
|
||||
private ClassLoader determinePointcutClassLoader() {
|
||||
private @Nullable ClassLoader determinePointcutClassLoader() {
|
||||
if (this.beanFactory instanceof ConfigurableBeanFactory cbf) {
|
||||
return cbf.getBeanClassLoader();
|
||||
}
|
||||
|
@ -403,8 +398,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected String getCurrentProxiedBeanName() {
|
||||
protected @Nullable String getCurrentProxiedBeanName() {
|
||||
return ProxyCreationContext.getCurrentProxiedBeanName();
|
||||
}
|
||||
|
||||
|
@ -412,8 +406,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
/**
|
||||
* Get a new pointcut expression based on a target class's loader rather than the default.
|
||||
*/
|
||||
@Nullable
|
||||
private PointcutExpression getFallbackPointcutExpression(Class<?> targetClass) {
|
||||
private @Nullable PointcutExpression getFallbackPointcutExpression(Class<?> targetClass) {
|
||||
try {
|
||||
ClassLoader classLoader = targetClass.getClassLoader();
|
||||
if (classLoader != null && classLoader != this.pointcutClassLoader) {
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.support.AbstractGenericPointcutAdvisor;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring AOP Advisor that can be used for any AspectJ pointcut expression.
|
||||
|
@ -38,8 +39,7 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
|
|||
this.pointcut.setExpression(expression);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getExpression() {
|
||||
public @Nullable String getExpression() {
|
||||
return this.pointcut.getExpression();
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,7 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
|
|||
this.pointcut.setLocation(location);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getLocation() {
|
||||
public @Nullable String getLocation() {
|
||||
return this.pointcut.getLocation();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@ package org.springframework.aop.aspectj;
|
|||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.MethodBeforeAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring AOP advice that wraps an AspectJ before method.
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
package org.springframework.aop.aspectj;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.PointcutAdvisor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +38,7 @@ public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered {
|
|||
|
||||
private final Pointcut pointcut;
|
||||
|
||||
@Nullable
|
||||
private Integer order;
|
||||
private @Nullable Integer order;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,10 +18,11 @@ package org.springframework.aop.aspectj;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.PointcutAdvisor;
|
||||
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,11 +25,11 @@ import org.aspectj.lang.Signature;
|
|||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.aspectj.lang.reflect.SourceLocation;
|
||||
import org.aspectj.runtime.internal.AroundClosure;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ProxyMethodInvocation;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -55,16 +55,13 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
|
||||
private final ProxyMethodInvocation methodInvocation;
|
||||
|
||||
@Nullable
|
||||
private Object[] args;
|
||||
private Object @Nullable [] args;
|
||||
|
||||
/** Lazily initialized signature object. */
|
||||
@Nullable
|
||||
private Signature signature;
|
||||
private @Nullable Signature signature;
|
||||
|
||||
/** Lazily initialized source location object. */
|
||||
@Nullable
|
||||
private SourceLocation sourceLocation;
|
||||
private @Nullable SourceLocation sourceLocation;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -84,14 +81,12 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object proceed() throws Throwable {
|
||||
public @Nullable Object proceed() throws Throwable {
|
||||
return this.methodInvocation.invocableClone().proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object proceed(Object[] arguments) throws Throwable {
|
||||
public @Nullable Object proceed(Object[] arguments) throws Throwable {
|
||||
Assert.notNull(arguments, "Argument array passed to proceed cannot be null");
|
||||
if (arguments.length != this.methodInvocation.getArguments().length) {
|
||||
throw new IllegalArgumentException("Expecting " +
|
||||
|
@ -114,8 +109,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
* Returns the Spring AOP target. May be {@code null} if there is no target.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getTarget() {
|
||||
public @Nullable Object getTarget() {
|
||||
return this.methodInvocation.getThis();
|
||||
}
|
||||
|
||||
|
@ -180,8 +174,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
*/
|
||||
private class MethodSignatureImpl implements MethodSignature {
|
||||
|
||||
@Nullable
|
||||
private volatile String[] parameterNames;
|
||||
private volatile String @Nullable [] parameterNames;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -219,8 +212,7 @@ public class MethodInvocationProceedingJoinPoint implements ProceedingJoinPoint,
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterNames() {
|
||||
public String @Nullable [] getParameterNames() {
|
||||
String[] parameterNames = this.parameterNames;
|
||||
if (parameterNames == null) {
|
||||
parameterNames = parameterNameDiscoverer.getParameterNames(getMethod());
|
||||
|
|
|
@ -36,8 +36,8 @@ import org.aspectj.weaver.reflect.ReflectionBasedReferenceTypeDelegate;
|
|||
import org.aspectj.weaver.reflect.ReflectionVar;
|
||||
import org.aspectj.weaver.reflect.ShadowMatchImpl;
|
||||
import org.aspectj.weaver.tools.ShadowMatch;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
|
@ -79,8 +79,7 @@ class RuntimeTestWalker {
|
|||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private final Test runtimeTest;
|
||||
private final @Nullable Test runtimeTest;
|
||||
|
||||
|
||||
public RuntimeTestWalker(ShadowMatch shadowMatch) {
|
||||
|
|
|
@ -21,9 +21,9 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.aspectj.weaver.tools.ShadowMatch;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.support.ExpressionPointcut;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Internal {@link ShadowMatch} utilities.
|
||||
|
@ -49,8 +49,7 @@ public abstract class ShadowMatchUtils {
|
|||
* @param method the method
|
||||
* @return the {@code ShadowMatch} to use for the specified expression and method
|
||||
*/
|
||||
@Nullable
|
||||
static ShadowMatch getShadowMatch(ExpressionPointcut expression, Method method) {
|
||||
static @Nullable ShadowMatch getShadowMatch(ExpressionPointcut expression, Method method) {
|
||||
return shadowMatchCache.get(new Key(expression, method));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ package org.springframework.aop.aspectj;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
|
@ -77,8 +78,7 @@ public class SimpleAspectInstanceFactory implements AspectInstanceFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ClassLoader getAspectClassLoader() {
|
||||
public @Nullable ClassLoader getAspectClassLoader() {
|
||||
return this.aspectClass.getClassLoader();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@ package org.springframework.aop.aspectj;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -54,8 +55,7 @@ public class SingletonAspectInstanceFactory implements AspectInstanceFactory, Se
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ClassLoader getAspectClassLoader() {
|
||||
public @Nullable ClassLoader getAspectClassLoader() {
|
||||
return this.aspectInstance.getClass().getClassLoader();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ import java.util.Objects;
|
|||
|
||||
import org.aspectj.weaver.tools.PointcutParser;
|
||||
import org.aspectj.weaver.tools.TypePatternMatcher;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -39,8 +39,7 @@ public class TypePatternClassFilter implements ClassFilter {
|
|||
|
||||
private String typePattern = "";
|
||||
|
||||
@Nullable
|
||||
private TypePatternMatcher aspectJTypePatternMatcher;
|
||||
private @Nullable TypePatternMatcher aspectJTypePatternMatcher;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,12 +35,12 @@ import org.aspectj.lang.annotation.Pointcut;
|
|||
import org.aspectj.lang.reflect.AjType;
|
||||
import org.aspectj.lang.reflect.AjTypeSystem;
|
||||
import org.aspectj.lang.reflect.PerClauseKind;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.core.SpringProperties;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Abstract base class for factories that can create Spring AOP Advisors
|
||||
|
@ -112,8 +112,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
* (there <i>should</i> only be one anyway...).
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
protected static AspectJAnnotation findAspectJAnnotationOnMethod(Method method) {
|
||||
protected static @Nullable AspectJAnnotation findAspectJAnnotationOnMethod(Method method) {
|
||||
for (Class<?> annotationType : ASPECTJ_ANNOTATION_CLASSES) {
|
||||
AspectJAnnotation annotation = findAnnotation(method, (Class<Annotation>) annotationType);
|
||||
if (annotation != null) {
|
||||
|
@ -123,8 +122,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static AspectJAnnotation findAnnotation(Method method, Class<? extends Annotation> annotationType) {
|
||||
private static @Nullable AspectJAnnotation findAnnotation(Method method, Class<? extends Annotation> annotationType) {
|
||||
Annotation annotation = AnnotationUtils.findAnnotation(method, annotationType);
|
||||
if (annotation != null) {
|
||||
return new AspectJAnnotation(annotation);
|
||||
|
@ -242,8 +240,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
private static final String[] EMPTY_ARRAY = new String[0];
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterNames(Method method) {
|
||||
public String @Nullable [] getParameterNames(Method method) {
|
||||
if (method.getParameterCount() == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
|
@ -266,8 +263,7 @@ public abstract class AbstractAspectJAdvisorFactory implements AspectJAdvisorFac
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getParameterNames(Constructor<?> ctor) {
|
||||
public @Nullable String @Nullable [] getParameterNames(Constructor<?> ctor) {
|
||||
throw new UnsupportedOperationException("Spring AOP cannot handle constructor advice");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -49,14 +50,11 @@ import org.springframework.util.Assert;
|
|||
@SuppressWarnings("serial")
|
||||
public class AnnotationAwareAspectJAutoProxyCreator extends AspectJAwareAdvisorAutoProxyCreator {
|
||||
|
||||
@Nullable
|
||||
private List<Pattern> includePatterns;
|
||||
private @Nullable List<Pattern> includePatterns;
|
||||
|
||||
@Nullable
|
||||
private AspectJAdvisorFactory aspectJAdvisorFactory;
|
||||
private @Nullable AspectJAdvisorFactory aspectJAdvisorFactory;
|
||||
|
||||
@Nullable
|
||||
private BeanFactoryAspectJAdvisorsBuilder aspectJAdvisorsBuilder;
|
||||
private @Nullable BeanFactoryAspectJAdvisorsBuilder aspectJAdvisorsBuilder;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,13 +18,14 @@ package org.springframework.aop.aspectj.annotation;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aot.generate.GenerationContext;
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
|
||||
import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
|
||||
import org.springframework.beans.factory.aot.BeanRegistrationCode;
|
||||
import org.springframework.beans.factory.support.RegisteredBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -43,8 +44,7 @@ class AspectJAdvisorBeanRegistrationAotProcessor implements BeanRegistrationAotP
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
|
||||
public @Nullable BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
|
||||
if (aspectjPresent) {
|
||||
Class<?> beanClass = registeredBean.getBeanClass();
|
||||
if (compiledByAjc(beanClass)) {
|
||||
|
|
|
@ -20,11 +20,11 @@ import java.lang.reflect.Method;
|
|||
import java.util.List;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for factories that can create Spring AOP Advisors from classes
|
||||
|
@ -80,8 +80,7 @@ public interface AspectJAdvisorFactory {
|
|||
* or if it is a pointcut that will be used by other advice but will not
|
||||
* create a Spring advice in its own right
|
||||
*/
|
||||
@Nullable
|
||||
Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory,
|
||||
@Nullable Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory,
|
||||
int declarationOrder, String aspectName);
|
||||
|
||||
/**
|
||||
|
@ -100,8 +99,7 @@ public interface AspectJAdvisorFactory {
|
|||
* @see org.springframework.aop.aspectj.AspectJAfterReturningAdvice
|
||||
* @see org.springframework.aop.aspectj.AspectJAfterThrowingAdvice
|
||||
*/
|
||||
@Nullable
|
||||
Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut,
|
||||
@Nullable Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut,
|
||||
MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.springframework.aop.aspectj.annotation;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.aspectj.AbstractAspectJAdvice;
|
||||
import org.springframework.aot.generate.GenerationContext;
|
||||
|
@ -27,7 +29,6 @@ import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContrib
|
|||
import org.springframework.beans.factory.aot.BeanFactoryInitializationAotProcessor;
|
||||
import org.springframework.beans.factory.aot.BeanFactoryInitializationCode;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -45,8 +46,7 @@ class AspectJBeanFactoryInitializationAotProcessor implements BeanFactoryInitial
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
|
||||
public @Nullable BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
|
||||
if (aspectJPresent) {
|
||||
return AspectDelegate.processAheadOfTime(beanFactory);
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ class AspectJBeanFactoryInitializationAotProcessor implements BeanFactoryInitial
|
|||
*/
|
||||
private static class AspectDelegate {
|
||||
|
||||
@Nullable
|
||||
private static AspectContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
|
||||
private static @Nullable AspectContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
|
||||
BeanFactoryAspectJAdvisorsBuilder builder = new BeanFactoryAspectJAdvisorsBuilder(beanFactory);
|
||||
List<Advisor> advisors = builder.buildAspectJAdvisors();
|
||||
return (advisors.isEmpty() ? null : new AspectContribution(advisors));
|
||||
|
|
|
@ -18,11 +18,12 @@ package org.springframework.aop.aspectj.annotation;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.OrderUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -91,8 +92,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ClassLoader getAspectClassLoader() {
|
||||
public @Nullable ClassLoader getAspectClassLoader() {
|
||||
return (this.beanFactory instanceof ConfigurableBeanFactory cbf ?
|
||||
cbf.getBeanClassLoader() : ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
@ -103,8 +103,7 @@ public class BeanFactoryAspectInstanceFactory implements MetadataAwareAspectInst
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getAspectCreationMutex() {
|
||||
public @Nullable Object getAspectCreationMutex() {
|
||||
if (this.beanFactory.isSingleton(this.name)) {
|
||||
// Rely on singleton semantics provided by the factory -> no local lock.
|
||||
return null;
|
||||
|
|
|
@ -25,12 +25,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.aspectj.lang.reflect.PerClauseKind;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -49,8 +49,7 @@ public class BeanFactoryAspectJAdvisorsBuilder {
|
|||
|
||||
private final AspectJAdvisorFactory advisorFactory;
|
||||
|
||||
@Nullable
|
||||
private volatile List<String> aspectBeanNames;
|
||||
private volatile @Nullable List<String> aspectBeanNames;
|
||||
|
||||
private final Map<String, List<Advisor>> advisorsCache = new ConcurrentHashMap<>();
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.lang.reflect.Method;
|
|||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.aspectj.lang.reflect.PerClauseKind;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
||||
|
@ -31,7 +32,6 @@ import org.springframework.aop.aspectj.InstantiationModelAwarePointcutAdvisor;
|
|||
import org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.AspectJAnnotation;
|
||||
import org.springframework.aop.support.DynamicMethodMatcherPointcut;
|
||||
import org.springframework.aop.support.Pointcuts;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
|
@ -73,14 +73,11 @@ final class InstantiationModelAwarePointcutAdvisorImpl
|
|||
|
||||
private final boolean lazy;
|
||||
|
||||
@Nullable
|
||||
private Advice instantiatedAdvice;
|
||||
private @Nullable Advice instantiatedAdvice;
|
||||
|
||||
@Nullable
|
||||
private Boolean isBeforeAdvice;
|
||||
private @Nullable Boolean isBeforeAdvice;
|
||||
|
||||
@Nullable
|
||||
private Boolean isAfterAdvice;
|
||||
private @Nullable Boolean isAfterAdvice;
|
||||
|
||||
|
||||
public InstantiationModelAwarePointcutAdvisorImpl(AspectJExpressionPointcut declaredPointcut,
|
||||
|
@ -271,8 +268,7 @@ final class InstantiationModelAwarePointcutAdvisorImpl
|
|||
|
||||
private final Pointcut preInstantiationPointcut;
|
||||
|
||||
@Nullable
|
||||
private LazySingletonAspectInstanceFactoryDecorator aspectInstanceFactory;
|
||||
private @Nullable LazySingletonAspectInstanceFactoryDecorator aspectInstanceFactory;
|
||||
|
||||
public PerTargetInstantiationModelPointcut(AspectJExpressionPointcut declaredPointcut,
|
||||
Pointcut preInstantiationPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory) {
|
||||
|
|
|
@ -18,7 +18,8 @@ package org.springframework.aop.aspectj.annotation;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -33,8 +34,7 @@ public class LazySingletonAspectInstanceFactoryDecorator implements MetadataAwar
|
|||
|
||||
private final MetadataAwareAspectInstanceFactory maaif;
|
||||
|
||||
@Nullable
|
||||
private volatile Object materialized;
|
||||
private volatile @Nullable Object materialized;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -74,8 +74,7 @@ public class LazySingletonAspectInstanceFactoryDecorator implements MetadataAwar
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ClassLoader getAspectClassLoader() {
|
||||
public @Nullable ClassLoader getAspectClassLoader() {
|
||||
return this.maaif.getAspectClassLoader();
|
||||
}
|
||||
|
||||
|
@ -85,8 +84,7 @@ public class LazySingletonAspectInstanceFactoryDecorator implements MetadataAwar
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getAspectCreationMutex() {
|
||||
public @Nullable Object getAspectCreationMutex() {
|
||||
return this.maaif.getAspectCreationMutex();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package org.springframework.aop.aspectj.annotation;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.aspectj.AspectInstanceFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Subinterface of {@link org.springframework.aop.aspectj.AspectInstanceFactory}
|
||||
|
@ -41,7 +42,6 @@ public interface MetadataAwareAspectInstanceFactory extends AspectInstanceFactor
|
|||
* @return the mutex object (may be {@code null} for no mutex to use)
|
||||
* @since 4.3
|
||||
*/
|
||||
@Nullable
|
||||
Object getAspectCreationMutex();
|
||||
@Nullable Object getAspectCreationMutex();
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.aspectj.lang.annotation.Around;
|
|||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.DeclareParents;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.MethodBeforeAdvice;
|
||||
|
@ -49,7 +50,6 @@ import org.springframework.beans.factory.BeanFactory;
|
|||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.core.convert.converter.ConvertingComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.ReflectionUtils.MethodFilter;
|
||||
|
@ -96,8 +96,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
private final BeanFactory beanFactory;
|
||||
private final @Nullable BeanFactory beanFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -183,8 +182,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
* @param introductionField the field to introspect
|
||||
* @return the Advisor instance, or {@code null} if not an Advisor
|
||||
*/
|
||||
@Nullable
|
||||
private Advisor getDeclareParentsAdvisor(Field introductionField) {
|
||||
private @Nullable Advisor getDeclareParentsAdvisor(Field introductionField) {
|
||||
DeclareParents declareParents = introductionField.getAnnotation(DeclareParents.class);
|
||||
if (declareParents == null) {
|
||||
// Not an introduction field
|
||||
|
@ -201,8 +199,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory,
|
||||
public @Nullable Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory,
|
||||
int declarationOrderInAspect, String aspectName) {
|
||||
|
||||
validate(aspectInstanceFactory.getAspectMetadata().getAspectClass());
|
||||
|
@ -225,8 +222,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) {
|
||||
private @Nullable AspectJExpressionPointcut getPointcut(Method candidateAdviceMethod, Class<?> candidateAspectClass) {
|
||||
AspectJAnnotation aspectJAnnotation =
|
||||
AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(candidateAdviceMethod);
|
||||
if (aspectJAnnotation == null) {
|
||||
|
@ -244,8 +240,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut,
|
||||
public @Nullable Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut,
|
||||
MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName) {
|
||||
|
||||
Class<?> candidateAspectClass = aspectInstanceFactory.getAspectMetadata().getAspectClass();
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
*
|
||||
* <p>Normally to be used through an AspectJAutoProxyCreator rather than directly.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.aspectj.annotation;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
* Base classes enabling auto-proxying based on AspectJ.
|
||||
* Support for AspectJ annotation aspects resides in the "aspectj.annotation" package.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.aspectj.autoproxy;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
* or AspectJ load-time weaver. It is intended to enable the use of a valuable subset of AspectJ
|
||||
* functionality, with consistent semantics, with the proxy-based Spring AOP framework.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanReference;
|
||||
import org.springframework.beans.factory.parsing.AbstractComponentDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -110,8 +111,7 @@ public class AdvisorComponentDefinition extends AbstractComponentDefinition {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getSource() {
|
||||
public @Nullable Object getSource() {
|
||||
return this.advisorDefinition.getSource();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.springframework.aop.config;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator;
|
||||
import org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator;
|
||||
import org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator;
|
||||
|
@ -26,7 +28,6 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
|||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -64,37 +65,31 @@ public abstract class AopConfigUtils {
|
|||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static BeanDefinition registerAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
|
||||
public static @Nullable BeanDefinition registerAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
|
||||
return registerAutoProxyCreatorIfNecessary(registry, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BeanDefinition registerAutoProxyCreatorIfNecessary(
|
||||
public static @Nullable BeanDefinition registerAutoProxyCreatorIfNecessary(
|
||||
BeanDefinitionRegistry registry, @Nullable Object source) {
|
||||
|
||||
return registerOrEscalateApcAsRequired(InfrastructureAdvisorAutoProxyCreator.class, registry, source);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
|
||||
public static @Nullable BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
|
||||
return registerAspectJAutoProxyCreatorIfNecessary(registry, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(
|
||||
public static @Nullable BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(
|
||||
BeanDefinitionRegistry registry, @Nullable Object source) {
|
||||
|
||||
return registerOrEscalateApcAsRequired(AspectJAwareAdvisorAutoProxyCreator.class, registry, source);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
|
||||
public static @Nullable BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry) {
|
||||
return registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(
|
||||
public static @Nullable BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(
|
||||
BeanDefinitionRegistry registry, @Nullable Object source) {
|
||||
|
||||
return registerOrEscalateApcAsRequired(AnnotationAwareAspectJAutoProxyCreator.class, registry, source);
|
||||
|
@ -114,8 +109,7 @@ public abstract class AopConfigUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static BeanDefinition registerOrEscalateApcAsRequired(
|
||||
private static @Nullable BeanDefinition registerOrEscalateApcAsRequired(
|
||||
Class<?> cls, BeanDefinitionRegistry registry, @Nullable Object source) {
|
||||
|
||||
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Utility class for handling registration of auto-proxy creators used internally
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanReference;
|
||||
import org.springframework.beans.factory.parsing.CompositeComponentDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.parsing.ComponentDefinition}
|
||||
|
@ -38,8 +39,8 @@ public class AspectComponentDefinition extends CompositeComponentDefinition {
|
|||
private final BeanReference[] beanReferences;
|
||||
|
||||
|
||||
public AspectComponentDefinition(String aspectName, @Nullable BeanDefinition[] beanDefinitions,
|
||||
@Nullable BeanReference[] beanReferences, @Nullable Object source) {
|
||||
public AspectComponentDefinition(String aspectName, BeanDefinition @Nullable [] beanDefinitions,
|
||||
BeanReference @Nullable [] beanReferences, @Nullable Object source) {
|
||||
|
||||
super(aspectName, source);
|
||||
this.beanDefinitions = (beanDefinitions != null ? beanDefinitions : new BeanDefinition[0]);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -25,7 +26,6 @@ import org.springframework.beans.factory.config.TypedStringValue;
|
|||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link BeanDefinitionParser} for the {@code aspectj-autoproxy} tag,
|
||||
|
@ -39,8 +39,7 @@ import org.springframework.lang.Nullable;
|
|||
class AspectJAutoProxyBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
public @Nullable BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
AopNamespaceUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(parserContext, element);
|
||||
extendBeanDefinition(element, parserContext);
|
||||
return null;
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.aop.config;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -45,7 +46,6 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
|||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
|
@ -97,8 +97,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
public @Nullable BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
CompositeComponentDefinition compositeDef =
|
||||
new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));
|
||||
parserContext.pushContainingComponent(compositeDef);
|
||||
|
@ -453,8 +452,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
* {@link org.springframework.beans.factory.config.BeanDefinition} for the pointcut if necessary
|
||||
* and returns its bean name, otherwise returns the bean name of the referred pointcut.
|
||||
*/
|
||||
@Nullable
|
||||
private Object parsePointcutProperty(Element element, ParserContext parserContext) {
|
||||
private @Nullable Object parsePointcutProperty(Element element, ParserContext parserContext) {
|
||||
if (element.hasAttribute(POINTCUT) && element.hasAttribute(POINTCUT_REF)) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Cannot define both 'pointcut' and 'pointcut-ref' on <advisor> tag.",
|
||||
|
|
|
@ -18,11 +18,12 @@ package org.springframework.aop.config;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -33,14 +34,11 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public class MethodLocatingFactoryBean implements FactoryBean<Method>, BeanFactoryAware {
|
||||
|
||||
@Nullable
|
||||
private String targetBeanName;
|
||||
private @Nullable String targetBeanName;
|
||||
|
||||
@Nullable
|
||||
private String methodName;
|
||||
private @Nullable String methodName;
|
||||
|
||||
@Nullable
|
||||
private Method method;
|
||||
private @Nullable Method method;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -84,8 +82,7 @@ public class MethodLocatingFactoryBean implements FactoryBean<Method>, BeanFacto
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Method getObject() throws Exception {
|
||||
public @Nullable Method getObject() throws Exception {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.parsing.AbstractComponentDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -63,8 +64,7 @@ public class PointcutComponentDefinition extends AbstractComponentDefinition {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getSource() {
|
||||
public @Nullable Object getSource() {
|
||||
return this.pointcutDefinition.getSource();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.aspectj.AspectInstanceFactory;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -35,11 +36,9 @@ import org.springframework.util.ClassUtils;
|
|||
*/
|
||||
public class SimpleBeanFactoryAwareAspectInstanceFactory implements AspectInstanceFactory, BeanFactoryAware {
|
||||
|
||||
@Nullable
|
||||
private String aspectBeanName;
|
||||
private @Nullable String aspectBeanName;
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,8 +68,7 @@ public class SimpleBeanFactoryAwareAspectInstanceFactory implements AspectInstan
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ClassLoader getAspectClassLoader() {
|
||||
public @Nullable ClassLoader getAspectClassLoader() {
|
||||
if (this.beanFactory instanceof ConfigurableBeanFactory cbf) {
|
||||
return cbf.getBeanClassLoader();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
@ -23,7 +24,6 @@ import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
|||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link BeanDefinitionParser} responsible for parsing the
|
||||
|
@ -52,8 +52,7 @@ class SpringConfiguredBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
public @Nullable BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) {
|
||||
RootBeanDefinition def = new RootBeanDefinition();
|
||||
def.setBeanClassName(BEAN_CONFIGURER_ASPECT_CLASS_NAME);
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
* Support package for declarative AOP configuration,
|
||||
* with XML schema being the primary configuration format.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.config;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -19,12 +19,13 @@ package org.springframework.aop.framework;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor;
|
||||
import org.springframework.core.SmartClassLoader;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Base class for {@link BeanPostProcessor} implementations that apply a
|
||||
|
@ -37,8 +38,7 @@ import org.springframework.lang.Nullable;
|
|||
public abstract class AbstractAdvisingBeanPostProcessor extends ProxyProcessorSupport
|
||||
implements SmartInstantiationAwareBeanPostProcessor {
|
||||
|
||||
@Nullable
|
||||
protected Advisor advisor;
|
||||
protected @Nullable Advisor advisor;
|
||||
|
||||
protected boolean beforeExistingAdvisors = false;
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.aop.framework;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.framework.adapter.AdvisorAdapterRegistry;
|
||||
import org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry;
|
||||
|
@ -24,7 +26,6 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
|
|||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.FactoryBeanNotInitializedException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -42,26 +43,20 @@ import org.springframework.util.ClassUtils;
|
|||
public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private Object target;
|
||||
private @Nullable Object target;
|
||||
|
||||
@Nullable
|
||||
private Class<?>[] proxyInterfaces;
|
||||
private Class<?> @Nullable [] proxyInterfaces;
|
||||
|
||||
@Nullable
|
||||
private Object[] preInterceptors;
|
||||
private Object @Nullable [] preInterceptors;
|
||||
|
||||
@Nullable
|
||||
private Object[] postInterceptors;
|
||||
private Object @Nullable [] postInterceptors;
|
||||
|
||||
/** Default is global AdvisorAdapterRegistry. */
|
||||
private AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
|
||||
|
||||
@Nullable
|
||||
private transient ClassLoader proxyClassLoader;
|
||||
private transient @Nullable ClassLoader proxyClassLoader;
|
||||
|
||||
@Nullable
|
||||
private Object proxy;
|
||||
private @Nullable Object proxy;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -221,8 +216,7 @@ public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
public @Nullable Class<?> getObjectType() {
|
||||
if (this.proxy != null) {
|
||||
return this.proxy.getClass();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.DynamicIntroductionAdvice;
|
||||
|
@ -40,7 +41,6 @@ import org.springframework.aop.support.DefaultIntroductionAdvisor;
|
|||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.aop.target.EmptyTargetSource;
|
||||
import org.springframework.aop.target.SingletonTargetSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -108,12 +108,10 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
private List<Advisor> advisorKey = this.advisors;
|
||||
|
||||
/** Cache with Method as key and advisor chain List as value. */
|
||||
@Nullable
|
||||
private transient Map<MethodCacheKey, List<Object>> methodCache;
|
||||
private transient @Nullable Map<MethodCacheKey, List<Object>> methodCache;
|
||||
|
||||
/** Cache with shared interceptors which are not method-specific. */
|
||||
@Nullable
|
||||
private transient volatile List<Object> cachedInterceptors;
|
||||
private transient volatile @Nullable List<Object> cachedInterceptors;
|
||||
|
||||
/**
|
||||
* Optional field for {@link AopProxy} implementations to store metadata in.
|
||||
|
@ -121,8 +119,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
* @since 6.1.3
|
||||
* @see JdkDynamicAopProxy#JdkDynamicAopProxy(AdvisedSupport)
|
||||
*/
|
||||
@Nullable
|
||||
transient volatile Object proxyMetadataCache;
|
||||
transient volatile @Nullable Object proxyMetadataCache;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -178,8 +175,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getTargetClass() {
|
||||
public @Nullable Class<?> getTargetClass() {
|
||||
return this.targetSource.getTargetClass();
|
||||
}
|
||||
|
||||
|
@ -705,11 +701,9 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
|
|||
|
||||
private final Class<?> adviceType;
|
||||
|
||||
@Nullable
|
||||
private final String classFilterKey;
|
||||
private final @Nullable String classFilterKey;
|
||||
|
||||
@Nullable
|
||||
private final String methodMatcherKey;
|
||||
private final @Nullable String methodMatcherKey;
|
||||
|
||||
public AdvisorKeyEntry(Advisor advisor) {
|
||||
this.adviceType = advisor.getAdvice().getClass();
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.springframework.aop.framework;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Factory interface for advisor chains.
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package org.springframework.aop.framework;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Class containing static methods used to obtain information about the current AOP invocation.
|
||||
|
@ -80,8 +81,7 @@ public final class AopContext {
|
|||
* @return the old proxy, which may be {@code null} if none was bound
|
||||
* @see #currentProxy()
|
||||
*/
|
||||
@Nullable
|
||||
static Object setCurrentProxy(@Nullable Object proxy) {
|
||||
static @Nullable Object setCurrentProxy(@Nullable Object proxy) {
|
||||
Object old = currentProxy.get();
|
||||
if (proxy != null) {
|
||||
currentProxy.set(proxy);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.springframework.aop.framework;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Delegate interface for a configured AOP proxy, allowing for the creation
|
||||
|
|
|
@ -23,13 +23,14 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.SpringProxy;
|
||||
import org.springframework.aop.TargetClassAware;
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.aop.target.SingletonTargetSource;
|
||||
import org.springframework.core.DecoratingProxy;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
@ -58,8 +59,7 @@ public abstract class AopProxyUtils {
|
|||
* @see Advised#getTargetSource()
|
||||
* @see SingletonTargetSource#getTarget()
|
||||
*/
|
||||
@Nullable
|
||||
public static Object getSingletonTarget(Object candidate) {
|
||||
public static @Nullable Object getSingletonTarget(Object candidate) {
|
||||
if (candidate instanceof Advised advised) {
|
||||
TargetSource targetSource = advised.getTargetSource();
|
||||
if (targetSource instanceof SingletonTargetSource singleTargetSource) {
|
||||
|
@ -253,7 +253,7 @@ public abstract class AopProxyUtils {
|
|||
* @return a cloned argument array, or the original if no adaptation is needed
|
||||
* @since 4.2.3
|
||||
*/
|
||||
static Object[] adaptArgumentsIfNecessary(Method method, @Nullable Object[] arguments) {
|
||||
static Object[] adaptArgumentsIfNecessary(Method method, Object @Nullable [] arguments) {
|
||||
if (ObjectUtils.isEmpty(arguments)) {
|
||||
return new Object[0];
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.WeakHashMap;
|
|||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AopInvocationException;
|
||||
import org.springframework.aop.RawTargetAccess;
|
||||
|
@ -51,7 +52,6 @@ import org.springframework.cglib.transform.impl.UndeclaredThrowableStrategy;
|
|||
import org.springframework.core.KotlinDetector;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.SmartClassLoader;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -113,11 +113,9 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
/** The configuration used to configure this proxy. */
|
||||
protected final AdvisedSupport advised;
|
||||
|
||||
@Nullable
|
||||
protected Object[] constructorArgs;
|
||||
protected Object @Nullable [] constructorArgs;
|
||||
|
||||
@Nullable
|
||||
protected Class<?>[] constructorArgTypes;
|
||||
protected Class<?> @Nullable [] constructorArgTypes;
|
||||
|
||||
/** Dispatcher used for methods on Advised. */
|
||||
private final transient AdvisedDispatcher advisedDispatcher;
|
||||
|
@ -144,7 +142,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
* @param constructorArgs the constructor argument values
|
||||
* @param constructorArgTypes the constructor argument types
|
||||
*/
|
||||
public void setConstructorArguments(@Nullable Object[] constructorArgs, @Nullable Class<?>[] constructorArgTypes) {
|
||||
public void setConstructorArguments(Object @Nullable [] constructorArgs, Class<?> @Nullable [] constructorArgTypes) {
|
||||
if (constructorArgs == null || constructorArgTypes == null) {
|
||||
throw new IllegalArgumentException("Both 'constructorArgs' and 'constructorArgTypes' need to be specified");
|
||||
}
|
||||
|
@ -415,8 +413,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
* {@code proxy} and also verifies that {@code null} is not returned as a primitive.
|
||||
* Also takes care of the conversion from {@code Mono} to Kotlin Coroutines if needed.
|
||||
*/
|
||||
@Nullable
|
||||
private static Object processReturnType(
|
||||
private static @Nullable Object processReturnType(
|
||||
Object proxy, @Nullable Object target, Method method, Object[] arguments, @Nullable Object returnValue) {
|
||||
|
||||
// Massage return value if necessary
|
||||
|
@ -455,16 +452,14 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
*/
|
||||
private static class StaticUnadvisedInterceptor implements MethodInterceptor, Serializable {
|
||||
|
||||
@Nullable
|
||||
private final Object target;
|
||||
private final @Nullable Object target;
|
||||
|
||||
public StaticUnadvisedInterceptor(@Nullable Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
public @Nullable Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
Object retVal = AopUtils.invokeJoinpointUsingReflection(this.target, method, args);
|
||||
return processReturnType(proxy, this.target, method, args, retVal);
|
||||
}
|
||||
|
@ -477,16 +472,14 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
*/
|
||||
private static class StaticUnadvisedExposedInterceptor implements MethodInterceptor, Serializable {
|
||||
|
||||
@Nullable
|
||||
private final Object target;
|
||||
private final @Nullable Object target;
|
||||
|
||||
public StaticUnadvisedExposedInterceptor(@Nullable Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
public @Nullable Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
Object oldProxy = null;
|
||||
try {
|
||||
oldProxy = AopContext.setCurrentProxy(proxy);
|
||||
|
@ -514,8 +507,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
public @Nullable Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
Object target = this.targetSource.getTarget();
|
||||
try {
|
||||
Object retVal = AopUtils.invokeJoinpointUsingReflection(target, method, args);
|
||||
|
@ -542,8 +534,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
public @Nullable Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
Object oldProxy = null;
|
||||
Object target = this.targetSource.getTarget();
|
||||
try {
|
||||
|
@ -568,16 +559,14 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
*/
|
||||
private static class StaticDispatcher implements Dispatcher, Serializable {
|
||||
|
||||
@Nullable
|
||||
private final Object target;
|
||||
private final @Nullable Object target;
|
||||
|
||||
public StaticDispatcher(@Nullable Object target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object loadObject() {
|
||||
public @Nullable Object loadObject() {
|
||||
return this.target;
|
||||
}
|
||||
}
|
||||
|
@ -655,11 +644,9 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
|
||||
private final List<Object> adviceChain;
|
||||
|
||||
@Nullable
|
||||
private final Object target;
|
||||
private final @Nullable Object target;
|
||||
|
||||
@Nullable
|
||||
private final Class<?> targetClass;
|
||||
private final @Nullable Class<?> targetClass;
|
||||
|
||||
public FixedChainStaticTargetInterceptor(
|
||||
List<Object> adviceChain, @Nullable Object target, @Nullable Class<?> targetClass) {
|
||||
|
@ -670,8 +657,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
public @Nullable Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
MethodInvocation invocation = new ReflectiveMethodInvocation(
|
||||
proxy, this.target, method, args, this.targetClass, this.adviceChain);
|
||||
// If we get here, we need to create a MethodInvocation.
|
||||
|
@ -695,8 +681,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
public @Nullable Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
|
||||
Object oldProxy = null;
|
||||
boolean setProxyContext = false;
|
||||
Object target = null;
|
||||
|
|
|
@ -19,10 +19,10 @@ package org.springframework.aop.framework;
|
|||
import kotlin.coroutines.Continuation;
|
||||
import kotlinx.coroutines.reactive.ReactiveFlowKt;
|
||||
import kotlinx.coroutines.reactor.MonoKt;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.reactivestreams.Publisher;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Package-visible class designed to avoid a hard dependency on Kotlin and Coroutines dependency at runtime.
|
||||
|
@ -41,9 +41,8 @@ abstract class CoroutinesUtils {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
static Object awaitSingleOrNull(@Nullable Object value, Object continuation) {
|
||||
static @Nullable Object awaitSingleOrNull(@Nullable Object value, Object continuation) {
|
||||
return MonoKt.awaitSingleOrNull(value instanceof Mono mono ? mono : Mono.justOrEmpty(value),
|
||||
(Continuation<Object>) continuation);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
|
||||
import org.aopalliance.intercept.Interceptor;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.IntroductionAdvisor;
|
||||
|
@ -32,7 +33,6 @@ import org.springframework.aop.MethodMatcher;
|
|||
import org.springframework.aop.PointcutAdvisor;
|
||||
import org.springframework.aop.framework.adapter.AdvisorAdapterRegistry;
|
||||
import org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A simple but definitive way of working out an advice chain for a Method,
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
|||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AopInvocationException;
|
||||
import org.springframework.aop.RawTargetAccess;
|
||||
|
@ -35,7 +36,6 @@ import org.springframework.aop.support.AopUtils;
|
|||
import org.springframework.core.DecoratingProxy;
|
||||
import org.springframework.core.KotlinDetector;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -163,8 +163,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
|||
* unless a hook method throws an exception.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
Object oldProxy = null;
|
||||
boolean setProxyContext = false;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
package org.springframework.aop.framework;
|
||||
|
||||
import org.aopalliance.intercept.Interceptor;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.aopalliance.aop.Advice;
|
|||
import org.aopalliance.intercept.Interceptor;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.TargetSource;
|
||||
|
@ -43,7 +44,6 @@ import org.springframework.beans.factory.FactoryBean;
|
|||
import org.springframework.beans.factory.FactoryBeanNotInitializedException;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
@ -101,11 +101,9 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
|
||||
private static final Log logger = LogFactory.getLog(ProxyFactoryBean.class);
|
||||
|
||||
@Nullable
|
||||
private String[] interceptorNames;
|
||||
private String @Nullable [] interceptorNames;
|
||||
|
||||
@Nullable
|
||||
private String targetName;
|
||||
private @Nullable String targetName;
|
||||
|
||||
private boolean autodetectInterfaces = true;
|
||||
|
||||
|
@ -115,20 +113,17 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
|
||||
private boolean freezeProxy = false;
|
||||
|
||||
@Nullable
|
||||
private transient ClassLoader proxyClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
private transient @Nullable ClassLoader proxyClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
private transient boolean classLoaderConfigured = false;
|
||||
|
||||
@Nullable
|
||||
private transient BeanFactory beanFactory;
|
||||
private transient @Nullable BeanFactory beanFactory;
|
||||
|
||||
/** Whether the advisor chain has already been initialized. */
|
||||
private boolean advisorChainInitialized = false;
|
||||
|
||||
/** If this is a singleton, the cached singleton proxy instance. */
|
||||
@Nullable
|
||||
private Object singletonInstance;
|
||||
private @Nullable Object singletonInstance;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -246,8 +241,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
* @return a fresh AOP proxy reflecting the current state of this factory
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getObject() throws BeansException {
|
||||
public @Nullable Object getObject() throws BeansException {
|
||||
initializeAdvisorChain();
|
||||
if (isSingleton()) {
|
||||
return getSingletonInstance();
|
||||
|
@ -268,8 +262,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
* @see org.springframework.aop.framework.AopProxy#getProxyClass
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
public @Nullable Class<?> getObjectType() {
|
||||
synchronized (this) {
|
||||
if (this.singletonInstance != null) {
|
||||
return this.singletonInstance.getClass();
|
||||
|
|
|
@ -18,12 +18,13 @@ package org.springframework.aop.framework;
|
|||
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.Aware;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
@ -45,8 +46,7 @@ public class ProxyProcessorSupport extends ProxyConfig implements Ordered, BeanC
|
|||
*/
|
||||
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
@Nullable
|
||||
private ClassLoader proxyClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
private @Nullable ClassLoader proxyClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
private boolean classLoaderConfigured = false;
|
||||
|
||||
|
@ -80,8 +80,7 @@ public class ProxyProcessorSupport extends ProxyConfig implements Ordered, BeanC
|
|||
/**
|
||||
* Return the configured proxy ClassLoader for this processor.
|
||||
*/
|
||||
@Nullable
|
||||
protected ClassLoader getProxyClassLoader() {
|
||||
protected @Nullable ClassLoader getProxyClassLoader() {
|
||||
return this.proxyClassLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ import java.util.Map;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ProxyMethodInvocation;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.core.BridgeMethodResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring's implementation of the AOP Alliance
|
||||
|
@ -63,21 +63,18 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
|
||||
protected final Object proxy;
|
||||
|
||||
@Nullable
|
||||
protected final Object target;
|
||||
protected final @Nullable Object target;
|
||||
|
||||
protected final Method method;
|
||||
|
||||
protected Object[] arguments;
|
||||
|
||||
@Nullable
|
||||
private final Class<?> targetClass;
|
||||
private final @Nullable Class<?> targetClass;
|
||||
|
||||
/**
|
||||
* Lazily initialized map of user-specific attributes for this invocation.
|
||||
*/
|
||||
@Nullable
|
||||
private Map<String, Object> userAttributes;
|
||||
private @Nullable Map<String, Object> userAttributes;
|
||||
|
||||
/**
|
||||
* List of MethodInterceptor and InterceptorAndDynamicMethodMatcher
|
||||
|
@ -106,7 +103,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
* but would complicate the code. And it would work only for static pointcuts.
|
||||
*/
|
||||
protected ReflectiveMethodInvocation(
|
||||
Object proxy, @Nullable Object target, Method method, @Nullable Object[] arguments,
|
||||
Object proxy, @Nullable Object target, Method method, Object @Nullable [] arguments,
|
||||
@Nullable Class<?> targetClass, List<Object> interceptorsAndDynamicMethodMatchers) {
|
||||
|
||||
this.proxy = proxy;
|
||||
|
@ -124,8 +121,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final Object getThis() {
|
||||
public final @Nullable Object getThis() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
|
@ -156,8 +152,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object proceed() throws Throwable {
|
||||
public @Nullable Object proceed() throws Throwable {
|
||||
// We start with an index of -1 and increment early.
|
||||
if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {
|
||||
return invokeJoinpoint();
|
||||
|
@ -191,8 +186,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
* @return the return value of the joinpoint
|
||||
* @throws Throwable if invoking the joinpoint resulted in an exception
|
||||
*/
|
||||
@Nullable
|
||||
protected Object invokeJoinpoint() throws Throwable {
|
||||
protected @Nullable Object invokeJoinpoint() throws Throwable {
|
||||
return AopUtils.invokeJoinpointUsingReflection(this.target, this.method, this.arguments);
|
||||
}
|
||||
|
||||
|
@ -260,8 +254,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getUserAttribute(String key) {
|
||||
public @Nullable Object getUserAttribute(String key) {
|
||||
return (this.userAttributes != null ? this.userAttributes.get(key) : null);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ import java.io.Serializable;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.aop.AfterReturningAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -52,8 +52,7 @@ public class AfterReturningAdviceInterceptor implements MethodInterceptor, After
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
Object retVal = mi.proceed();
|
||||
this.advice.afterReturning(retVal, mi.getMethod(), mi.getArguments(), mi.getThis());
|
||||
return retVal;
|
||||
|
|
|
@ -20,10 +20,10 @@ import java.io.Serializable;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.BeforeAdvice;
|
||||
import org.springframework.aop.MethodBeforeAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -52,8 +52,7 @@ public class MethodBeforeAdviceInterceptor implements MethodInterceptor, BeforeA
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
this.advice.before(mi.getMethod(), mi.getArguments(), mi.getThis());
|
||||
return mi.proceed();
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ import org.aopalliance.intercept.MethodInterceptor;
|
|||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -131,8 +131,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
try {
|
||||
return mi.proceed();
|
||||
}
|
||||
|
@ -150,8 +149,7 @@ public class ThrowsAdviceInterceptor implements MethodInterceptor, AfterAdvice {
|
|||
* @param exception the exception thrown
|
||||
* @return a handler for the given exception type, or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
private Method getExceptionHandler(Throwable exception) {
|
||||
private @Nullable Method getExceptionHandler(Throwable exception) {
|
||||
Class<?> exceptionClass = exception.getClass();
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Trying to find handler for exception of type [" + exceptionClass.getName() + "]");
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
*
|
||||
* <p>These adapters do not depend on any other Spring framework classes to allow such usage.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.framework.adapter;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.springframework.aop.framework.autoproxy;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
|
@ -26,7 +28,6 @@ import org.springframework.beans.factory.BeanCreationException;
|
|||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -53,8 +54,7 @@ import org.springframework.util.Assert;
|
|||
@SuppressWarnings("serial")
|
||||
public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyCreator {
|
||||
|
||||
@Nullable
|
||||
private BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;
|
||||
private @Nullable BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -73,8 +73,7 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(
|
||||
protected Object @Nullable [] getAdvicesAndAdvisorsForBean(
|
||||
Class<?> beanClass, String beanName, @Nullable TargetSource targetSource) {
|
||||
|
||||
List<Advisor> advisors = findEligibleAdvisors(beanClass, beanName);
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import org.aopalliance.aop.Advice;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.Pointcut;
|
||||
|
@ -48,7 +49,6 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
|||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor;
|
||||
import org.springframework.core.SmartClassLoader;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -101,8 +101,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* Convenience constant for subclasses: Return value for "do not proxy".
|
||||
* @see #getAdvicesAndAdvisorsForBean
|
||||
*/
|
||||
@Nullable
|
||||
protected static final Object[] DO_NOT_PROXY = null;
|
||||
protected static final Object @Nullable [] DO_NOT_PROXY = null;
|
||||
|
||||
/**
|
||||
* Convenience constant for subclasses: Return value for
|
||||
|
@ -129,11 +128,9 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
|
||||
private boolean applyCommonInterceptorsFirst = true;
|
||||
|
||||
@Nullable
|
||||
private TargetSourceCreator[] customTargetSourceCreators;
|
||||
private TargetSourceCreator @Nullable [] customTargetSourceCreators;
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
private final Set<String> targetSourcedBeans = ConcurrentHashMap.newKeySet(16);
|
||||
|
||||
|
@ -215,15 +212,13 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* Return the owning {@link BeanFactory}.
|
||||
* May be {@code null}, as this post-processor doesn't need to belong to a bean factory.
|
||||
*/
|
||||
@Nullable
|
||||
protected BeanFactory getBeanFactory() {
|
||||
protected @Nullable BeanFactory getBeanFactory() {
|
||||
return this.beanFactory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
|
||||
public @Nullable Class<?> predictBeanType(Class<?> beanClass, String beanName) {
|
||||
if (this.proxyTypes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -256,8 +251,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) {
|
||||
public Constructor<?> @Nullable [] determineCandidateConstructors(Class<?> beanClass, String beanName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -269,8 +263,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
|
||||
public @Nullable Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
|
||||
Object cacheKey = getCacheKey(beanClass, beanName);
|
||||
|
||||
if (!StringUtils.hasLength(beanName) || !this.targetSourcedBeans.contains(beanName)) {
|
||||
|
@ -311,8 +304,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* @see #getAdvicesAndAdvisorsForBean
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object postProcessAfterInitialization(@Nullable Object bean, String beanName) {
|
||||
public @Nullable Object postProcessAfterInitialization(@Nullable Object bean, String beanName) {
|
||||
if (bean != null) {
|
||||
Object cacheKey = getCacheKey(bean.getClass(), beanName);
|
||||
if (this.earlyBeanReferences.remove(cacheKey) != bean) {
|
||||
|
@ -426,8 +418,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* @return a TargetSource for this bean
|
||||
* @see #setCustomTargetSourceCreators
|
||||
*/
|
||||
@Nullable
|
||||
protected TargetSource getCustomTargetSource(Class<?> beanClass, String beanName) {
|
||||
protected @Nullable TargetSource getCustomTargetSource(Class<?> beanClass, String beanName) {
|
||||
// We can't create fancy target sources for directly registered singletons.
|
||||
if (this.customTargetSourceCreators != null &&
|
||||
this.beanFactory != null && this.beanFactory.containsBean(beanName)) {
|
||||
|
@ -460,19 +451,19 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* @see #buildAdvisors
|
||||
*/
|
||||
protected Object createProxy(Class<?> beanClass, @Nullable String beanName,
|
||||
@Nullable Object[] specificInterceptors, TargetSource targetSource) {
|
||||
Object @Nullable [] specificInterceptors, TargetSource targetSource) {
|
||||
|
||||
return buildProxy(beanClass, beanName, specificInterceptors, targetSource, false);
|
||||
}
|
||||
|
||||
private Class<?> createProxyClass(Class<?> beanClass, @Nullable String beanName,
|
||||
@Nullable Object[] specificInterceptors, TargetSource targetSource) {
|
||||
Object @Nullable [] specificInterceptors, TargetSource targetSource) {
|
||||
|
||||
return (Class<?>) buildProxy(beanClass, beanName, specificInterceptors, targetSource, true);
|
||||
}
|
||||
|
||||
private Object buildProxy(Class<?> beanClass, @Nullable String beanName,
|
||||
@Nullable Object[] specificInterceptors, TargetSource targetSource, boolean classOnly) {
|
||||
Object @Nullable [] specificInterceptors, TargetSource targetSource, boolean classOnly) {
|
||||
|
||||
if (this.beanFactory instanceof ConfigurableListableBeanFactory clbf) {
|
||||
AutoProxyUtils.exposeTargetClass(clbf, beanName, beanClass);
|
||||
|
@ -554,7 +545,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* specific to this bean (may be empty, but not null)
|
||||
* @return the list of Advisors for the given bean
|
||||
*/
|
||||
protected Advisor[] buildAdvisors(@Nullable String beanName, @Nullable Object[] specificInterceptors) {
|
||||
protected Advisor[] buildAdvisors(@Nullable String beanName, Object @Nullable [] specificInterceptors) {
|
||||
// Handle prototypes correctly...
|
||||
Advisor[] commonInterceptors = resolveInterceptorNames();
|
||||
|
||||
|
@ -633,8 +624,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
|
|||
* @see #DO_NOT_PROXY
|
||||
* @see #PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName,
|
||||
protected abstract Object @Nullable [] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName,
|
||||
@Nullable TargetSource customTargetSource) throws BeansException;
|
||||
|
||||
}
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Extension of {@link AbstractAutoProxyCreator} which implements {@link BeanFactoryAware},
|
||||
|
@ -40,8 +41,7 @@ import org.springframework.lang.Nullable;
|
|||
public abstract class AbstractBeanFactoryAwareAdvisingPostProcessor extends AbstractAdvisingBeanPostProcessor
|
||||
implements BeanFactoryAware {
|
||||
|
||||
@Nullable
|
||||
private ConfigurableListableBeanFactory beanFactory;
|
||||
private @Nullable ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -84,8 +85,7 @@ public abstract class AutoProxyUtils {
|
|||
* @since 4.2.3
|
||||
* @see org.springframework.beans.factory.BeanFactory#getType(String)
|
||||
*/
|
||||
@Nullable
|
||||
public static Class<?> determineTargetClass(
|
||||
public static @Nullable Class<?> determineTargetClass(
|
||||
ConfigurableListableBeanFactory beanFactory, @Nullable String beanName) {
|
||||
|
||||
if (beanName == null) {
|
||||
|
|
|
@ -21,13 +21,13 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.BeanCurrentlyInCreationException;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -44,8 +44,7 @@ public class BeanFactoryAdvisorRetrievalHelper {
|
|||
|
||||
private final ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
@Nullable
|
||||
private volatile String[] cachedAdvisorBeanNames;
|
||||
private volatile String @Nullable [] cachedAdvisorBeanNames;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,10 +19,11 @@ package org.springframework.aop.framework.autoproxy;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
|
@ -48,8 +49,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
|||
|
||||
private static final String[] NO_ALIASES = new String[0];
|
||||
|
||||
@Nullable
|
||||
private List<String> beanNames;
|
||||
private @Nullable List<String> beanNames;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -81,8 +81,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
|||
* @see #setBeanNames(String...)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected TargetSource getCustomTargetSource(Class<?> beanClass, String beanName) {
|
||||
protected @Nullable TargetSource getCustomTargetSource(Class<?> beanClass, String beanName) {
|
||||
return (isSupportedBeanName(beanClass, beanName) ?
|
||||
super.getCustomTargetSource(beanClass, beanName) : null);
|
||||
}
|
||||
|
@ -93,8 +92,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
|||
* @see #setBeanNames(String...)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(
|
||||
protected Object @Nullable [] getAdvicesAndAdvisorsForBean(
|
||||
Class<?> beanClass, String beanName, @Nullable TargetSource targetSource) {
|
||||
|
||||
return (isSupportedBeanName(beanClass, beanName) ?
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@code BeanPostProcessor} implementation that creates AOP proxies based on all
|
||||
|
@ -44,8 +45,7 @@ public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCrea
|
|||
|
||||
private boolean usePrefix = false;
|
||||
|
||||
@Nullable
|
||||
private String advisorBeanNamePrefix;
|
||||
private @Nullable String advisorBeanNamePrefix;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -78,8 +78,7 @@ public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCrea
|
|||
* Return the prefix for bean names that will cause them to be included
|
||||
* for auto-proxying by this object.
|
||||
*/
|
||||
@Nullable
|
||||
public String getAdvisorBeanNamePrefix() {
|
||||
public @Nullable String getAdvisorBeanNamePrefix() {
|
||||
return this.advisorBeanNamePrefix;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Auto-proxy creator that considers infrastructure Advisor beans only,
|
||||
|
@ -30,8 +31,7 @@ import org.springframework.lang.Nullable;
|
|||
@SuppressWarnings("serial")
|
||||
public class InfrastructureAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator {
|
||||
|
||||
@Nullable
|
||||
private ConfigurableListableBeanFactory beanFactory;
|
||||
private @Nullable ConfigurableListableBeanFactory beanFactory;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Holder for the current proxy creation context, as exposed by auto-proxy creators
|
||||
|
@ -42,8 +43,7 @@ public final class ProxyCreationContext {
|
|||
* Return the name of the currently proxied bean instance.
|
||||
* @return the name of the bean, or {@code null} if none available
|
||||
*/
|
||||
@Nullable
|
||||
public static String getCurrentProxiedBeanName() {
|
||||
public static @Nullable String getCurrentProxiedBeanName() {
|
||||
return currentProxiedBeanName.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Implementations can create special target sources, such as pooling target
|
||||
|
@ -40,7 +41,6 @@ public interface TargetSourceCreator {
|
|||
* @return a special TargetSource or {@code null} if this TargetSourceCreator isn't
|
||||
* interested in the particular bean
|
||||
*/
|
||||
@Nullable
|
||||
TargetSource getTargetSource(Class<?> beanClass, String beanName);
|
||||
@Nullable TargetSource getTargetSource(Class<?> beanClass, String beanName);
|
||||
|
||||
}
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
* as post-processors beans are only automatically detected in application contexts.
|
||||
* Post-processors can be explicitly registered on a ConfigurableBeanFactory instead.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.framework.autoproxy;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.framework.AopInfrastructureBean;
|
||||
|
@ -33,7 +34,6 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
|||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -59,8 +59,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
|
|||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private ConfigurableBeanFactory beanFactory;
|
||||
private @Nullable ConfigurableBeanFactory beanFactory;
|
||||
|
||||
/** Internally used DefaultListableBeanFactory instances, keyed by bean name. */
|
||||
private final Map<String, DefaultListableBeanFactory> internalBeanFactories = new HashMap<>();
|
||||
|
@ -78,8 +77,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
|
|||
/**
|
||||
* Return the BeanFactory that this TargetSourceCreators runs in.
|
||||
*/
|
||||
@Nullable
|
||||
protected final BeanFactory getBeanFactory() {
|
||||
protected final @Nullable BeanFactory getBeanFactory() {
|
||||
return this.beanFactory;
|
||||
}
|
||||
|
||||
|
@ -94,8 +92,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
|
|||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final TargetSource getTargetSource(Class<?> beanClass, String beanName) {
|
||||
public final @Nullable TargetSource getTargetSource(Class<?> beanClass, String beanName) {
|
||||
AbstractBeanFactoryBasedTargetSource targetSource =
|
||||
createBeanFactoryBasedTargetSource(beanClass, beanName);
|
||||
if (targetSource == null) {
|
||||
|
@ -195,8 +192,7 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
|
|||
* @param beanName the name of the bean
|
||||
* @return the AbstractPrototypeBasedTargetSource, or {@code null} if we don't match this
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
protected abstract @Nullable AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
Class<?> beanClass, String beanName);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy.target;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource;
|
||||
import org.springframework.aop.target.LazyInitTargetSource;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@code TargetSourceCreator} that enforces a {@link LazyInitTargetSource} for
|
||||
|
@ -62,8 +63,7 @@ public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetS
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
protected @Nullable AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
Class<?> beanClass, String beanName) {
|
||||
|
||||
if (getBeanFactory() instanceof ConfigurableListableBeanFactory clbf) {
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
|
||||
package org.springframework.aop.framework.autoproxy.target;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource;
|
||||
import org.springframework.aop.target.CommonsPool2TargetSource;
|
||||
import org.springframework.aop.target.PrototypeTargetSource;
|
||||
import org.springframework.aop.target.ThreadLocalTargetSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Convenient TargetSourceCreator using bean name prefixes to create one of three
|
||||
|
@ -55,8 +56,7 @@ public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSour
|
|||
public static final String PREFIX_PROTOTYPE = "!";
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
protected final @Nullable AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(
|
||||
Class<?> beanClass, String beanName) {
|
||||
|
||||
if (beanName.startsWith(PREFIX_COMMONS_POOL)) {
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
* Various {@link org.springframework.aop.framework.autoproxy.TargetSourceCreator}
|
||||
* implementations for use with Spring's AOP auto-proxying support.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.framework.autoproxy.target;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
* or ApplicationContext. However, proxies can be created programmatically using the
|
||||
* ProxyFactory class.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.framework;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -19,8 +19,7 @@ package org.springframework.aop.interceptor;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Base class for monitoring interceptors, such as performance monitors.
|
||||
|
|
|
@ -22,9 +22,9 @@ import org.aopalliance.intercept.MethodInterceptor;
|
|||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -52,8 +52,7 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
|
|||
* The default {@code Log} instance used to write trace messages.
|
||||
* This instance is mapped to the implementing {@code Class}.
|
||||
*/
|
||||
@Nullable
|
||||
protected transient Log defaultLogger = LogFactory.getLog(getClass());
|
||||
protected transient @Nullable Log defaultLogger = LogFactory.getLog(getClass());
|
||||
|
||||
/**
|
||||
* Indicates whether proxy class names should be hidden when using dynamic loggers.
|
||||
|
@ -125,8 +124,7 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
|
|||
* @see #invokeUnderTrace(org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
Log logger = getLoggerForInvocation(invocation);
|
||||
if (isInterceptorEnabled(invocation, logger)) {
|
||||
return invokeUnderTrace(invocation, logger);
|
||||
|
@ -245,7 +243,6 @@ public abstract class AbstractTraceInterceptor implements MethodInterceptor, Ser
|
|||
* @see #writeToLog(Log, String)
|
||||
* @see #writeToLog(Log, String, Throwable)
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable;
|
||||
protected abstract @Nullable Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable;
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
|
@ -38,7 +39,6 @@ import org.springframework.beans.factory.config.EmbeddedValueResolver;
|
|||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.core.task.support.TaskExecutorAdapter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
@ -78,11 +78,9 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
|||
|
||||
private SingletonSupplier<AsyncUncaughtExceptionHandler> exceptionHandler;
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
@Nullable
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
private @Nullable StringValueResolver embeddedValueResolver;
|
||||
|
||||
private final Map<Method, AsyncTaskExecutor> executors = new ConcurrentHashMap<>(16);
|
||||
|
||||
|
@ -167,8 +165,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
|||
* Determine the specific executor to use when executing the given method.
|
||||
* @return the executor to use (or {@code null}, but just if no default executor is available)
|
||||
*/
|
||||
@Nullable
|
||||
protected AsyncTaskExecutor determineAsyncExecutor(Method method) {
|
||||
protected @Nullable AsyncTaskExecutor determineAsyncExecutor(Method method) {
|
||||
AsyncTaskExecutor executor = this.executors.get(method);
|
||||
if (executor == null) {
|
||||
Executor targetExecutor;
|
||||
|
@ -203,8 +200,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
|||
* @see #determineAsyncExecutor(Method)
|
||||
* @see #findQualifiedExecutor(BeanFactory, String)
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract String getExecutorQualifier(Method method);
|
||||
protected abstract @Nullable String getExecutorQualifier(Method method);
|
||||
|
||||
/**
|
||||
* Retrieve a target executor for the given qualifier.
|
||||
|
@ -213,8 +209,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
|||
* @since 4.2.6
|
||||
* @see #getExecutorQualifier(Method)
|
||||
*/
|
||||
@Nullable
|
||||
protected Executor findQualifiedExecutor(@Nullable BeanFactory beanFactory, String qualifier) {
|
||||
protected @Nullable Executor findQualifiedExecutor(@Nullable BeanFactory beanFactory, String qualifier) {
|
||||
if (beanFactory == null) {
|
||||
throw new IllegalStateException("BeanFactory must be set on " + getClass().getSimpleName() +
|
||||
" to access qualified executor '" + qualifier + "'");
|
||||
|
@ -234,8 +229,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
|||
* @see #findQualifiedExecutor(BeanFactory, String)
|
||||
* @see #DEFAULT_TASK_EXECUTOR_BEAN_NAME
|
||||
*/
|
||||
@Nullable
|
||||
protected Executor getDefaultExecutor(@Nullable BeanFactory beanFactory) {
|
||||
protected @Nullable Executor getDefaultExecutor(@Nullable BeanFactory beanFactory) {
|
||||
if (beanFactory != null) {
|
||||
try {
|
||||
// Search for TaskExecutor bean... not plain Executor since that would
|
||||
|
@ -281,8 +275,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
|
|||
* @param returnType the declared return type (potentially a {@link Future} variant)
|
||||
* @return the execution result (potentially a corresponding {@link Future} handle)
|
||||
*/
|
||||
@Nullable
|
||||
protected Object doSubmit(Callable<Object> task, AsyncTaskExecutor executor, Class<?> returnType) {
|
||||
protected @Nullable Object doSubmit(Callable<Object> task, AsyncTaskExecutor executor, Class<?> returnType) {
|
||||
if (CompletableFuture.class.isAssignableFrom(returnType)) {
|
||||
return executor.submitCompletable(task);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.concurrent.Future;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
@ -31,7 +32,6 @@ import org.springframework.core.BridgeMethodResolver;
|
|||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* AOP Alliance {@code MethodInterceptor} that processes method invocations
|
||||
|
@ -97,9 +97,8 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport imple
|
|||
* otherwise.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
@SuppressWarnings("NullAway")
|
||||
public Object invoke(final MethodInvocation invocation) throws Throwable {
|
||||
public @Nullable Object invoke(final MethodInvocation invocation) throws Throwable {
|
||||
Class<?> targetClass = (invocation.getThis() != null ? AopUtils.getTargetClass(invocation.getThis()) : null);
|
||||
final Method userMethod = BridgeMethodResolver.getMostSpecificMethod(invocation.getMethod(), targetClass);
|
||||
|
||||
|
@ -140,8 +139,7 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport imple
|
|||
* @see #determineAsyncExecutor(Method)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected String getExecutorQualifier(Method method) {
|
||||
protected @Nullable String getExecutorQualifier(Method method) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -154,8 +152,7 @@ public class AsyncExecutionInterceptor extends AsyncExecutionAspectSupport imple
|
|||
* @see #DEFAULT_TASK_EXECUTOR_BEAN_NAME
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected Executor getDefaultExecutor(@Nullable BeanFactory beanFactory) {
|
||||
protected @Nullable Executor getDefaultExecutor(@Nullable BeanFactory beanFactory) {
|
||||
Executor defaultExecutor = super.getDefaultExecutor(beanFactory);
|
||||
return (defaultExecutor != null ? defaultExecutor : new SimpleAsyncTaskExecutor());
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ import java.io.Serializable;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ConcurrencyThrottleSupport;
|
||||
|
||||
/**
|
||||
|
@ -49,8 +49,7 @@ public class ConcurrencyThrottleInterceptor extends ConcurrencyThrottleSupport
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
beforeAccess();
|
||||
try {
|
||||
return methodInvocation.proceed();
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.regex.Pattern;
|
|||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
package org.springframework.aop.interceptor;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* AOP Alliance {@code MethodInterceptor} that can be introduced in a chain
|
||||
|
@ -58,8 +57,7 @@ public class DebugInterceptor extends SimpleTraceInterceptor {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
synchronized (this) {
|
||||
this.count++;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.springframework.aop.interceptor;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.ProxyMethodInvocation;
|
||||
|
@ -25,7 +26,6 @@ import org.springframework.aop.support.DefaultIntroductionAdvisor;
|
|||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||
import org.springframework.beans.factory.NamedBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Convenient methods for creating advisors that may be used when autoproxying beans
|
||||
|
@ -110,8 +110,7 @@ public abstract class ExposeBeanNameAdvisors {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
if (!(mi instanceof ProxyMethodInvocation pmi)) {
|
||||
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
|
||||
}
|
||||
|
@ -134,8 +133,7 @@ public abstract class ExposeBeanNameAdvisors {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
if (!(mi instanceof ProxyMethodInvocation pmi)) {
|
||||
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ import java.io.Serializable;
|
|||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.core.PriorityOrdered;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interceptor that exposes the current {@link org.aopalliance.intercept.MethodInvocation}
|
||||
|
@ -89,8 +89,7 @@ public final class ExposeInvocationInterceptor implements MethodInterceptor, Pri
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
MethodInvocation oldInvocation = invocation.get();
|
||||
invocation.set(mi);
|
||||
try {
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
* More specific interceptors can be found in corresponding
|
||||
* functionality packages, like "transaction" and "orm".
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop.interceptor;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
* <p>Spring AOP can be used programmatically or (preferably)
|
||||
* integrated with the Spring IoC container.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.aop;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue