Add missing @Nullable annotations on parameters
Issue: SPR-15540
This commit is contained in:
parent
ad2c0f8410
commit
b47d713e14
|
@ -19,6 +19,8 @@ package org.springframework.aop;
|
|||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Canonical MethodMatcher instance that matches all methods.
|
||||
*
|
||||
|
@ -43,12 +45,12 @@ class TrueMethodMatcher implements MethodMatcher, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
// Should never be invoked as isRuntime returns false.
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -698,7 +698,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return !this.adviceMethod.equals(method);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class AspectJAfterReturningAdvice extends AbstractAspectJAdvice
|
|||
}
|
||||
|
||||
@Override
|
||||
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
|
||||
public void afterReturning(@Nullable Object returnValue, Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
if (shouldInvokeOnReturnValueOf(method, returnValue)) {
|
||||
invokeAdviceMethod(getJoinPointMatch(), returnValue, null);
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, boolean beanHasIntroductions) {
|
||||
checkReadyToMatch();
|
||||
Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||
ShadowMatch shadowMatch = getShadowMatch(targetMethod, method);
|
||||
|
@ -306,7 +306,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return matches(method, targetClass, false);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
checkReadyToMatch();
|
||||
ShadowMatch shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
|
||||
ShadowMatch originalShadowMatch = getShadowMatch(method, method);
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.aop.MethodBeforeAdvice;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Spring AOP advice that wraps an AspectJ before method.
|
||||
|
@ -39,7 +40,7 @@ public class AspectJMethodBeforeAdvice extends AbstractAspectJAdvice implements
|
|||
|
||||
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
invokeAdviceMethod(getJoinPointMatch(), null, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ 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;
|
||||
|
||||
/**
|
||||
* Internal implementation of AspectJPointcutAdvisor.
|
||||
|
@ -274,14 +275,14 @@ class InstantiationModelAwarePointcutAdvisorImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
// We're either instantiated and matching on declared pointcut, or uninstantiated matching on either pointcut
|
||||
return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass)) ||
|
||||
this.preInstantiationPointcut.getMethodMatcher().matches(method, targetClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
// This can match only on declared pointcut.
|
||||
return (isAspectMaterialized() && this.declaredPointcut.matches(method, targetClass));
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto
|
|||
public SyntheticInstantiationAdvisor(final MetadataAwareAspectInstanceFactory aif) {
|
||||
super(aif.getAspectMetadata().getPerClausePointcut(), new MethodBeforeAdvice() {
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) {
|
||||
public void before(Method method, Object[] args, @Nullable Object target) {
|
||||
// Simply instantiate the aspect
|
||||
aif.getAspectInstance();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -123,7 +124,7 @@ public abstract class AbstractSingletonProxyFactoryBean extends ProxyConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
if (this.proxyClassLoader == null) {
|
||||
this.proxyClassLoader = classLoader;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getProxy(ClassLoader classLoader) {
|
||||
public Object getProxy(@Nullable ClassLoader classLoader) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating CGLIB proxy: target source is " + this.advised.getTargetSource());
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.springframework.aop.PointcutAdvisor;
|
|||
import org.springframework.aop.framework.adapter.AdvisorAdapterRegistry;
|
||||
import org.springframework.aop.framework.adapter.GlobalAdvisorAdapterRegistry;
|
||||
import org.springframework.aop.support.MethodMatchers;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A simple but definitive way of working out an advice chain for a Method,
|
||||
|
@ -48,7 +49,7 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
|
|||
|
||||
@Override
|
||||
public List<Object> getInterceptorsAndDynamicInterceptionAdvice(
|
||||
Advised config, Method method, Class<?> targetClass) {
|
||||
Advised config, Method method, @Nullable Class<?> targetClass) {
|
||||
|
||||
// This is somewhat tricky... We have to process introductions first,
|
||||
// but we need to preserve order in the ultimate list.
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.springframework.aop.RawTargetAccess;
|
|||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.core.DecoratingProxy;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -113,7 +114,7 @@ final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializa
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getProxy(ClassLoader classLoader) {
|
||||
public Object getProxy(@Nullable ClassLoader classLoader) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating JDK dynamic proxy: target source is " + this.advised.getTargetSource());
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ 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.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
@ -213,13 +214,13 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
|
|||
* containing BeanFactory for loading all bean classes. This can be
|
||||
* overridden here for specific proxies.
|
||||
*/
|
||||
public void setProxyClassLoader(ClassLoader classLoader) {
|
||||
public void setProxyClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.proxyClassLoader = classLoader;
|
||||
this.classLoaderConfigured = (classLoader != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
if (!this.classLoaderConfigured) {
|
||||
this.proxyClassLoader = classLoader;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ 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;
|
||||
|
||||
|
@ -81,7 +82,7 @@ public class ProxyProcessorSupport extends ProxyConfig implements Ordered, BeanC
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
if (!this.classLoaderConfigured) {
|
||||
this.proxyClassLoader = classLoader;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.aopalliance.intercept.MethodInvocation;
|
|||
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
|
||||
|
@ -240,7 +241,7 @@ public class ReflectiveMethodInvocation implements ProxyMethodInvocation, Clonea
|
|||
|
||||
|
||||
@Override
|
||||
public void setUserAttribute(String key, Object value) {
|
||||
public void setUserAttribute(String key, @Nullable Object value) {
|
||||
if (value != null) {
|
||||
if (this.userAttributes == null) {
|
||||
this.userAttributes = new HashMap<>();
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.aop.support.AopUtils;
|
|||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Generic auto proxy creator that builds AOP proxies for specific beans
|
||||
|
@ -66,7 +67,8 @@ public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyC
|
|||
|
||||
|
||||
@Override
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) {
|
||||
@Nullable
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, @Nullable TargetSource targetSource) {
|
||||
List<Advisor> advisors = findEligibleAdvisors(beanClass, beanName);
|
||||
if (advisors.isEmpty()) {
|
||||
return DO_NOT_PROXY;
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
|||
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;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -73,7 +74,8 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
|
|||
* Identify as bean to proxy if the bean name is in the configured list of names.
|
||||
*/
|
||||
@Override
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) {
|
||||
@Nullable
|
||||
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, @Nullable TargetSource targetSource) {
|
||||
if (this.beanNames != null) {
|
||||
for (String mappedName : this.beanNames) {
|
||||
if (FactoryBean.class.isAssignableFrom(beanClass)) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
@ -129,7 +130,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
|
|||
* plus the name of the method.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return ((targetClass != null && matchesPattern(ClassUtils.getQualifiedMethodName(method, targetClass))) ||
|
||||
matchesPattern(ClassUtils.getQualifiedMethodName(method)));
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
* some candidate classes.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class ControlFlowPointcut implements Pointcut, ClassFilter, MethodMatcher
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
this.evaluations++;
|
||||
|
||||
for (StackTraceElement element : new Throwable().getStackTrace()) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.aop.support;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.aop.MethodMatcher;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Convenient abstract superclass for dynamic method matchers,
|
||||
|
@ -36,7 +37,7 @@ public abstract class DynamicMethodMatcher implements MethodMatcher {
|
|||
* always returns true.
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,13 +114,13 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, boolean hasIntroductions) {
|
||||
return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) ||
|
||||
(matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return (matchesClass1(targetClass) && this.mm1.matches(method, targetClass)) ||
|
||||
(matchesClass2(targetClass) && this.mm2.matches(method, targetClass));
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
return this.mm1.matches(method, targetClass, args) || this.mm2.matches(method, targetClass, args);
|
||||
}
|
||||
|
||||
|
@ -230,13 +230,13 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, boolean hasIntroductions) {
|
||||
return MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions) &&
|
||||
MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return this.mm1.matches(method, targetClass) && this.mm2.matches(method, targetClass);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ public abstract class MethodMatchers {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
// Because a dynamic intersection may be composed of a static and dynamic part,
|
||||
// we must avoid calling the 3-arg matches method on a dynamic matcher, as
|
||||
// it will probably be an unsupported operation.
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Arrays;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
|
@ -78,7 +79,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
|||
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
for (String mappedName : this.mappedNames) {
|
||||
if (mappedName.equals(method.getName()) || isMatch(method.getName(), mappedName)) {
|
||||
return true;
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.lang.reflect.Method;
|
|||
|
||||
import org.springframework.aop.MethodMatcher;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -97,7 +98,7 @@ public abstract class Pointcuts {
|
|||
public static SetterPointcut INSTANCE = new SetterPointcut();
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return (method.getName().startsWith("set") &&
|
||||
method.getParameterCount() == 1 &&
|
||||
method.getReturnType() == Void.TYPE);
|
||||
|
@ -118,7 +119,7 @@ public abstract class Pointcuts {
|
|||
public static GetterPointcut INSTANCE = new GetterPointcut();
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
return (method.getName().startsWith("get") &&
|
||||
method.getParameterCount() == 0);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.aop.support;
|
|||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.aop.MethodMatcher;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Convenient abstract superclass for static method matchers, which don't care
|
||||
|
@ -32,7 +33,7 @@ public abstract class StaticMethodMatcher implements MethodMatcher {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final boolean matches(Method method, Class<?> targetClass, Object... args) {
|
||||
public final boolean matches(Method method, @Nullable Class<?> targetClass, Object... args) {
|
||||
// should never be invoked because isRuntime() returns false
|
||||
throw new UnsupportedOperationException("Illegal MethodMatcher usage");
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.lang.reflect.Method;
|
|||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.aop.support.StaticMethodMatcher;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +67,7 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
if (matchesMethod(method)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.springframework.aop.framework.AopContext;
|
|||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
|
@ -81,7 +82,7 @@ public class MethodInvocationProceedingJoinPointTests {
|
|||
private int depth;
|
||||
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint();
|
||||
assertTrue("Method named in toString", jp.toString().contains(method.getName()));
|
||||
// Ensure that these don't cause problems
|
||||
|
@ -138,7 +139,7 @@ public class MethodInvocationProceedingJoinPointTests {
|
|||
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
||||
pf.addAdvice(new MethodBeforeAdvice() {
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
SourceLocation sloc = AbstractAspectJAdvice.currentJoinPoint().getSourceLocation();
|
||||
assertEquals("Same source location must be returned on subsequent requests", sloc, AbstractAspectJAdvice.currentJoinPoint().getSourceLocation());
|
||||
assertEquals(TestBean.class, sloc.getWithinType());
|
||||
|
@ -171,7 +172,7 @@ public class MethodInvocationProceedingJoinPointTests {
|
|||
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
||||
pf.addAdvice(new MethodBeforeAdvice() {
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
StaticPart staticPart = AbstractAspectJAdvice.currentJoinPoint().getStaticPart();
|
||||
assertEquals("Same static part must be returned on subsequent requests", staticPart, AbstractAspectJAdvice.currentJoinPoint().getStaticPart());
|
||||
assertEquals(ProceedingJoinPoint.METHOD_EXECUTION, staticPart.getKind());
|
||||
|
@ -191,7 +192,7 @@ public class MethodInvocationProceedingJoinPointTests {
|
|||
pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
|
||||
pf.addAdvice(new MethodBeforeAdvice() {
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||
public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
// makeEncSJP, although meant for computing the enclosing join point,
|
||||
// it serves our purpose here
|
||||
JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method);
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.springframework.aop.ThrowsAdvice;
|
|||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.core.OverridingClassLoader;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -174,7 +175,7 @@ public class TrickyAspectJPointcutExpressionTests {
|
|||
private int countThrows = 0;
|
||||
|
||||
@Override
|
||||
public void before(Method method, Object[] objects, Object o) throws Throwable {
|
||||
public void before(Method method, Object[] objects, @Nullable Object o) throws Throwable {
|
||||
countBefore++;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.springframework.aop.aspectj.AspectJExpressionPointcut;
|
|||
import org.springframework.aop.aspectj.AspectJMethodBeforeAdvice;
|
||||
import org.springframework.aop.aspectj.AspectJPointcutAdvisor;
|
||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
@ -196,7 +197,7 @@ public class AspectJPrecedenceComparatorTests {
|
|||
private Advisor createSpringAOPAfterAdvice(int order) {
|
||||
AfterReturningAdvice advice = new AfterReturningAdvice() {
|
||||
@Override
|
||||
public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
|
||||
public void afterReturning(@Nullable Object returnValue, Method method, Object[] args, @Nullable Object target) throws Throwable {
|
||||
}
|
||||
};
|
||||
DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(this.anyOldPointcut, advice);
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.aop.MethodMatcher;
|
|||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.interceptor.ExposeInvocationInterceptor;
|
||||
import org.springframework.aop.target.EmptyTargetSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.aop.interceptor.NopInterceptor;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.SerializationTestUtils;
|
||||
|
@ -41,7 +42,7 @@ public class AopUtilsTests {
|
|||
public void testPointcutCanNeverApply() {
|
||||
class TestPointcut extends StaticMethodMatcherPointcut {
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> clazzy) {
|
||||
public boolean matches(Method method, @Nullable Class<?> clazzy) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ public class AopUtilsTests {
|
|||
public void testPointcutAppliesToOneMethodOnObject() {
|
||||
class TestPointcut extends StaticMethodMatcherPointcut {
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> clazz) {
|
||||
public boolean matches(Method method, @Nullable Class<?> clazz) {
|
||||
return method.getName().equals("hashCode");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.aop.ClassFilter;
|
|||
import org.springframework.aop.MethodMatcher;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -36,28 +37,28 @@ public class ComposablePointcutTests {
|
|||
|
||||
public static MethodMatcher GETTER_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().startsWith("get");
|
||||
}
|
||||
};
|
||||
|
||||
public static MethodMatcher GET_AGE_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().equals("getAge");
|
||||
}
|
||||
};
|
||||
|
||||
public static MethodMatcher ABSQUATULATE_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().equals("absquatulate");
|
||||
}
|
||||
};
|
||||
|
||||
public static MethodMatcher SETTER_METHOD_MATCHER = new StaticMethodMatcher() {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().startsWith("set");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.lang.reflect.Method;
|
|||
import org.junit.Test;
|
||||
|
||||
import org.springframework.aop.MethodMatcher;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.IOther;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
@ -120,7 +121,7 @@ public class MethodMatchersTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().startsWith(prefix);
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +130,7 @@ public class MethodMatchersTests {
|
|||
private static class TestDynamicMethodMatcherWhichMatches extends DynamicMethodMatcher {
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass, Object... args) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ public class MethodMatchersTests {
|
|||
private static class TestDynamicMethodMatcherWhichDoesNotMatch extends DynamicMethodMatcher {
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass, Object... args) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass, Object... args) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.junit.Test;
|
|||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -64,7 +65,7 @@ public class PointcutsTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -82,7 +83,7 @@ public class PointcutsTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().startsWith("set");
|
||||
}
|
||||
};
|
||||
|
@ -95,7 +96,7 @@ public class PointcutsTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().startsWith("get");
|
||||
}
|
||||
};
|
||||
|
@ -111,7 +112,7 @@ public class PointcutsTests {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
public boolean matches(Method m, @Nullable Class<?> targetClass) {
|
||||
return m.getName().startsWith("get");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -67,7 +67,7 @@ public class BeanMetadataAttributeAccessor extends AttributeAccessorSupport impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
public void setAttribute(String name, @Nullable Object value) {
|
||||
super.setAttribute(name, new BeanMetadataAttribute(name, value));
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor) {
|
||||
public void registerCustomEditor(@Nullable Class<?> requiredType, @Nullable String propertyPath, PropertyEditor propertyEditor) {
|
||||
if (requiredType == null && propertyPath == null) {
|
||||
throw new IllegalArgumentException("Either requiredType or propertyPath is required");
|
||||
}
|
||||
|
@ -304,7 +304,8 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PropertyEditor findCustomEditor(Class<?> requiredType, String propertyPath) {
|
||||
@Nullable
|
||||
public PropertyEditor findCustomEditor(@Nullable Class<?> requiredType, @Nullable String propertyPath) {
|
||||
Class<?> requiredTypeToUse = requiredType;
|
||||
if (propertyPath != null) {
|
||||
if (this.customEditorsForPath != null) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.lang.reflect.Field;
|
|||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.convert.ConversionException;
|
||||
import org.springframework.core.convert.ConverterNotFoundException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Base implementation of the {@link TypeConverter} interface, using a package-private delegate.
|
||||
|
@ -36,25 +37,25 @@ public abstract class TypeConverterSupport extends PropertyEditorRegistrySupport
|
|||
|
||||
|
||||
@Override
|
||||
public <T> T convertIfNecessary(Object value, Class<T> requiredType) throws TypeMismatchException {
|
||||
public <T> T convertIfNecessary(Object value, @Nullable Class<T> requiredType) throws TypeMismatchException {
|
||||
return doConvert(value, requiredType, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T convertIfNecessary(Object value, Class<T> requiredType, MethodParameter methodParam)
|
||||
public <T> T convertIfNecessary(Object value, @Nullable Class<T> requiredType, @Nullable MethodParameter methodParam)
|
||||
throws TypeMismatchException {
|
||||
|
||||
return doConvert(value, requiredType, methodParam, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T convertIfNecessary(Object value, Class<T> requiredType, Field field)
|
||||
public <T> T convertIfNecessary(Object value, @Nullable Class<T> requiredType, @Nullable Field field)
|
||||
throws TypeMismatchException {
|
||||
|
||||
return doConvert(value, requiredType, null, field);
|
||||
}
|
||||
|
||||
private <T> T doConvert(Object value, Class<T> requiredType, MethodParameter methodParam, Field field)
|
||||
private <T> T doConvert(Object value, Class<T> requiredType, @Nullable MethodParameter methodParam, @Nullable Field field)
|
||||
throws TypeMismatchException {
|
||||
try {
|
||||
if (field != null) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
|||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -65,7 +66,7 @@ public class CustomAutowireConfigurer implements BeanFactoryPostProcessor, BeanC
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public abstract class AbstractFactoryBean<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -86,7 +87,7 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.beans.factory.config;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
||||
/**
|
||||
|
@ -47,7 +48,7 @@ public class EmbeddedValueResolver implements StringValueResolver {
|
|||
|
||||
|
||||
@Override
|
||||
public String resolveStringValue(String strVal) {
|
||||
public String resolveStringValue(@Nullable String strVal) {
|
||||
String value = this.exprContext.getBeanFactory().resolveEmbeddedValue(strVal);
|
||||
if (this.exprResolver != null && value != null) {
|
||||
Object evaluated = this.exprResolver.evaluate(value, this.exprContext);
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.beans.factory.BeanNameAware;
|
|||
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;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -148,7 +149,7 @@ public class FieldRetrievingFactoryBean
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.beans.factory.BeanFactory;
|
|||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.support.ArgumentConvertingMethodInvoker;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -72,7 +73,7 @@ public class MethodInvokingBean extends ArgumentConvertingMethodInvoker
|
|||
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,8 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
|
|||
}
|
||||
|
||||
@Override
|
||||
public String resolveStringValue(String strVal) throws BeansException {
|
||||
@Nullable
|
||||
public String resolveStringValue(@Nullable String strVal) throws BeansException {
|
||||
String resolved = this.helper.replacePlaceholders(strVal, this.resolver);
|
||||
if (trimValues) {
|
||||
resolved = resolved.trim();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.beans.factory.parsing;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple implementation of {@link SourceExtractor} that returns {@code null}
|
||||
|
@ -34,7 +35,8 @@ public class NullSourceExtractor implements SourceExtractor {
|
|||
* This implementation simply returns {@code null} for any input.
|
||||
*/
|
||||
@Override
|
||||
public Object extractSource(Object sourceCandidate, Resource definitionResource) {
|
||||
@Nullable
|
||||
public Object extractSource(Object sourceCandidate, @Nullable Resource definitionResource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.beans.factory.parsing;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple {@link SourceExtractor} implementation that just passes
|
||||
|
@ -40,7 +41,7 @@ public class PassThroughSourceExtractor implements SourceExtractor {
|
|||
* @return the supplied {@code sourceCandidate}
|
||||
*/
|
||||
@Override
|
||||
public Object extractSource(Object sourceCandidate, Resource definingResource) {
|
||||
public Object extractSource(Object sourceCandidate, @Nullable Resource definingResource) {
|
||||
return sourceCandidate;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ServiceLoader;
|
|||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.config.AbstractFactoryBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -54,7 +55,7 @@ public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFact
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
||||
public <T> T getBean(String name, @Nullable Class<T> requiredType) throws BeansException {
|
||||
return doGetBean(name, requiredType, null, false);
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = (beanClassLoader != null ? beanClassLoader : ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.springframework.beans.factory.support;
|
|||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
|
@ -129,7 +130,7 @@ public class ChildBeanDefinition extends AbstractBeanDefinition {
|
|||
|
||||
|
||||
@Override
|
||||
public void setParentName(String parentName) {
|
||||
public void setParentName(@Nullable String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,17 +373,17 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(ResolvableType type) {
|
||||
public String[] getBeanNamesForType(@Nullable ResolvableType type) {
|
||||
return doGetBeanNamesForType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type) {
|
||||
public String[] getBeanNamesForType(@Nullable Class<?> type) {
|
||||
return getBeanNamesForType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
public String[] getBeanNamesForType(@Nullable Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
if (!isConfigurationFrozen() || type == null || !allowEagerInit) {
|
||||
return doGetBeanNamesForType(ResolvableType.forRawClass(type), includeNonSingletons, allowEagerInit);
|
||||
}
|
||||
|
@ -497,12 +497,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type) throws BeansException {
|
||||
return getBeansOfType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
throws BeansException {
|
||||
|
||||
String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.beans.factory.support;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* GenericBeanDefinition is a one-stop shop for standard bean definition purposes.
|
||||
|
@ -64,7 +65,7 @@ public class GenericBeanDefinition extends AbstractBeanDefinition {
|
|||
|
||||
|
||||
@Override
|
||||
public void setParentName(String parentName) {
|
||||
public void setParentName(@Nullable String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.Mergeable;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Tag collection class used to hold managed List elements, which may
|
||||
|
@ -91,7 +92,7 @@ public class ManagedList<E> extends ArrayList<E> implements Mergeable, BeanMetad
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<E> merge(Object parent) {
|
||||
public List<E> merge(@Nullable Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'");
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Map;
|
|||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.Mergeable;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Tag collection class used to hold managed Map values, which may
|
||||
|
@ -106,7 +107,7 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object merge(Object parent) {
|
||||
public Object merge(@Nullable Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'");
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Properties;
|
|||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.Mergeable;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Tag class which represents a Spring-managed {@link Properties} instance
|
||||
|
@ -65,7 +66,7 @@ public class ManagedProperties extends Properties implements Mergeable, BeanMeta
|
|||
|
||||
|
||||
@Override
|
||||
public Object merge(Object parent) {
|
||||
public Object merge(@Nullable Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'");
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Set;
|
|||
|
||||
import org.springframework.beans.BeanMetadataElement;
|
||||
import org.springframework.beans.Mergeable;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Tag collection class used to hold managed Set values, which may
|
||||
|
@ -90,7 +91,7 @@ public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMe
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<E> merge(Object parent) {
|
||||
public Set<E> merge(@Nullable Object parent) {
|
||||
if (!this.mergeEnabled) {
|
||||
throw new IllegalStateException("Not allowed to merge when the 'mergeEnabled' property is set to 'false'");
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setParentName(String parentName) {
|
||||
public void setParentName(@Nullable String parentName) {
|
||||
if (parentName != null) {
|
||||
throw new IllegalArgumentException("Root bean cannot be changed into a child bean with parent reference");
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
|||
|
||||
|
||||
@Override
|
||||
public Object instantiate(RootBeanDefinition bd, String beanName, BeanFactory owner) {
|
||||
public Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner) {
|
||||
// Don't override the class with CGLIB if no overrides.
|
||||
if (bd.getMethodOverrides().isEmpty()) {
|
||||
Constructor<?> constructorToUse;
|
||||
|
@ -107,7 +107,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(RootBeanDefinition bd, String beanName, BeanFactory owner,
|
||||
public Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner,
|
||||
final Constructor<?> ctor, Object... args) {
|
||||
|
||||
if (bd.getMethodOverrides().isEmpty()) {
|
||||
|
@ -141,8 +141,8 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(RootBeanDefinition bd, String beanName, BeanFactory owner,
|
||||
Object factoryBean, final Method factoryMethod, Object... args) {
|
||||
public Object instantiate(RootBeanDefinition bd, @Nullable String beanName, BeanFactory owner,
|
||||
@Nullable Object factoryBean, final Method factoryMethod, Object... args) {
|
||||
|
||||
try {
|
||||
if (System.getSecurityManager() != null) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
|
|||
import org.springframework.beans.factory.SmartFactoryBean;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
@ -132,7 +133,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
||||
public <T> T getBean(String name, @Nullable Class<T> requiredType) throws BeansException {
|
||||
Object bean = getBean(name);
|
||||
if (requiredType != null && !requiredType.isAssignableFrom(bean.getClass())) {
|
||||
throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());
|
||||
|
@ -247,7 +248,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(ResolvableType type) {
|
||||
public String[] getBeanNamesForType(@Nullable ResolvableType type) {
|
||||
boolean isFactoryType = false;
|
||||
if (type != null) {
|
||||
Class<?> resolved = type.resolve();
|
||||
|
@ -275,23 +276,23 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type) {
|
||||
public String[] getBeanNamesForType(@Nullable Class<?> type) {
|
||||
return getBeanNamesForType(ResolvableType.forClass(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
public String[] getBeanNamesForType(@Nullable Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
return getBeanNamesForType(ResolvableType.forClass(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type) throws BeansException {
|
||||
return getBeansOfType(type, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
throws BeansException {
|
||||
|
||||
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type));
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
|||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -147,7 +148,7 @@ public abstract class AbstractBeanDefinitionParser implements BeanDefinitionPars
|
|||
* @see #parse(org.w3c.dom.Element, ParserContext)
|
||||
* @see #postProcessComponentDefinition(org.springframework.beans.factory.parsing.BeanComponentDefinition)
|
||||
*/
|
||||
protected abstract AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext);
|
||||
protected abstract AbstractBeanDefinition parseInternal(@Nullable Element element, @Nullable ParserContext parserContext);
|
||||
|
||||
/**
|
||||
* Should an ID be generated instead of read from the passed in {@link Element}?
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class AbstractSingleBeanDefinitionParser extends AbstractBeanDef
|
|||
* @see #doParse
|
||||
*/
|
||||
@Override
|
||||
protected final AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
|
||||
protected final AbstractBeanDefinition parseInternal(@Nullable Element element, @Nullable ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition();
|
||||
String parentName = getParentName(element);
|
||||
if (parentName != null) {
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.springframework.core.convert.ConversionFailedException;
|
|||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.sample.beans.BooleanTestBean;
|
||||
|
@ -461,7 +462,7 @@ public abstract class AbstractPropertyAccessorTests {
|
|||
AbstractPropertyAccessor accessor = createAccessor(target);
|
||||
accessor.setConversionService(new GenericConversionService() {
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
public Object convert(@Nullable Object source, @Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
throw new ConversionFailedException(sourceType, targetType, source, null);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -83,6 +83,7 @@ import org.springframework.core.convert.support.DefaultConversionService;
|
|||
import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.Assume;
|
||||
import org.springframework.tests.TestGroup;
|
||||
import org.springframework.tests.sample.beans.DependenciesBean;
|
||||
|
@ -3120,7 +3121,7 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convertIfNecessary(Object value, Class requiredType) {
|
||||
public Object convertIfNecessary(Object value, @Nullable Class requiredType) {
|
||||
if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
|
||||
try {
|
||||
return new Float(this.numberFormat.parse((String) value).floatValue());
|
||||
|
@ -3139,13 +3140,13 @@ public class DefaultListableBeanFactoryTests {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convertIfNecessary(Object value, Class requiredType, MethodParameter methodParam) {
|
||||
public Object convertIfNecessary(Object value, @Nullable Class requiredType, @Nullable MethodParameter methodParam) {
|
||||
return convertIfNecessary(value, requiredType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convertIfNecessary(Object value, Class requiredType, Field field) {
|
||||
public Object convertIfNecessary(Object value, @Nullable Class requiredType, @Nullable Field field) {
|
||||
return convertIfNecessary(value, requiredType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.function.Function;
|
|||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
|
||||
import org.springframework.cache.support.AbstractValueAdaptingCache;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -82,7 +83,7 @@ public class CaffeineCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper get(Object key) {
|
||||
public ValueWrapper get(@Nullable Object key) {
|
||||
if (this.cache instanceof LoadingCache) {
|
||||
Object value = ((LoadingCache<Object, Object>) this.cache).get(key);
|
||||
return toValueWrapper(value);
|
||||
|
@ -92,7 +93,8 @@ public class CaffeineCache extends AbstractValueAdaptingCache {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T get(Object key, final Callable<T> valueLoader) {
|
||||
@Nullable
|
||||
public <T> T get(@Nullable Object key, final Callable<T> valueLoader) {
|
||||
return (T) fromStoreValue(this.cache.get(key, new LoadFunction(valueLoader)));
|
||||
}
|
||||
|
||||
|
@ -102,19 +104,20 @@ public class CaffeineCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
public void put(@Nullable Object key, @Nullable Object value) {
|
||||
this.cache.put(key, toStoreValue(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper putIfAbsent(Object key, final Object value) {
|
||||
@Nullable
|
||||
public ValueWrapper putIfAbsent(@Nullable Object key, @Nullable final Object value) {
|
||||
PutIfAbsentFunction callable = new PutIfAbsentFunction(value);
|
||||
Object result = this.cache.get(key, callable);
|
||||
return (callable.called ? null : toValueWrapper(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
public void evict(@Nullable Object key) {
|
||||
this.cache.invalidate(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import net.sf.ehcache.Status;
|
|||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.support.SimpleValueWrapper;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -63,14 +64,15 @@ public class EhCacheCache implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper get(Object key) {
|
||||
public ValueWrapper get(@Nullable Object key) {
|
||||
Element element = lookup(key);
|
||||
return toValueWrapper(element);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T get(Object key, Callable<T> valueLoader) {
|
||||
@Nullable
|
||||
public <T> T get(@Nullable Object key, Callable<T> valueLoader) {
|
||||
Element element = lookup(key);
|
||||
if (element != null) {
|
||||
return (T) element.getObjectValue();
|
||||
|
@ -107,7 +109,8 @@ public class EhCacheCache implements Cache {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(Object key, Class<T> type) {
|
||||
@Nullable
|
||||
public <T> T get(@Nullable Object key, Class<T> type) {
|
||||
Element element = this.cache.get(key);
|
||||
Object value = (element != null ? element.getObjectValue() : null);
|
||||
if (value != null && type != null && !type.isInstance(value)) {
|
||||
|
@ -117,18 +120,18 @@ public class EhCacheCache implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
public void put(@Nullable Object key, @Nullable Object value) {
|
||||
this.cache.put(new Element(key, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper putIfAbsent(Object key, Object value) {
|
||||
public ValueWrapper putIfAbsent(@Nullable Object key, @Nullable Object value) {
|
||||
Element existingElement = this.cache.putIfAbsent(new Element(key, value));
|
||||
return toValueWrapper(existingElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
public void evict(@Nullable Object key) {
|
||||
this.cache.remove(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import javax.cache.processor.EntryProcessorException;
|
|||
import javax.cache.processor.MutableEntry;
|
||||
|
||||
import org.springframework.cache.support.AbstractValueAdaptingCache;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,7 @@ public class JCacheCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(Object key, Callable<T> valueLoader) {
|
||||
public <T> T get(@Nullable Object key, Callable<T> valueLoader) {
|
||||
try {
|
||||
return this.cache.invoke(key, new ValueLoaderEntryProcessor<T>(), valueLoader);
|
||||
}
|
||||
|
@ -85,18 +86,18 @@ public class JCacheCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
public void put(@Nullable Object key, @Nullable Object value) {
|
||||
this.cache.put(key, toStoreValue(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper putIfAbsent(Object key, Object value) {
|
||||
public ValueWrapper putIfAbsent(@Nullable Object key, @Nullable Object value) {
|
||||
boolean set = this.cache.putIfAbsent(key, toStoreValue(value));
|
||||
return (set ? null : get(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
public void evict(@Nullable Object key) {
|
||||
this.cache.remove(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public class JCacheManagerFactoryBean
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.cache.jcache.interceptor.JCacheOperationSource;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Abstract JSR-107 specific {@code @Configuration} class providing common
|
||||
|
@ -40,7 +41,7 @@ public class AbstractJCacheConfiguration extends AbstractCachingConfiguration {
|
|||
protected CacheResolver exceptionCacheResolver;
|
||||
|
||||
@Override
|
||||
protected void useCachingConfigurer(CachingConfigurer config) {
|
||||
protected void useCachingConfigurer(@Nullable CachingConfigurer config) {
|
||||
super.useCachingConfigurer(config);
|
||||
if (config instanceof JCacheConfigurer) {
|
||||
this.exceptionCacheResolver = ((JCacheConfigurer) config).exceptionCacheResolver();
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.cache.transaction;
|
|||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
|
@ -71,22 +72,22 @@ public class TransactionAwareCacheDecorator implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper get(Object key) {
|
||||
public ValueWrapper get(@Nullable Object key) {
|
||||
return this.targetCache.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(Object key, Class<T> type) {
|
||||
public <T> T get(@Nullable Object key, Class<T> type) {
|
||||
return this.targetCache.get(key, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(Object key, Callable<T> valueLoader) {
|
||||
public <T> T get(@Nullable Object key, Callable<T> valueLoader) {
|
||||
return this.targetCache.get(key, valueLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(final Object key, final Object value) {
|
||||
public void put(@Nullable final Object key, @Nullable final Object value) {
|
||||
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
@Override
|
||||
|
@ -101,12 +102,12 @@ public class TransactionAwareCacheDecorator implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper putIfAbsent(final Object key, final Object value) {
|
||||
public ValueWrapper putIfAbsent(@Nullable final Object key, @Nullable final Object value) {
|
||||
return this.targetCache.putIfAbsent(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(final Object key) {
|
||||
public void evict(@Nullable final Object key) {
|
||||
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
@Override
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.springframework.beans.factory.BeanNameAware;
|
|||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.support.ArgumentConvertingMethodInvoker;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.MethodInvoker;
|
||||
|
@ -141,7 +142,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.ImportAware;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
|
@ -80,7 +81,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
|
|||
/**
|
||||
* Extract the configuration from the nominated {@link CachingConfigurer}.
|
||||
*/
|
||||
protected void useCachingConfigurer(CachingConfigurer config) {
|
||||
protected void useCachingConfigurer(@Nullable CachingConfigurer config) {
|
||||
this.cacheManager = config.cacheManager();
|
||||
this.cacheResolver = config.cacheResolver();
|
||||
this.keyGenerator = config.keyGenerator();
|
||||
|
|
|
@ -137,7 +137,8 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T get(Object key, Callable<T> valueLoader) {
|
||||
@Nullable
|
||||
public <T> T get(@Nullable Object key, Callable<T> valueLoader) {
|
||||
if (this.store.containsKey(key)) {
|
||||
return (T) get(key).get();
|
||||
}
|
||||
|
@ -154,18 +155,19 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
public void put(@Nullable Object key, @Nullable Object value) {
|
||||
this.store.put(key, toStoreValue(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper putIfAbsent(Object key, Object value) {
|
||||
@Nullable
|
||||
public ValueWrapper putIfAbsent(@Nullable Object key, @Nullable Object value) {
|
||||
Object existing = this.store.putIfAbsent(key, toStoreValue(value));
|
||||
return toValueWrapper(existing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
public void evict(@Nullable Object key) {
|
||||
this.store.remove(key);
|
||||
}
|
||||
|
||||
|
@ -175,7 +177,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object toStoreValue(Object userValue) {
|
||||
protected Object toStoreValue(@Nullable Object userValue) {
|
||||
Object storeValue = super.toStoreValue(userValue);
|
||||
if (this.serialization != null) {
|
||||
try {
|
||||
|
@ -203,7 +205,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object fromStoreValue(Object storeValue) {
|
||||
protected Object fromStoreValue(@Nullable Object storeValue) {
|
||||
if (this.serialization != null) {
|
||||
try {
|
||||
return super.fromStoreValue(deserializeValue(storeValue));
|
||||
|
|
|
@ -146,7 +146,7 @@ public class ConcurrentMapCacheManager implements CacheManager, BeanClassLoaderA
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.serialization = new SerializationDelegate(classLoader);
|
||||
// Need to recreate all Cache instances with new ClassLoader in store-by-value mode...
|
||||
if (isStoreByValue()) {
|
||||
|
|
|
@ -95,6 +95,6 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
|||
* @return the cache name(s) to resolve or {@code null} if no cache should be resolved
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract Collection<String> getCacheNames(CacheOperationInvocationContext<?> context);
|
||||
protected abstract Collection<String> getCacheNames(@Nullable CacheOperationInvocationContext<?> context);
|
||||
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
|
|||
* is not cacheable
|
||||
*/
|
||||
@Override
|
||||
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
|
||||
public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) {
|
||||
if (method.getDeclaringClass() == Object.class) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.springframework.util.ObjectUtils;
|
|||
abstract class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
public boolean matches(Method method, @Nullable Class<?> targetClass) {
|
||||
CacheOperationSource cas = getCacheOperationSource();
|
||||
return (cas != null && !CollectionUtils.isEmpty(cas.getCacheOperations(method, targetClass)));
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +55,7 @@ public class CompositeCacheOperationSource implements CacheOperationSource, Seri
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
|
||||
public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) {
|
||||
Collection<CacheOperation> ops = null;
|
||||
|
||||
for (CacheOperationSource source : this.cacheOperationSources) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
|
||||
public Collection<CacheOperation> getCacheOperations(Method method, @Nullable Class<?> targetClass) {
|
||||
// look for direct name match
|
||||
String methodName = method.getName();
|
||||
Collection<CacheOperation> ops = this.nameMap.get(methodName);
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link CacheResolver} that forces the resolution to a configurable
|
||||
|
@ -50,7 +51,7 @@ public class NamedCacheResolver extends AbstractCacheResolver {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context) {
|
||||
protected Collection<String> getCacheNames(@Nullable CacheOperationInvocationContext<?> context) {
|
||||
return this.cacheNames;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Collection;
|
|||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A simple {@link CacheResolver} that resolves the {@link Cache} instance(s)
|
||||
|
@ -40,7 +41,7 @@ public class SimpleCacheResolver extends AbstractCacheResolver {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context) {
|
||||
protected Collection<String> getCacheNames(@Nullable CacheOperationInvocationContext<?> context) {
|
||||
return context.getOperation().getCacheNames();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,14 +53,16 @@ public abstract class AbstractValueAdaptingCache implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper get(Object key) {
|
||||
@Nullable
|
||||
public ValueWrapper get(@Nullable Object key) {
|
||||
Object value = lookup(key);
|
||||
return toValueWrapper(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(Object key, Class<T> type) {
|
||||
@Nullable
|
||||
public <T> T get(@Nullable Object key, Class<T> type) {
|
||||
Object value = fromStoreValue(lookup(key));
|
||||
if (value != null && type != null && !type.isInstance(value)) {
|
||||
throw new IllegalStateException("Cached value is not of required type [" + type.getName() + "]: " + value);
|
||||
|
@ -115,6 +117,7 @@ public abstract class AbstractValueAdaptingCache implements Cache {
|
|||
* @param storeValue the original value
|
||||
* @return the wrapped value
|
||||
*/
|
||||
@Nullable
|
||||
protected Cache.ValueWrapper toValueWrapper(Object storeValue) {
|
||||
return (storeValue != null ? new SimpleValueWrapper(fromStoreValue(storeValue)) : null);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.cache.support;
|
|||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A no operation {@link Cache} implementation suitable
|
||||
|
@ -47,21 +48,21 @@ public class NoOpCache implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void evict(Object key) {
|
||||
public void evict(@Nullable Object key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper get(Object key) {
|
||||
public ValueWrapper get(@Nullable Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(Object key, Class<T> type) {
|
||||
public <T> T get(@Nullable Object key, Class<T> type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(Object key, Callable<T> valueLoader) {
|
||||
public <T> T get(@Nullable Object key, Callable<T> valueLoader) {
|
||||
try {
|
||||
return valueLoader.call();
|
||||
}
|
||||
|
@ -81,11 +82,12 @@ public class NoOpCache implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void put(Object key, Object value) {
|
||||
public void put(@Nullable Object key, @Nullable Object value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueWrapper putIfAbsent(Object key, Object value) {
|
||||
@Nullable
|
||||
public ValueWrapper putIfAbsent(@Nullable Object key, @Nullable Object value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> void registerBean(String beanName, Class<T> beanClass, Supplier<T> supplier,
|
||||
public <T> void registerBean(@Nullable String beanName, @Nullable Class<T> beanClass, Supplier<T> supplier,
|
||||
BeanDefinitionCustomizer... customizers) {
|
||||
|
||||
this.reader.doRegisterBean(beanClass, supplier, beanName, null, customizers);
|
||||
|
|
|
@ -61,6 +61,7 @@ import org.springframework.core.io.ResourceLoader;
|
|||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
@ -201,7 +202,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
if (!this.setMetadataReaderFactoryCalled) {
|
||||
this.metadataReaderFactory = new CachingMetadataReaderFactory(beanClassLoader);
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.springframework.context.weaving.DefaultContextLoadTimeWeaver;
|
|||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.instrument.classloading.LoadTimeWeaver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@code @Configuration} class that registers a {@link LoadTimeWeaver} bean.
|
||||
|
@ -64,7 +65,7 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
|||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;
|
||||
import org.springframework.jmx.support.RegistrationPolicy;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,7 @@ class MBeanExportBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
|
||||
protected AbstractBeanDefinition parseInternal(@Nullable Element element, @Nullable ParserContext parserContext) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(AnnotationMBeanExporter.class);
|
||||
|
||||
// Mark as infrastructure bean and attach source location.
|
||||
|
|
|
@ -63,7 +63,7 @@ class MBeanServerBeanDefinitionParser extends AbstractBeanDefinitionParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
|
||||
protected AbstractBeanDefinition parseInternal(@Nullable Element element, @Nullable ParserContext parserContext) {
|
||||
String agentId = element.getAttribute(AGENT_ID_ATTRIBUTE);
|
||||
if (StringUtils.hasText(agentId)) {
|
||||
RootBeanDefinition bd = new RootBeanDefinition(MBeanServerFactoryBean.class);
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.springframework.context.ApplicationEvent;
|
|||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
@ -71,7 +72,7 @@ public abstract class AbstractApplicationEventMulticaster
|
|||
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.BeanFactory;
|
|||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
/**
|
||||
|
@ -123,7 +124,7 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM
|
|||
}
|
||||
|
||||
@Override
|
||||
public void multicastEvent(final ApplicationEvent event, ResolvableType eventType) {
|
||||
public void multicastEvent(final ApplicationEvent event, @Nullable ResolvableType eventType) {
|
||||
ResolvableType type = (eventType != null ? eventType : resolveDefaultEventType(event));
|
||||
for (final ApplicationListener<?> listener : getApplicationListeners(event, type)) {
|
||||
Executor executor = getTaskExecutor();
|
||||
|
|
|
@ -76,6 +76,7 @@ import org.springframework.core.io.Resource;
|
|||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
@ -461,7 +462,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
* @see ConfigurableEnvironment#merge(ConfigurableEnvironment)
|
||||
*/
|
||||
@Override
|
||||
public void setParent(ApplicationContext parent) {
|
||||
public void setParent(@Nullable ApplicationContext parent) {
|
||||
this.parent = parent;
|
||||
if (parent != null) {
|
||||
Environment parentEnvironment = parent.getEnvironment();
|
||||
|
@ -844,7 +845,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
if (!beanFactory.hasEmbeddedValueResolver()) {
|
||||
beanFactory.addEmbeddedValueResolver(new StringValueResolver() {
|
||||
@Override
|
||||
public String resolveStringValue(String strVal) {
|
||||
public String resolveStringValue(@Nullable String strVal) {
|
||||
return getEnvironment().resolvePlaceholders(strVal);
|
||||
}
|
||||
});
|
||||
|
@ -1081,7 +1082,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
||||
public <T> T getBean(String name, @Nullable Class<T> requiredType) throws BeansException {
|
||||
assertBeanFactoryActive();
|
||||
return getBeanFactory().getBean(name, requiredType);
|
||||
}
|
||||
|
@ -1165,31 +1166,31 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(ResolvableType type) {
|
||||
public String[] getBeanNamesForType(@Nullable ResolvableType type) {
|
||||
assertBeanFactoryActive();
|
||||
return getBeanFactory().getBeanNamesForType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type) {
|
||||
public String[] getBeanNamesForType(@Nullable Class<?> type) {
|
||||
assertBeanFactoryActive();
|
||||
return getBeanFactory().getBeanNamesForType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
public String[] getBeanNamesForType(@Nullable Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
assertBeanFactoryActive();
|
||||
return getBeanFactory().getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type) throws BeansException {
|
||||
assertBeanFactoryActive();
|
||||
return getBeanFactory().getBeansOfType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
|
||||
throws BeansException {
|
||||
|
||||
assertBeanFactoryActive();
|
||||
|
@ -1249,12 +1250,12 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public String getMessage(String code, Object args[], String defaultMessage, Locale locale) {
|
||||
public String getMessage(String code, @Nullable Object args[], String defaultMessage, Locale locale) {
|
||||
return getMessageSource().getMessage(code, args, defaultMessage, locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(String code, Object args[], Locale locale) throws NoSuchMessageException {
|
||||
public String getMessage(String code, @Nullable Object args[], Locale locale) throws NoSuchMessageException {
|
||||
return getMessageSource().getMessage(code, args, locale);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
|||
|
||||
|
||||
@Override
|
||||
public void setParentMessageSource(MessageSource parent) {
|
||||
public void setParentMessageSource(@Nullable MessageSource parent) {
|
||||
this.parentMessageSource = parent;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
|||
|
||||
|
||||
@Override
|
||||
public final String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
|
||||
public final String getMessage(String code, @Nullable Object[] args, String defaultMessage, Locale locale) {
|
||||
String msg = getMessageInternal(code, args, locale);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
|
@ -149,7 +149,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
|||
}
|
||||
|
||||
@Override
|
||||
public final String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
|
||||
public final String getMessage(String code, @Nullable Object[] args, Locale locale) throws NoSuchMessageException {
|
||||
String msg = getMessageInternal(code, args, locale);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.context.HierarchicalMessageSource;
|
|||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceResolvable;
|
||||
import org.springframework.context.NoSuchMessageException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Empty {@link MessageSource} that delegates all calls to the parent MessageSource.
|
||||
|
@ -40,7 +41,7 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
|
|||
|
||||
|
||||
@Override
|
||||
public void setParentMessageSource(MessageSource parent) {
|
||||
public void setParentMessageSource(@Nullable MessageSource parent) {
|
||||
this.parentMessageSource = parent;
|
||||
}
|
||||
|
||||
|
@ -51,7 +52,7 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
|
|||
|
||||
|
||||
@Override
|
||||
public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
|
||||
public String getMessage(String code, @Nullable Object[] args, String defaultMessage, Locale locale) {
|
||||
if (this.parentMessageSource != null) {
|
||||
return this.parentMessageSource.getMessage(code, args, defaultMessage, locale);
|
||||
}
|
||||
|
@ -61,7 +62,7 @@ public class DelegatingMessageSource extends MessageSourceSupport implements Hie
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
|
||||
public String getMessage(String code, @Nullable Object[] args, Locale locale) throws NoSuchMessageException {
|
||||
if (this.parentMessageSource != null) {
|
||||
return this.parentMessageSource.getMessage(code, args, locale);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
|||
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory
|
||||
*/
|
||||
@Override
|
||||
public void setParent(ApplicationContext parent) {
|
||||
public void setParent(@Nullable ApplicationContext parent) {
|
||||
super.setParent(parent);
|
||||
this.beanFactory.setParentBeanFactory(getInternalParentBeanFactory());
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setClassLoader(ClassLoader classLoader) {
|
||||
public void setClassLoader(@Nullable ClassLoader classLoader) {
|
||||
super.setClassLoader(classLoader);
|
||||
this.customClassLoader = true;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.springframework.core.env.PropertiesPropertySource;
|
|||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.PropertySources;
|
||||
import org.springframework.core.env.PropertySourcesPropertyResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
||||
|
@ -166,7 +167,8 @@ public class PropertySourcesPlaceholderConfigurer extends PlaceholderConfigurerS
|
|||
|
||||
StringValueResolver valueResolver = new StringValueResolver() {
|
||||
@Override
|
||||
public String resolveStringValue(String strVal) {
|
||||
@Nullable
|
||||
public String resolveStringValue(@Nullable String strVal) {
|
||||
String resolved = (ignoreUnresolvablePlaceholders ?
|
||||
propertyResolver.resolvePlaceholders(strVal) :
|
||||
propertyResolver.resolveRequiredPlaceholders(strVal));
|
||||
|
|
|
@ -114,7 +114,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class AspectJWeavingEnabler
|
|||
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
LoadTimeWeaver serverSpecificLoadTimeWeaver = createServerSpecificLoadTimeWeaver(classLoader);
|
||||
if (serverSpecificLoadTimeWeaver != null) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.naming.NamingException;
|
|||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -78,7 +79,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.naming.NamingException;
|
|||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -92,7 +93,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.springframework.format.Formatter;
|
|||
import org.springframework.format.FormatterRegistry;
|
||||
import org.springframework.format.Parser;
|
||||
import org.springframework.format.Printer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
||||
|
@ -145,7 +146,7 @@ public class FormattingConversionService extends GenericConversionService
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (source == null) {
|
||||
return "";
|
||||
}
|
||||
|
@ -186,7 +187,7 @@ public class FormattingConversionService extends GenericConversionService
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
String text = (String) source;
|
||||
if (!StringUtils.hasText(text)) {
|
||||
return null;
|
||||
|
@ -247,7 +248,7 @@ public class FormattingConversionService extends GenericConversionService
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
Annotation ann = sourceType.getAnnotation(this.annotationType);
|
||||
if (ann == null) {
|
||||
throw new IllegalStateException(
|
||||
|
@ -301,7 +302,7 @@ public class FormattingConversionService extends GenericConversionService
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
Annotation ann = targetType.getAnnotation(this.annotationType);
|
||||
if (ann == null) {
|
||||
throw new IllegalStateException(
|
||||
|
|
|
@ -231,7 +231,7 @@ public class MBeanClientInterceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
|
|||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jmx.MBeanServerNotFoundException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -67,7 +68,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Properties;
|
|||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
@ -110,7 +111,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue