Refine null-safety in more modules
This commit refines the null-safety in all remaining modules except spring-test. See gh-32475
This commit is contained in:
parent
1b563f8ba4
commit
290a41d398
|
@ -65,6 +65,7 @@ public class LazyInitTargetSource extends AbstractBeanFactoryBasedTargetSource {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public synchronized Object getTarget() throws BeansException {
|
||||
if (this.target == null) {
|
||||
this.target = getBeanFactory().getBean(getTargetBeanName());
|
||||
|
|
|
@ -121,6 +121,7 @@ public class JCacheCacheManager extends AbstractTransactionSupportingCacheManage
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Cache getMissingCache(String name) {
|
||||
CacheManager cacheManager = getCacheManager();
|
||||
Assert.state(cacheManager != null, "No CacheManager set");
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.springframework.util.StringUtils;
|
|||
public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJCacheOperationSource {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType) {
|
||||
CacheResult cacheResult = method.getAnnotation(CacheResult.class);
|
||||
CachePut cachePut = method.getAnnotation(CachePut.class);
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.springframework.cache.Cache;
|
|||
import org.springframework.cache.interceptor.CacheErrorHandler;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvoker;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Intercept methods annotated with {@link CachePut}.
|
||||
|
@ -39,6 +40,7 @@ class CachePutInterceptor extends AbstractKeyCacheInterceptor<CachePutOperation,
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object invoke(
|
||||
CacheOperationInvocationContext<CachePutOperation> context, CacheOperationInvoker invoker) {
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.cache.Cache;
|
|||
import org.springframework.cache.interceptor.CacheErrorHandler;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvoker;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Intercept methods annotated with {@link CacheRemoveAll}.
|
||||
|
@ -38,6 +39,7 @@ class CacheRemoveAllInterceptor extends AbstractCacheInterceptor<CacheRemoveAllO
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object invoke(
|
||||
CacheOperationInvocationContext<CacheRemoveAllOperation> context, CacheOperationInvoker invoker) {
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.cache.Cache;
|
|||
import org.springframework.cache.interceptor.CacheErrorHandler;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvoker;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Intercept methods annotated with {@link CacheRemove}.
|
||||
|
@ -38,6 +39,7 @@ class CacheRemoveEntryInterceptor extends AbstractKeyCacheInterceptor<CacheRemov
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object invoke(
|
||||
CacheOperationInvocationContext<CacheRemoveOperation> context, CacheOperationInvoker invoker) {
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke() throws ThrowableWrapper {
|
||||
return invokeOperation(this.delegate);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.cache.interceptor.AbstractCacheResolver;
|
|||
import org.springframework.cache.interceptor.BasicOperation;
|
||||
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
|
||||
import org.springframework.cache.interceptor.CacheResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A simple {@link CacheResolver} that resolves the exception cache
|
||||
|
@ -41,6 +42,7 @@ public class SimpleExceptionCacheResolver extends AbstractCacheResolver {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context) {
|
||||
BasicOperation operation = context.getOperation();
|
||||
if (!(operation instanceof CacheResultOperation cacheResultOperation)) {
|
||||
|
|
|
@ -83,6 +83,7 @@ public class TransactionAwareCacheDecorator implements Cache {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T get(Object key, @Nullable Class<T> type) {
|
||||
return this.targetCache.get(key, type);
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
|
|||
* Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getTargetClass() {
|
||||
Class<?> targetClass = super.getTargetClass();
|
||||
if (targetClass == null && this.targetBeanName != null) {
|
||||
|
@ -212,6 +213,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod
|
|||
* Overridden to support the {@link #setTargetBeanName "targetBeanName"} feature.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getTargetObject() {
|
||||
Object targetObject = super.getTargetObject();
|
||||
if (targetObject == null && this.targetBeanName != null) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|||
import org.springframework.aot.hint.TypeHint.Builder;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.aot.hint.annotation.ReflectiveRuntimeHintsRegistrar;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -40,7 +41,7 @@ class SchedulerFactoryBeanRuntimeHints implements RuntimeHintsRegistrar {
|
|||
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
if (!ClassUtils.isPresent(SCHEDULER_FACTORY_CLASS_NAME, classLoader)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ public interface Cache {
|
|||
@Nullable
|
||||
private final Object key;
|
||||
|
||||
public ValueRetrievalException(@Nullable Object key, Callable<?> loader, Throwable ex) {
|
||||
public ValueRetrievalException(@Nullable Object key, Callable<?> loader, @Nullable Throwable ex) {
|
||||
super(String.format("Value for key '%s' could not be loaded using '%s'", key, loader), ex);
|
||||
this.key = key;
|
||||
}
|
||||
|
|
|
@ -223,6 +223,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object fromStoreValue(@Nullable Object storeValue) {
|
||||
if (storeValue != null && this.serialization != null) {
|
||||
try {
|
||||
|
|
|
@ -52,6 +52,7 @@ public class NamedCacheResolver extends AbstractCacheResolver {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context) {
|
||||
return this.cacheNames;
|
||||
}
|
||||
|
|
|
@ -314,6 +314,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
|
||||
BeanRegistrationAotContribution parentAotContribution = super.processAheadOfTime(registeredBean);
|
||||
Class<?> beanClass = registeredBean.getBeanClass();
|
||||
|
@ -350,6 +351,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -334,6 +334,7 @@ class ConfigurationClassEnhancer {
|
|||
return resolveBeanReference(beanMethod, beanMethodArgs, beanFactory, beanName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Object resolveBeanReference(Method beanMethod, Object[] beanMethodArgs,
|
||||
ConfigurableBeanFactory beanFactory, String beanName) {
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
|||
* Invoke the event listener method with the given argument values.
|
||||
*/
|
||||
@Nullable
|
||||
protected Object doInvoke(Object... args) {
|
||||
protected Object doInvoke(@Nullable Object... args) {
|
||||
Object bean = getTargetBean();
|
||||
// Detect package-protected NullBean instance through equals(null) check
|
||||
if (bean.equals(null)) {
|
||||
|
@ -416,8 +416,8 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
|||
* the given error message.
|
||||
* @param message error message to append the HandlerMethod details to
|
||||
*/
|
||||
protected String getDetailedErrorMessage(Object bean, String message) {
|
||||
StringBuilder sb = new StringBuilder(message).append('\n');
|
||||
protected String getDetailedErrorMessage(Object bean, @Nullable String message) {
|
||||
StringBuilder sb = (StringUtils.hasLength(message) ? new StringBuilder(message).append('\n') : new StringBuilder());
|
||||
sb.append("HandlerMethod details: \n");
|
||||
sb.append("Bean [").append(bean.getClass().getName()).append("]\n");
|
||||
sb.append("Method [").append(this.method.toGenericString()).append("]\n");
|
||||
|
@ -431,7 +431,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
|||
* beans, and others). Event listener beans that require proxying should prefer
|
||||
* class-based proxy mechanisms.
|
||||
*/
|
||||
private void assertTargetBean(Method method, Object targetBean, Object[] args) {
|
||||
private void assertTargetBean(Method method, Object targetBean, @Nullable Object[] args) {
|
||||
Class<?> methodDeclaringClass = method.getDeclaringClass();
|
||||
Class<?> targetBeanClass = targetBean.getClass();
|
||||
if (!methodDeclaringClass.isAssignableFrom(targetBeanClass)) {
|
||||
|
@ -443,7 +443,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
|||
}
|
||||
}
|
||||
|
||||
private String getInvocationErrorMessage(Object bean, String message, Object[] resolvedArgs) {
|
||||
private String getInvocationErrorMessage(Object bean, @Nullable String message, @Nullable Object[] resolvedArgs) {
|
||||
StringBuilder sb = new StringBuilder(getDetailedErrorMessage(bean, message));
|
||||
sb.append("Resolved arguments: \n");
|
||||
for (int i = 0; i < resolvedArgs.length; i++) {
|
||||
|
|
|
@ -1463,6 +1463,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
|||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getMessage(String code, @Nullable Object[] args, @Nullable String defaultMessage, Locale locale) {
|
||||
return getMessageSource().getMessage(code, args, defaultMessage, locale);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final String getMessage(String code, @Nullable Object[] args, @Nullable String defaultMessage, Locale locale) {
|
||||
String msg = getMessageInternal(code, args, locale);
|
||||
if (msg != null) {
|
||||
|
|
|
@ -123,6 +123,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Class<?> loadClassForOverriding(String name) throws ClassNotFoundException {
|
||||
byte[] bytes = bytesCache.get(name);
|
||||
if (bytes == null) {
|
||||
|
|
|
@ -191,6 +191,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
|||
* returning the value found in the bundle as-is (without MessageFormat parsing).
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected String resolveCodeWithoutArguments(String code, Locale locale) {
|
||||
if (getCacheMillis() < 0) {
|
||||
PropertiesHolder propHolder = getMergedProperties(locale);
|
||||
|
|
|
@ -145,6 +145,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
|||
* returning the value found in the bundle as-is (without MessageFormat parsing).
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected String resolveCodeWithoutArguments(String code, Locale locale) {
|
||||
Set<String> basenames = getBasenameSet();
|
||||
for (String basename : basenames) {
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.format.support;
|
|||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} to register hints for {@link DefaultFormattingConversionService}.
|
||||
|
@ -29,7 +30,7 @@ import org.springframework.aot.hint.TypeReference;
|
|||
class FormattingConversionServiceRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.reflection().registerType(TypeReference.of("javax.money.MonetaryAmount"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.springframework.jmx.access;
|
|||
|
||||
import javax.management.JMRuntimeException;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Thrown when trying to invoke an operation on a proxy that is not exposed
|
||||
* by the proxied MBean resource's management interface.
|
||||
|
@ -35,7 +37,7 @@ public class InvalidInvocationException extends JMRuntimeException {
|
|||
* error message.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public InvalidInvocationException(String msg) {
|
||||
public InvalidInvocationException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
return this.proxyInterface;
|
||||
}
|
||||
|
|
|
@ -273,6 +273,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
if (this.proxyInterfaces != null) {
|
||||
if (this.proxyInterfaces.length == 1) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.springframework.lang.Nullable;
|
|||
public class AsyncConfigurerSupport implements AsyncConfigurer {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Executor getAsyncExecutor() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -334,16 +334,19 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Instant lastScheduledExecution() {
|
||||
return (this.le != null ? toInstant(this.le.getScheduledStart()) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Instant lastActualExecution() {
|
||||
return (this.le != null ? toInstant(this.le.getRunStart()) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Instant lastCompletion() {
|
||||
return (this.le != null ? toInstant(this.le.getRunEnd()) : null);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ public class TaskSchedulerRouter implements TaskScheduler, BeanNameAware, BeanFa
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
|
||||
return determineTargetScheduler(task).schedule(task, trigger);
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ public class CronTrigger implements Trigger {
|
|||
* previous execution; therefore, overlapping executions won't occur.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Instant nextExecution(TriggerContext triggerContext) {
|
||||
Instant timestamp = determineLatestTimestamp(triggerContext);
|
||||
ZoneId zone = (this.zoneId != null ? this.zoneId : triggerContext.getClock().getZone());
|
||||
|
|
|
@ -338,6 +338,7 @@ final class QuartzCronField extends CronField {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T extends Temporal & Comparable<? super T>> T nextOrSame(T temporal) {
|
||||
T result = adjust(temporal);
|
||||
if (result != null) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
|||
import org.springframework.beans.factory.config.TypedStringValue;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +39,7 @@ class ScriptingDefaultsParser implements BeanDefinitionParser {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
BeanDefinition bd =
|
||||
LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry());
|
||||
|
|
|
@ -305,6 +305,7 @@ public class ScriptFactoryPostProcessor implements SmartInstantiationAwareBeanPo
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
|
||||
// We only apply special treatment to ScriptFactory implementations here.
|
||||
if (!ScriptFactory.class.isAssignableFrom(beanClass)) {
|
||||
|
|
|
@ -70,6 +70,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
|
|||
* @see #getPropertyAccessor()
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public PropertyEditorRegistry getPropertyEditorRegistry() {
|
||||
return (getTarget() != null ? getPropertyAccessor() : null);
|
||||
}
|
||||
|
@ -109,6 +110,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
|
|||
* @see #getCustomEditor
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected Object formatFieldValue(String field, @Nullable Object value) {
|
||||
String fixedField = fixedField(field);
|
||||
// Try custom editor...
|
||||
|
|
|
@ -147,6 +147,7 @@ public class SimpleErrors implements Errors, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getFieldType(String field) {
|
||||
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(this.target.getClass(), field);
|
||||
if (pd != null) {
|
||||
|
|
|
@ -147,6 +147,7 @@ public class ParameterErrors extends ParameterValidationResult implements Errors
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ObjectError getGlobalError() {
|
||||
return this.errors.getGlobalError();
|
||||
}
|
||||
|
@ -167,6 +168,7 @@ public class ParameterErrors extends ParameterValidationResult implements Errors
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FieldError getFieldError() {
|
||||
return this.errors.getFieldError();
|
||||
}
|
||||
|
@ -187,16 +189,19 @@ public class ParameterErrors extends ParameterValidationResult implements Errors
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public FieldError getFieldError(String field) {
|
||||
return this.errors.getFieldError(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getFieldValue(String field) {
|
||||
return this.errors.getFieldError(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getFieldType(String field) {
|
||||
return this.errors.getFieldType(field);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BindingReflectionHintsRegistrar {
|
|||
* @param hints the hints instance to use
|
||||
* @param types the types to register
|
||||
*/
|
||||
public void registerReflectionHints(ReflectionHints hints, Type... types) {
|
||||
public void registerReflectionHints(ReflectionHints hints, @Nullable Type... types) {
|
||||
Set<Type> seen = new LinkedHashSet<>();
|
||||
for (Type type : types) {
|
||||
registerReflectionHints(hints, seen, type);
|
||||
|
|
|
@ -92,7 +92,7 @@ public abstract class CoroutinesUtils {
|
|||
* @return the method invocation result as reactive stream
|
||||
* @throws IllegalArgumentException if {@code method} is not a suspending function
|
||||
*/
|
||||
public static Publisher<?> invokeSuspendingFunction(Method method, Object target, Object... args) {
|
||||
public static Publisher<?> invokeSuspendingFunction(Method method, Object target, @Nullable Object... args) {
|
||||
return invokeSuspendingFunction(Dispatchers.getUnconfined(), method, target, args);
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public abstract class CoroutinesUtils {
|
|||
*/
|
||||
@SuppressWarnings({"deprecation", "DataFlowIssue"})
|
||||
public static Publisher<?> invokeSuspendingFunction(
|
||||
CoroutineContext context, Method method, @Nullable Object target, Object... args) {
|
||||
CoroutineContext context, Method method, @Nullable Object target, @Nullable Object... args) {
|
||||
|
||||
Assert.isTrue(KotlinDetector.isSuspendingFunction(method), "Method must be a suspending function");
|
||||
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
|
||||
|
|
|
@ -41,7 +41,7 @@ public abstract class NestedRuntimeException extends RuntimeException {
|
|||
* Construct a {@code NestedRuntimeException} with the specified detail message.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public NestedRuntimeException(String msg) {
|
||||
public NestedRuntimeException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CodecException extends NestedRuntimeException {
|
|||
* Create a new CodecException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public CodecException(String msg) {
|
||||
public CodecException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class CodecException extends NestedRuntimeException {
|
|||
* @param msg the detail message
|
||||
* @param cause root cause for the exception, if any
|
||||
*/
|
||||
public CodecException(String msg, @Nullable Throwable cause) {
|
||||
public CodecException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DecodingException extends CodecException {
|
|||
* Create a new DecodingException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public DecodingException(String msg) {
|
||||
public DecodingException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class DecodingException extends CodecException {
|
|||
* @param msg the detail message
|
||||
* @param cause root cause for the exception, if any
|
||||
*/
|
||||
public DecodingException(String msg, @Nullable Throwable cause) {
|
||||
public DecodingException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ public abstract class StreamUtils {
|
|||
* @throws IOException in case of I/O errors
|
||||
* @since 4.3
|
||||
*/
|
||||
public static int drain(InputStream in) throws IOException {
|
||||
public static int drain(@Nullable InputStream in) throws IOException {
|
||||
Assert.notNull(in, "No InputStream specified");
|
||||
return (int) in.transferTo(OutputStream.nullOutputStream());
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Collections;
|
|||
import org.springframework.aot.hint.ExecutableMode;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that registers reflection hints for
|
||||
|
@ -33,7 +34,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|||
class EmbeddedDatabaseFactoryRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.reflection().registerTypeIfPresent(classLoader,
|
||||
"org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory$EmbeddedDataSourceProxy",
|
||||
builder -> builder
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ObjectOptimisticLockingFailureException extends OptimisticLockingFa
|
|||
* @param msg the detail message
|
||||
* @param cause the source exception
|
||||
*/
|
||||
public ObjectOptimisticLockingFailureException(@Nullable String msg, Throwable cause) {
|
||||
public ObjectOptimisticLockingFailureException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
this.persistentClass = null;
|
||||
this.identifier = null;
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.aot.hint.ExecutableMode;
|
|||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -42,7 +43,7 @@ class EntityManagerRuntimeHints implements RuntimeHintsRegistrar {
|
|||
private static final String NATIVE_QUERY_IMPL_CLASS_NAME = "org.hibernate.query.sql.internal.NativeQueryImpl";
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
if (ClassUtils.isPresent(HIBERNATE_SESSION_FACTORY_CLASS_NAME, classLoader)) {
|
||||
hints.proxies().registerJdkProxy(TypeReference.of(HIBERNATE_SESSION_FACTORY_CLASS_NAME),
|
||||
TypeReference.of(EntityManagerFactoryInfo.class));
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on failure to acquire a lock during an update,
|
||||
* for example during a "select for update" statement.
|
||||
|
@ -32,7 +34,7 @@ public class CannotAcquireLockException extends PessimisticLockingFailureExcepti
|
|||
* Constructor for CannotAcquireLockException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public CannotAcquireLockException(String msg) {
|
||||
public CannotAcquireLockException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -41,7 +43,7 @@ public class CannotAcquireLockException extends PessimisticLockingFailureExcepti
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public CannotAcquireLockException(String msg, Throwable cause) {
|
||||
public CannotAcquireLockException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ConcurrencyFailureException extends TransientDataAccessException {
|
|||
* Constructor for ConcurrencyFailureException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public ConcurrencyFailureException(String msg) {
|
||||
public ConcurrencyFailureException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class ConcurrencyFailureException extends TransientDataAccessException {
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public ConcurrencyFailureException(String msg, @Nullable Throwable cause) {
|
||||
public ConcurrencyFailureException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class DataAccessException extends NestedRuntimeException {
|
|||
* Constructor for DataAccessException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public DataAccessException(String msg) {
|
||||
public DataAccessException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DataAccessResourceFailureException extends NonTransientDataAccessRe
|
|||
* Constructor for DataAccessResourceFailureException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public DataAccessResourceFailureException(String msg) {
|
||||
public DataAccessResourceFailureException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class DataAccessResourceFailureException extends NonTransientDataAccessRe
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public DataAccessResourceFailureException(String msg, @Nullable Throwable cause) {
|
||||
public DataAccessResourceFailureException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown when an attempt to insert or update data
|
||||
* results in violation of an integrity constraint. Note that this
|
||||
|
@ -36,7 +38,7 @@ public class DataIntegrityViolationException extends NonTransientDataAccessExcep
|
|||
* Constructor for DataIntegrityViolationException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public DataIntegrityViolationException(String msg) {
|
||||
public DataIntegrityViolationException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -45,7 +47,7 @@ public class DataIntegrityViolationException extends NonTransientDataAccessExcep
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public DataIntegrityViolationException(String msg, Throwable cause) {
|
||||
public DataIntegrityViolationException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class DataRetrievalFailureException extends NonTransientDataAccessExcepti
|
|||
* Constructor for DataRetrievalFailureException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public DataRetrievalFailureException(String msg) {
|
||||
public DataRetrievalFailureException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class DataRetrievalFailureException extends NonTransientDataAccessExcepti
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public DataRetrievalFailureException(String msg, @Nullable Throwable cause) {
|
||||
public DataRetrievalFailureException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown when an attempt to insert or update data
|
||||
* results in violation of a primary key or unique constraint.
|
||||
|
@ -34,7 +36,7 @@ public class DuplicateKeyException extends DataIntegrityViolationException {
|
|||
* Constructor for DuplicateKeyException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public DuplicateKeyException(String msg) {
|
||||
public DuplicateKeyException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -43,7 +45,7 @@ public class DuplicateKeyException extends DataIntegrityViolationException {
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public DuplicateKeyException(String msg, Throwable cause) {
|
||||
public DuplicateKeyException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Data access exception thrown when a result was expected to have at least
|
||||
* one row (or element) but zero rows (or elements) were actually returned.
|
||||
|
@ -40,7 +42,7 @@ public class EmptyResultDataAccessException extends IncorrectResultSizeDataAcces
|
|||
* @param msg the detail message
|
||||
* @param expectedSize the expected result size
|
||||
*/
|
||||
public EmptyResultDataAccessException(String msg, int expectedSize) {
|
||||
public EmptyResultDataAccessException(@Nullable String msg, int expectedSize) {
|
||||
super(msg, expectedSize, 0);
|
||||
}
|
||||
|
||||
|
@ -50,7 +52,7 @@ public class EmptyResultDataAccessException extends IncorrectResultSizeDataAcces
|
|||
* @param expectedSize the expected result size
|
||||
* @param ex the wrapped exception
|
||||
*/
|
||||
public EmptyResultDataAccessException(String msg, int expectedSize, Throwable ex) {
|
||||
public EmptyResultDataAccessException(@Nullable String msg, int expectedSize, Throwable ex) {
|
||||
super(msg, expectedSize, 0, ex);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Data access exception thrown when a result was not of the expected size,
|
||||
* for example when expecting a single row but getting 0 or more than 1 rows.
|
||||
|
@ -71,7 +73,7 @@ public class IncorrectResultSizeDataAccessException extends DataRetrievalFailure
|
|||
* @param expectedSize the expected result size
|
||||
* @param ex the wrapped exception
|
||||
*/
|
||||
public IncorrectResultSizeDataAccessException(String msg, int expectedSize, Throwable ex) {
|
||||
public IncorrectResultSizeDataAccessException(@Nullable String msg, int expectedSize, @Nullable Throwable ex) {
|
||||
super(msg, ex);
|
||||
this.expectedSize = expectedSize;
|
||||
this.actualSize = -1;
|
||||
|
@ -83,7 +85,7 @@ public class IncorrectResultSizeDataAccessException extends DataRetrievalFailure
|
|||
* @param expectedSize the expected result size
|
||||
* @param actualSize the actual result size (or -1 if unknown)
|
||||
*/
|
||||
public IncorrectResultSizeDataAccessException(String msg, int expectedSize, int actualSize) {
|
||||
public IncorrectResultSizeDataAccessException(@Nullable String msg, int expectedSize, int actualSize) {
|
||||
super(msg);
|
||||
this.expectedSize = expectedSize;
|
||||
this.actualSize = actualSize;
|
||||
|
@ -96,7 +98,7 @@ public class IncorrectResultSizeDataAccessException extends DataRetrievalFailure
|
|||
* @param actualSize the actual result size (or -1 if unknown)
|
||||
* @param ex the wrapped exception
|
||||
*/
|
||||
public IncorrectResultSizeDataAccessException(String msg, int expectedSize, int actualSize, Throwable ex) {
|
||||
public IncorrectResultSizeDataAccessException(@Nullable String msg, int expectedSize, int actualSize, @Nullable Throwable ex) {
|
||||
super(msg, ex);
|
||||
this.expectedSize = expectedSize;
|
||||
this.actualSize = actualSize;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on incorrect usage of the API, such as failing to
|
||||
* "compile" a query object that needed compilation before execution.
|
||||
|
@ -32,7 +34,7 @@ public class InvalidDataAccessApiUsageException extends NonTransientDataAccessEx
|
|||
* Constructor for InvalidDataAccessApiUsageException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public InvalidDataAccessApiUsageException(String msg) {
|
||||
public InvalidDataAccessApiUsageException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -41,7 +43,7 @@ public class InvalidDataAccessApiUsageException extends NonTransientDataAccessEx
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public InvalidDataAccessApiUsageException(String msg, Throwable cause) {
|
||||
public InvalidDataAccessApiUsageException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Root for exceptions thrown when we use a data access resource incorrectly.
|
||||
* Thrown for example on specifying bad SQL when using a RDBMS.
|
||||
|
@ -30,7 +32,7 @@ public class InvalidDataAccessResourceUsageException extends NonTransientDataAcc
|
|||
* Constructor for InvalidDataAccessResourceUsageException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public InvalidDataAccessResourceUsageException(String msg) {
|
||||
public InvalidDataAccessResourceUsageException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -39,7 +41,7 @@ public class InvalidDataAccessResourceUsageException extends NonTransientDataAcc
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public InvalidDataAccessResourceUsageException(String msg, Throwable cause) {
|
||||
public InvalidDataAccessResourceUsageException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public abstract class NonTransientDataAccessException extends DataAccessExceptio
|
|||
* Constructor for NonTransientDataAccessException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public NonTransientDataAccessException(String msg) {
|
||||
public NonTransientDataAccessException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class NonTransientDataAccessResourceException extends NonTransientDataAcc
|
|||
* Constructor for NonTransientDataAccessResourceException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public NonTransientDataAccessResourceException(String msg) {
|
||||
public NonTransientDataAccessResourceException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class NonTransientDataAccessResourceException extends NonTransientDataAcc
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public NonTransientDataAccessResourceException(String msg, @Nullable Throwable cause) {
|
||||
public NonTransientDataAccessResourceException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class OptimisticLockingFailureException extends ConcurrencyFailureExcepti
|
|||
* Constructor for OptimisticLockingFailureException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public OptimisticLockingFailureException(String msg) {
|
||||
public OptimisticLockingFailureException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class OptimisticLockingFailureException extends ConcurrencyFailureExcepti
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public OptimisticLockingFailureException(String msg, @Nullable Throwable cause) {
|
||||
public OptimisticLockingFailureException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on a pessimistic locking violation.
|
||||
* Thrown by Spring's SQLException translation mechanism
|
||||
|
@ -37,7 +39,7 @@ public class PessimisticLockingFailureException extends ConcurrencyFailureExcept
|
|||
* Constructor for PessimisticLockingFailureException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public PessimisticLockingFailureException(String msg) {
|
||||
public PessimisticLockingFailureException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -46,7 +48,7 @@ public class PessimisticLockingFailureException extends ConcurrencyFailureExcept
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public PessimisticLockingFailureException(String msg, Throwable cause) {
|
||||
public PessimisticLockingFailureException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception to be thrown on a query timeout. This could have different causes depending on
|
||||
* the database API in use but most likely thrown after the database interrupts or stops
|
||||
|
@ -34,7 +36,7 @@ public class QueryTimeoutException extends TransientDataAccessException {
|
|||
* Constructor for QueryTimeoutException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public QueryTimeoutException(String msg) {
|
||||
public QueryTimeoutException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -43,7 +45,7 @@ public class QueryTimeoutException extends TransientDataAccessException {
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public QueryTimeoutException(String msg, Throwable cause) {
|
||||
public QueryTimeoutException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public abstract class TransientDataAccessException extends DataAccessException {
|
|||
* Constructor for TransientDataAccessException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public TransientDataAccessException(String msg) {
|
||||
public TransientDataAccessException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ public abstract class TransientDataAccessException extends DataAccessException {
|
|||
* @param cause the root cause (usually from using an underlying
|
||||
* data access API such as JDBC)
|
||||
*/
|
||||
public TransientDataAccessException(String msg, @Nullable Throwable cause) {
|
||||
public TransientDataAccessException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on mismatch between Java type and database type:
|
||||
* for example on an attempt to set an object of the wrong type
|
||||
|
@ -30,7 +32,7 @@ public class TypeMismatchDataAccessException extends InvalidDataAccessResourceUs
|
|||
* Constructor for TypeMismatchDataAccessException.
|
||||
* @param msg the detail message
|
||||
*/
|
||||
public TypeMismatchDataAccessException(String msg) {
|
||||
public TypeMismatchDataAccessException(@Nullable String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
@ -39,7 +41,7 @@ public class TypeMismatchDataAccessException extends InvalidDataAccessResourceUs
|
|||
* @param msg the detail message
|
||||
* @param cause the root cause from the data access API in use
|
||||
*/
|
||||
public TypeMismatchDataAccessException(String msg, Throwable cause) {
|
||||
public TypeMismatchDataAccessException(@Nullable String msg, @Nullable Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
return (this.connectionFactory != null ? this.connectionFactory.getClass() : null);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
|
|||
import org.springframework.beans.factory.aot.BeanRegistrationCode;
|
||||
import org.springframework.beans.factory.support.RegisteredBean;
|
||||
import org.springframework.core.annotation.MergedAnnotations;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
|
@ -46,6 +47,7 @@ class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProc
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
|
||||
Class<?> beanClass = registeredBean.getBeanClass();
|
||||
if (isTransactional(beanClass)) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.aot.hint.RuntimeHints;
|
|||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeHint;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that registers runtime hints for
|
||||
|
@ -33,7 +34,7 @@ import org.springframework.aot.hint.TypeReference;
|
|||
class TransactionRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.reflection().registerTypes(TypeReference.listOf(Isolation.class, Propagation.class),
|
||||
TypeHint.builtWith(MemberCategory.DECLARED_FIELDS));
|
||||
}
|
||||
|
|
|
@ -788,19 +788,19 @@ public final class ContentDisposition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
public Builder name(@Nullable String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder filename(String filename) {
|
||||
public Builder filename(@Nullable String filename) {
|
||||
this.filename = filename;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder filename(String filename, Charset charset) {
|
||||
public Builder filename(@Nullable String filename, @Nullable Charset charset) {
|
||||
this.filename = filename;
|
||||
this.charset = charset;
|
||||
return this;
|
||||
|
@ -808,28 +808,28 @@ public final class ContentDisposition {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Builder size(Long size) {
|
||||
public Builder size(@Nullable Long size) {
|
||||
this.size = size;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Builder creationDate(ZonedDateTime creationDate) {
|
||||
public Builder creationDate(@Nullable ZonedDateTime creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Builder modificationDate(ZonedDateTime modificationDate) {
|
||||
public Builder modificationDate(@Nullable ZonedDateTime modificationDate) {
|
||||
this.modificationDate = modificationDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Builder readDate(ZonedDateTime readDate) {
|
||||
public Builder readDate(@Nullable ZonedDateTime readDate) {
|
||||
this.readDate = readDate;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ public class ProblemDetail {
|
|||
/**
|
||||
* Create a {@code ProblemDetail} instance with the given status and detail.
|
||||
*/
|
||||
public static ProblemDetail forStatusAndDetail(HttpStatusCode status, String detail) {
|
||||
public static ProblemDetail forStatusAndDetail(HttpStatusCode status, @Nullable String detail) {
|
||||
Assert.notNull(status, "HttpStatusCode is required");
|
||||
ProblemDetail problemDetail = forStatus(status.value());
|
||||
problemDetail.setDetail(detail);
|
||||
|
|
|
@ -54,6 +54,7 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
|
|||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MediaType getContentType() {
|
||||
if (this.cachedContentType != null) {
|
||||
return this.cachedContentType;
|
||||
|
@ -83,6 +84,7 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public List<String> get(Object key) {
|
||||
List<String> values = this.headers.get(key);
|
||||
return (values != null ? Collections.unmodifiableList(values) : null);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.core.io.buffer.DataBuffer;
|
|||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.json.AbstractJackson2Decoder;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
|
||||
|
@ -53,7 +54,7 @@ public class Jackson2CborDecoder extends AbstractJackson2Decoder {
|
|||
|
||||
|
||||
@Override
|
||||
public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
||||
public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
|
||||
throw new UnsupportedOperationException("Does not support stream decoding yet");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.springframework.core.io.buffer.DataBufferFactory;
|
|||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.json.AbstractJackson2Encoder;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
|
||||
|
@ -54,7 +55,8 @@ public class Jackson2CborEncoder extends AbstractJackson2Encoder {
|
|||
|
||||
|
||||
@Override
|
||||
public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
||||
public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType,
|
||||
@Nullable MimeType mimeType, @Nullable Map<String, Object> hints) {
|
||||
throw new UnsupportedOperationException("Does not support stream encoding yet");
|
||||
}
|
||||
|
||||
|
|
|
@ -300,6 +300,7 @@ public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport imple
|
|||
// Jackson2CodecSupport
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected <A extends Annotation> A getAnnotation(MethodParameter parameter, Class<A> annotType) {
|
||||
return parameter.getParameterAnnotation(annotType);
|
||||
}
|
||||
|
|
|
@ -426,6 +426,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple
|
|||
// Jackson2CodecSupport
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected <A extends Annotation> A getAnnotation(MethodParameter parameter, Class<A> annotType) {
|
||||
return parameter.getMethodAnnotation(annotType);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R
|
|||
if (this.supportsReadStreaming && InputStreamResource.class == clazz) {
|
||||
return new InputStreamResource(inputMessage.getBody()) {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFilename() {
|
||||
return inputMessage.getHeaders().getContentDisposition().getFilename();
|
||||
}
|
||||
|
|
|
@ -469,6 +469,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
return (this.objectMapper != null ? this.objectMapper.getClass() : null);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.springframework.aot.hint.MemberCategory;
|
|||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeHint.Builder;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that registers reflection entries
|
||||
|
@ -38,7 +39,7 @@ class JacksonModulesRuntimeHints implements RuntimeHintsRegistrar {
|
|||
.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.reflection()
|
||||
.registerTypeIfPresent(classLoader,
|
||||
"com.fasterxml.jackson.datatype.jdk8.Jdk8Module", asJacksonModule)
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.aot.hint.BindingReflectionHintsRegistrar;
|
|||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.http.ProblemDetail;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +34,7 @@ import org.springframework.util.ClassUtils;
|
|||
class ProblemDetailRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
BindingReflectionHintsRegistrar bindingRegistrar = new BindingReflectionHintsRegistrar();
|
||||
bindingRegistrar.registerReflectionHints(hints.reflection(), ProblemDetail.class);
|
||||
if (ClassUtils.isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper", classLoader)) {
|
||||
|
|
|
@ -61,6 +61,7 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public HttpStatusCode getStatusCode() {
|
||||
return getDelegate().getStatusCode();
|
||||
}
|
||||
|
@ -71,6 +72,7 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@Deprecated
|
||||
public Integer getRawStatusCode() {
|
||||
return getDelegate().getRawStatusCode();
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.springframework.http.HttpHeaders;
|
|||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.service.invoker.HttpExchangeAdapter;
|
||||
|
@ -70,6 +71,7 @@ public final class RestTemplateAdapter implements HttpExchangeAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T exchangeForBody(HttpRequestValues values, ParameterizedTypeReference<T> bodyType) {
|
||||
return this.restTemplate.exchange(newRequest(values), bodyType).getBody();
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String[] getConfigLocations() {
|
||||
return super.getConfigLocations();
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public abstract class AbstractMultipartHttpServletRequest extends HttpServletReq
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MultipartFile getFile(String name) {
|
||||
return getMultipartFiles().getFirst(name);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.stream.Collectors;
|
|||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.MessageSourceResolvable;
|
||||
import org.springframework.context.support.StaticMessageSource;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.FieldError;
|
||||
|
||||
|
@ -114,6 +115,7 @@ public abstract class BindErrorUtils {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected String getDefaultMessage(MessageSourceResolvable resolvable, Locale locale) {
|
||||
String message = super.getDefaultMessage(resolvable, locale);
|
||||
return (resolvable instanceof FieldError error ? error.getField() + ": " + message : message);
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.web.util;
|
|||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that registers resource
|
||||
|
@ -30,7 +31,7 @@ import org.springframework.core.io.ClassPathResource;
|
|||
class WebUtilRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.resources().registerResource(
|
||||
new ClassPathResource("HtmlCharacterEntityReferences.properties", getClass()));
|
||||
}
|
||||
|
|
|
@ -337,6 +337,7 @@ class DefaultServerRequest implements ServerRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public InetSocketAddress host() {
|
||||
return this.httpHeaders.getHost();
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class ServerWebExchangeMethodArgumentResolver extends HandlerMethodArgume
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveArgumentValue(
|
||||
MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) {
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.web.reactive.socket.server.support;
|
|||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that registers reflection hints related to
|
||||
|
@ -30,7 +31,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|||
class HandshakeWebSocketServiceRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.reflection().registerType(HandshakeWebSocketService.initUpgradeStrategy().getClass(),
|
||||
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
}
|
||||
|
|
|
@ -378,6 +378,7 @@ class DefaultServerRequest implements ServerRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public InetSocketAddress host() {
|
||||
return this.httpHeaders.getHost();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.aot.hint.ReflectionHints;
|
|||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +62,7 @@ class HandshakeHandlerRuntimeHints implements RuntimeHintsRegistrar {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
ReflectionHints reflectionHints = hints.reflection();
|
||||
if (tomcatWsPresent) {
|
||||
registerType(reflectionHints, "org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy");
|
||||
|
|
Loading…
Reference in New Issue