Browse Source

Merge branch '6.1.x'

pull/32550/head
Sébastien Deleuze 2 years ago
parent
commit
2fea3d7921
  1. 1
      spring-aop/src/main/java/org/springframework/aop/target/LazyInitTargetSource.java
  2. 1
      spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java
  3. 1
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java
  4. 2
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CachePutInterceptor.java
  5. 2
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheRemoveAllInterceptor.java
  6. 2
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheRemoveEntryInterceptor.java
  7. 1
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java
  8. 2
      spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleExceptionCacheResolver.java
  9. 1
      spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java
  10. 2
      spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java
  11. 3
      spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java
  12. 2
      spring-context/src/main/java/org/springframework/cache/Cache.java
  13. 1
      spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java
  14. 1
      spring-context/src/main/java/org/springframework/cache/interceptor/NamedCacheResolver.java
  15. 2
      spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
  16. 1
      spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java
  17. 10
      spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java
  18. 1
      spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
  19. 1
      spring-context/src/main/java/org/springframework/context/support/AbstractMessageSource.java
  20. 1
      spring-context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java
  21. 1
      spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java
  22. 1
      spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java
  23. 3
      spring-context/src/main/java/org/springframework/format/support/FormattingConversionServiceRuntimeHints.java
  24. 4
      spring-context/src/main/java/org/springframework/jmx/access/InvalidInvocationException.java
  25. 1
      spring-context/src/main/java/org/springframework/jmx/access/MBeanProxyFactoryBean.java
  26. 1
      spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java
  27. 1
      spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurerSupport.java
  28. 3
      spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskScheduler.java
  29. 1
      spring-context/src/main/java/org/springframework/scheduling/config/TaskSchedulerRouter.java
  30. 1
      spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java
  31. 1
      spring-context/src/main/java/org/springframework/scheduling/support/QuartzCronField.java
  32. 2
      spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java
  33. 1
      spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
  34. 2
      spring-context/src/main/java/org/springframework/validation/AbstractPropertyBindingResult.java
  35. 1
      spring-context/src/main/java/org/springframework/validation/SimpleErrors.java
  36. 5
      spring-context/src/main/java/org/springframework/validation/method/ParameterErrors.java
  37. 2
      spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java
  38. 4
      spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java
  39. 2
      spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java
  40. 4
      spring-core/src/main/java/org/springframework/core/codec/CodecException.java
  41. 4
      spring-core/src/main/java/org/springframework/core/codec/DecodingException.java
  42. 2
      spring-core/src/main/java/org/springframework/util/StreamUtils.java
  43. 3
      spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryRuntimeHints.java
  44. 2
      spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java
  45. 3
      spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java
  46. 6
      spring-tx/src/main/java/org/springframework/dao/CannotAcquireLockException.java
  47. 4
      spring-tx/src/main/java/org/springframework/dao/ConcurrencyFailureException.java
  48. 2
      spring-tx/src/main/java/org/springframework/dao/DataAccessException.java
  49. 4
      spring-tx/src/main/java/org/springframework/dao/DataAccessResourceFailureException.java
  50. 6
      spring-tx/src/main/java/org/springframework/dao/DataIntegrityViolationException.java
  51. 4
      spring-tx/src/main/java/org/springframework/dao/DataRetrievalFailureException.java
  52. 6
      spring-tx/src/main/java/org/springframework/dao/DuplicateKeyException.java
  53. 6
      spring-tx/src/main/java/org/springframework/dao/EmptyResultDataAccessException.java
  54. 8
      spring-tx/src/main/java/org/springframework/dao/IncorrectResultSizeDataAccessException.java
  55. 6
      spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessApiUsageException.java
  56. 6
      spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessResourceUsageException.java
  57. 2
      spring-tx/src/main/java/org/springframework/dao/NonTransientDataAccessException.java
  58. 4
      spring-tx/src/main/java/org/springframework/dao/NonTransientDataAccessResourceException.java
  59. 4
      spring-tx/src/main/java/org/springframework/dao/OptimisticLockingFailureException.java
  60. 6
      spring-tx/src/main/java/org/springframework/dao/PessimisticLockingFailureException.java
  61. 6
      spring-tx/src/main/java/org/springframework/dao/QueryTimeoutException.java
  62. 4
      spring-tx/src/main/java/org/springframework/dao/TransientDataAccessException.java
  63. 6
      spring-tx/src/main/java/org/springframework/dao/TypeMismatchDataAccessException.java
  64. 1
      spring-tx/src/main/java/org/springframework/jca/support/LocalConnectionFactoryBean.java
  65. 2
      spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionBeanRegistrationAotProcessor.java
  66. 3
      spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java
  67. 14
      spring-web/src/main/java/org/springframework/http/ContentDisposition.java
  68. 2
      spring-web/src/main/java/org/springframework/http/ProblemDetail.java
  69. 2
      spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java
  70. 3
      spring-web/src/main/java/org/springframework/http/codec/cbor/Jackson2CborDecoder.java
  71. 4
      spring-web/src/main/java/org/springframework/http/codec/cbor/Jackson2CborEncoder.java
  72. 1
      spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java
  73. 1
      spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java
  74. 1
      spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java
  75. 1
      spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java
  76. 3
      spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java
  77. 3
      spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailRuntimeHints.java
  78. 2
      spring-web/src/main/java/org/springframework/http/server/reactive/ServerHttpResponseDecorator.java
  79. 2
      spring-web/src/main/java/org/springframework/web/client/support/RestTemplateAdapter.java
  80. 1
      spring-web/src/main/java/org/springframework/web/context/support/AbstractRefreshableWebApplicationContext.java
  81. 1
      spring-web/src/main/java/org/springframework/web/multipart/support/AbstractMultipartHttpServletRequest.java
  82. 2
      spring-web/src/main/java/org/springframework/web/util/BindErrorUtils.java
  83. 3
      spring-web/src/main/java/org/springframework/web/util/WebUtilRuntimeHints.java
  84. 1
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequest.java
  85. 1
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeMethodArgumentResolver.java
  86. 3
      spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketServiceRuntimeHints.java
  87. 1
      spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java
  88. 3
      spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java

1
spring-aop/src/main/java/org/springframework/aop/target/LazyInitTargetSource.java

@ -65,6 +65,7 @@ public class LazyInitTargetSource extends AbstractBeanFactoryBasedTargetSource { @@ -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());

1
spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java vendored

@ -121,6 +121,7 @@ public class JCacheCacheManager extends AbstractTransactionSupportingCacheManage @@ -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");

1
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AnnotationJCacheOperationSource.java vendored

@ -58,6 +58,7 @@ public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJC @@ -58,6 +58,7 @@ public abstract class AnnotationJCacheOperationSource extends AbstractFallbackJC
}
@Override
@Nullable
protected JCacheOperation<?> findCacheOperation(Method method, @Nullable Class<?> targetType) {
CacheResult cacheResult = method.getAnnotation(CacheResult.class);
CachePut cachePut = method.getAnnotation(CachePut.class);

2
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CachePutInterceptor.java vendored

@ -23,6 +23,7 @@ import org.springframework.cache.Cache; @@ -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, @@ -39,6 +40,7 @@ class CachePutInterceptor extends AbstractKeyCacheInterceptor<CachePutOperation,
@Override
@Nullable
protected Object invoke(
CacheOperationInvocationContext<CachePutOperation> context, CacheOperationInvoker invoker) {

2
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheRemoveAllInterceptor.java vendored

@ -22,6 +22,7 @@ import org.springframework.cache.Cache; @@ -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 @@ -38,6 +39,7 @@ class CacheRemoveAllInterceptor extends AbstractCacheInterceptor<CacheRemoveAllO
@Override
@Nullable
protected Object invoke(
CacheOperationInvocationContext<CacheRemoveAllOperation> context, CacheOperationInvoker invoker) {

2
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/CacheRemoveEntryInterceptor.java vendored

@ -22,6 +22,7 @@ import org.springframework.cache.Cache; @@ -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 @@ -38,6 +39,7 @@ class CacheRemoveEntryInterceptor extends AbstractKeyCacheInterceptor<CacheRemov
@Override
@Nullable
protected Object invoke(
CacheOperationInvocationContext<CacheRemoveOperation> context, CacheOperationInvoker invoker) {

1
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java vendored

@ -180,6 +180,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial @@ -180,6 +180,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
}
@Override
@Nullable
public Object invoke() throws ThrowableWrapper {
return invokeOperation(this.delegate);
}

2
spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleExceptionCacheResolver.java vendored

@ -24,6 +24,7 @@ import org.springframework.cache.interceptor.AbstractCacheResolver; @@ -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 { @@ -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)) {

1
spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheDecorator.java vendored

@ -83,6 +83,7 @@ public class TransactionAwareCacheDecorator implements Cache { @@ -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);
}

2
spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java

@ -199,6 +199,7 @@ public class MethodInvokingJobDetailFactoryBean extends ArgumentConvertingMethod @@ -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 @@ -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) {

3
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java

@ -22,6 +22,7 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar; @@ -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 { @@ -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;
}

2
spring-context/src/main/java/org/springframework/cache/Cache.java vendored

@ -315,7 +315,7 @@ public interface Cache { @@ -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;
}

1
spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java vendored

@ -223,6 +223,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache { @@ -223,6 +223,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
}
@Override
@Nullable
protected Object fromStoreValue(@Nullable Object storeValue) {
if (storeValue != null && this.serialization != null) {
try {

1
spring-context/src/main/java/org/springframework/cache/interceptor/NamedCacheResolver.java vendored

@ -52,6 +52,7 @@ public class NamedCacheResolver extends AbstractCacheResolver { @@ -52,6 +52,7 @@ public class NamedCacheResolver extends AbstractCacheResolver {
}
@Override
@Nullable
protected Collection<String> getCacheNames(CacheOperationInvocationContext<?> context) {
return this.cacheNames;
}

2
spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java

@ -315,6 +315,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean @@ -315,6 +315,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
}
@Override
@Nullable
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
BeanRegistrationAotContribution parentAotContribution = super.processAheadOfTime(registeredBean);
Class<?> beanClass = registeredBean.getBeanClass();
@ -351,6 +352,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean @@ -351,6 +352,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
}
@Override
@Nullable
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
return null;
}

1
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java

@ -334,6 +334,7 @@ class ConfigurationClassEnhancer { @@ -334,6 +334,7 @@ class ConfigurationClassEnhancer {
return resolveBeanReference(beanMethod, beanMethodArgs, beanFactory, beanName);
}
@Nullable
private Object resolveBeanReference(Method beanMethod, Object[] beanMethodArgs,
ConfigurableBeanFactory beanFactory, String beanName) {

10
spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java

@ -367,7 +367,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe @@ -367,7 +367,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)) {
@ -433,8 +433,8 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe @@ -433,8 +433,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");
@ -448,7 +448,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe @@ -448,7 +448,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)) {
@ -460,7 +460,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe @@ -460,7 +460,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++) {

1
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -1479,6 +1479,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader @@ -1479,6 +1479,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);
}

1
spring-context/src/main/java/org/springframework/context/support/AbstractMessageSource.java

@ -137,6 +137,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme @@ -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) {

1
spring-context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java

@ -123,6 +123,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart @@ -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) {

1
spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java

@ -191,6 +191,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased @@ -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);

1
spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java

@ -145,6 +145,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou @@ -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) {

3
spring-context/src/main/java/org/springframework/format/support/FormattingConversionServiceRuntimeHints.java

@ -19,6 +19,7 @@ package org.springframework.format.support; @@ -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; @@ -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"));
}
}

4
spring-context/src/main/java/org/springframework/jmx/access/InvalidInvocationException.java

@ -18,6 +18,8 @@ package org.springframework.jmx.access; @@ -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 { @@ -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);
}

1
spring-context/src/main/java/org/springframework/jmx/access/MBeanProxyFactoryBean.java

@ -108,6 +108,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor @@ -108,6 +108,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
}
@Override
@Nullable
public Class<?> getObjectType() {
return this.proxyInterface;
}

1
spring-context/src/main/java/org/springframework/jndi/JndiObjectFactoryBean.java

@ -273,6 +273,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator @@ -273,6 +273,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator
}
@Override
@Nullable
public Class<?> getObjectType() {
if (this.proxyInterfaces != null) {
if (this.proxyInterfaces.length == 1) {

1
spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurerSupport.java

@ -34,6 +34,7 @@ import org.springframework.lang.Nullable; @@ -34,6 +34,7 @@ import org.springframework.lang.Nullable;
public class AsyncConfigurerSupport implements AsyncConfigurer {
@Override
@Nullable
public Executor getAsyncExecutor() {
return null;
}

3
spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskScheduler.java

@ -367,16 +367,19 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T @@ -367,16 +367,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);
}

1
spring-context/src/main/java/org/springframework/scheduling/config/TaskSchedulerRouter.java

@ -106,6 +106,7 @@ public class TaskSchedulerRouter implements TaskScheduler, BeanNameAware, BeanFa @@ -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);
}

1
spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java

@ -112,6 +112,7 @@ public class CronTrigger implements 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());

1
spring-context/src/main/java/org/springframework/scheduling/support/QuartzCronField.java

@ -338,6 +338,7 @@ final class QuartzCronField extends CronField { @@ -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) {

2
spring-context/src/main/java/org/springframework/scripting/config/ScriptingDefaultsParser.java

@ -22,6 +22,7 @@ import org.springframework.beans.factory.config.BeanDefinition; @@ -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 { @@ -38,6 +39,7 @@ class ScriptingDefaultsParser implements BeanDefinitionParser {
@Override
@Nullable
public BeanDefinition parse(Element element, ParserContext parserContext) {
BeanDefinition bd =
LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry());

1
spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java

@ -304,6 +304,7 @@ public class ScriptFactoryPostProcessor implements SmartInstantiationAwareBeanPo @@ -304,6 +304,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)) {

2
spring-context/src/main/java/org/springframework/validation/AbstractPropertyBindingResult.java

@ -70,6 +70,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul @@ -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 @@ -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...

1
spring-context/src/main/java/org/springframework/validation/SimpleErrors.java

@ -147,6 +147,7 @@ public class SimpleErrors implements Errors, Serializable { @@ -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) {

5
spring-context/src/main/java/org/springframework/validation/method/ParameterErrors.java

@ -147,6 +147,7 @@ public class ParameterErrors extends ParameterValidationResult implements Errors @@ -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 @@ -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 @@ -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);
}

2
spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java

@ -63,7 +63,7 @@ public class BindingReflectionHintsRegistrar { @@ -63,7 +63,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 HashSet<>();
for (Type type : types) {
registerReflectionHints(hints, seen, type);

4
spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java

@ -92,7 +92,7 @@ public abstract class CoroutinesUtils { @@ -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 { @@ -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);

2
spring-core/src/main/java/org/springframework/core/NestedRuntimeException.java

@ -41,7 +41,7 @@ public abstract class NestedRuntimeException extends RuntimeException { @@ -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);
}

4
spring-core/src/main/java/org/springframework/core/codec/CodecException.java

@ -34,7 +34,7 @@ public class CodecException extends NestedRuntimeException { @@ -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 { @@ -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);
}

4
spring-core/src/main/java/org/springframework/core/codec/DecodingException.java

@ -39,7 +39,7 @@ public class DecodingException extends CodecException { @@ -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 { @@ -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);
}

2
spring-core/src/main/java/org/springframework/util/StreamUtils.java

@ -201,7 +201,7 @@ public abstract class StreamUtils { @@ -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());
}

3
spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryRuntimeHints.java

@ -21,6 +21,7 @@ import java.util.Collections; @@ -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; @@ -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

2
spring-orm/src/main/java/org/springframework/orm/ObjectOptimisticLockingFailureException.java

@ -42,7 +42,7 @@ public class ObjectOptimisticLockingFailureException extends OptimisticLockingFa @@ -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;

3
spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java

@ -22,6 +22,7 @@ import org.springframework.aot.hint.ExecutableMode; @@ -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 { @@ -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));

6
spring-tx/src/main/java/org/springframework/dao/CannotAcquireLockException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

4
spring-tx/src/main/java/org/springframework/dao/ConcurrencyFailureException.java

@ -36,7 +36,7 @@ public class ConcurrencyFailureException extends TransientDataAccessException { @@ -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 { @@ -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);
}

2
spring-tx/src/main/java/org/springframework/dao/DataAccessException.java

@ -43,7 +43,7 @@ public abstract class DataAccessException extends NestedRuntimeException { @@ -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);
}

4
spring-tx/src/main/java/org/springframework/dao/DataAccessResourceFailureException.java

@ -32,7 +32,7 @@ public class DataAccessResourceFailureException extends NonTransientDataAccessRe @@ -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 @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/DataIntegrityViolationException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

4
spring-tx/src/main/java/org/springframework/dao/DataRetrievalFailureException.java

@ -33,7 +33,7 @@ public class DataRetrievalFailureException extends NonTransientDataAccessExcepti @@ -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 @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/DuplicateKeyException.java

@ -16,6 +16,8 @@ @@ -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 { @@ -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 { @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/EmptyResultDataAccessException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

8
spring-tx/src/main/java/org/springframework/dao/IncorrectResultSizeDataAccessException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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 @@ -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;

6
spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessApiUsageException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/InvalidDataAccessResourceUsageException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

2
spring-tx/src/main/java/org/springframework/dao/NonTransientDataAccessException.java

@ -34,7 +34,7 @@ public abstract class NonTransientDataAccessException extends DataAccessExceptio @@ -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);
}

4
spring-tx/src/main/java/org/springframework/dao/NonTransientDataAccessResourceException.java

@ -32,7 +32,7 @@ public class NonTransientDataAccessResourceException extends NonTransientDataAcc @@ -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 @@ -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);
}

4
spring-tx/src/main/java/org/springframework/dao/OptimisticLockingFailureException.java

@ -35,7 +35,7 @@ public class OptimisticLockingFailureException extends ConcurrencyFailureExcepti @@ -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 @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/PessimisticLockingFailureException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/QueryTimeoutException.java

@ -16,6 +16,8 @@ @@ -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 { @@ -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 { @@ -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);
}

4
spring-tx/src/main/java/org/springframework/dao/TransientDataAccessException.java

@ -34,7 +34,7 @@ public abstract class TransientDataAccessException extends DataAccessException { @@ -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 { @@ -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);
}

6
spring-tx/src/main/java/org/springframework/dao/TypeMismatchDataAccessException.java

@ -16,6 +16,8 @@ @@ -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 @@ -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 @@ -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);
}

1
spring-tx/src/main/java/org/springframework/jca/support/LocalConnectionFactoryBean.java

@ -132,6 +132,7 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali @@ -132,6 +132,7 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali
}
@Override
@Nullable
public Class<?> getObjectType() {
return (this.connectionFactory != null ? this.connectionFactory.getClass() : null);
}

2
spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionBeanRegistrationAotProcessor.java

@ -28,6 +28,7 @@ import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor; @@ -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 @@ -46,6 +47,7 @@ class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProc
@Override
@Nullable
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
Class<?> beanClass = registeredBean.getBeanClass();
if (isTransactional(beanClass)) {

3
spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java

@ -21,6 +21,7 @@ import org.springframework.aot.hint.RuntimeHints; @@ -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; @@ -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));
}

14
spring-web/src/main/java/org/springframework/http/ContentDisposition.java

@ -788,19 +788,19 @@ public final class ContentDisposition { @@ -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 { @@ -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;
}

2
spring-web/src/main/java/org/springframework/http/ProblemDetail.java

@ -301,7 +301,7 @@ public class ProblemDetail { @@ -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);

2
spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java

@ -56,6 +56,7 @@ class ReadOnlyHttpHeaders extends HttpHeaders { @@ -56,6 +56,7 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
@Override
@Nullable
public MediaType getContentType() {
if (this.cachedContentType != null) {
return this.cachedContentType;
@ -85,6 +86,7 @@ class ReadOnlyHttpHeaders extends HttpHeaders { @@ -85,6 +86,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);

3
spring-web/src/main/java/org/springframework/http/codec/cbor/Jackson2CborDecoder.java

@ -28,6 +28,7 @@ import org.springframework.core.io.buffer.DataBuffer; @@ -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 { @@ -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");
}

4
spring-web/src/main/java/org/springframework/http/codec/cbor/Jackson2CborEncoder.java

@ -29,6 +29,7 @@ import org.springframework.core.io.buffer.DataBufferFactory; @@ -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 { @@ -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");
}

1
spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Decoder.java

@ -300,6 +300,7 @@ public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport imple @@ -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);
}

1
spring-web/src/main/java/org/springframework/http/codec/json/AbstractJackson2Encoder.java

@ -426,6 +426,7 @@ public abstract class AbstractJackson2Encoder extends Jackson2CodecSupport imple @@ -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);
}

1
spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java

@ -82,6 +82,7 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R @@ -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();
}

1
spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java

@ -469,6 +469,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper @@ -469,6 +469,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
}
@Override
@Nullable
public Class<?> getObjectType() {
return (this.objectMapper != null ? this.objectMapper.getClass() : null);
}

3
spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java

@ -22,6 +22,7 @@ import org.springframework.aot.hint.MemberCategory; @@ -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 { @@ -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)

3
spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailRuntimeHints.java

@ -20,6 +20,7 @@ import org.springframework.aot.hint.BindingReflectionHintsRegistrar; @@ -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; @@ -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)) {

2
spring-web/src/main/java/org/springframework/http/server/reactive/ServerHttpResponseDecorator.java

@ -61,6 +61,7 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse { @@ -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 { @@ -71,6 +72,7 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse {
}
@Override
@Nullable
@Deprecated
public Integer getRawStatusCode() {
return getDelegate().getRawStatusCode();

2
spring-web/src/main/java/org/springframework/web/client/support/RestTemplateAdapter.java

@ -26,6 +26,7 @@ import org.springframework.http.HttpHeaders; @@ -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 { @@ -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();
}

1
spring-web/src/main/java/org/springframework/web/context/support/AbstractRefreshableWebApplicationContext.java

@ -144,6 +144,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR @@ -144,6 +144,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
}
@Override
@Nullable
public String[] getConfigLocations() {
return super.getConfigLocations();
}

1
spring-web/src/main/java/org/springframework/web/multipart/support/AbstractMultipartHttpServletRequest.java

@ -84,6 +84,7 @@ public abstract class AbstractMultipartHttpServletRequest extends HttpServletReq @@ -84,6 +84,7 @@ public abstract class AbstractMultipartHttpServletRequest extends HttpServletReq
}
@Override
@Nullable
public MultipartFile getFile(String name) {
return getMultipartFiles().getFirst(name);
}

2
spring-web/src/main/java/org/springframework/web/util/BindErrorUtils.java

@ -25,6 +25,7 @@ import java.util.stream.Collectors; @@ -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 { @@ -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);

3
spring-web/src/main/java/org/springframework/web/util/WebUtilRuntimeHints.java

@ -19,6 +19,7 @@ package org.springframework.web.util; @@ -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; @@ -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()));
}

1
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequest.java

@ -337,6 +337,7 @@ class DefaultServerRequest implements ServerRequest { @@ -337,6 +337,7 @@ class DefaultServerRequest implements ServerRequest {
}
@Override
@Nullable
public InetSocketAddress host() {
return this.httpHeaders.getHost();
}

1
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ServerWebExchangeMethodArgumentResolver.java

@ -80,6 +80,7 @@ public class ServerWebExchangeMethodArgumentResolver extends HandlerMethodArgume @@ -80,6 +80,7 @@ public class ServerWebExchangeMethodArgumentResolver extends HandlerMethodArgume
}
@Override
@Nullable
public Object resolveArgumentValue(
MethodParameter methodParameter, BindingContext context, ServerWebExchange exchange) {

3
spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketServiceRuntimeHints.java

@ -19,6 +19,7 @@ package org.springframework.web.reactive.socket.server.support; @@ -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; @@ -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);
}

1
spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java

@ -378,6 +378,7 @@ class DefaultServerRequest implements ServerRequest { @@ -378,6 +378,7 @@ class DefaultServerRequest implements ServerRequest {
}
@Override
@Nullable
public InetSocketAddress host() {
return this.httpHeaders.getHost();
}

3
spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java

@ -21,6 +21,7 @@ import org.springframework.aot.hint.ReflectionHints; @@ -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 { @@ -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…
Cancel
Save