Skip to content

Commit 3b4f8db

Browse files
committed
Merge branch '6.1.x'
2 parents 4b0a048 + 1b563f8 commit 3b4f8db

File tree

40 files changed

+69
-17
lines changed

40 files changed

+69
-17
lines changed

Diff for: spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessor.java

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
2323
import org.springframework.beans.factory.aot.BeanRegistrationCode;
2424
import org.springframework.beans.factory.support.RegisteredBean;
25+
import org.springframework.lang.Nullable;
2526
import org.springframework.util.ClassUtils;
2627

2728
/**
@@ -38,6 +39,7 @@ class AspectJAdvisorBeanRegistrationAotProcessor implements BeanRegistrationAotP
3839

3940

4041
@Override
42+
@Nullable
4143
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
4244
if (aspectjPresent) {
4345
Class<?> beanClass = registeredBean.getBeanClass();

Diff for: spring-aop/src/main/java/org/springframework/aop/config/SpringConfiguredBeanDefinitionParser.java

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.beans.factory.support.RootBeanDefinition;
2424
import org.springframework.beans.factory.xml.BeanDefinitionParser;
2525
import org.springframework.beans.factory.xml.ParserContext;
26+
import org.springframework.lang.Nullable;
2627

2728
/**
2829
* {@link BeanDefinitionParser} responsible for parsing the
@@ -51,6 +52,7 @@ class SpringConfiguredBeanDefinitionParser implements BeanDefinitionParser {
5152

5253

5354
@Override
55+
@Nullable
5456
public BeanDefinition parse(Element element, ParserContext parserContext) {
5557
if (!parserContext.getRegistry().containsBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME)) {
5658
RootBeanDefinition def = new RootBeanDefinition();

Diff for: spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

+2
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ public Object getEarlyBeanReference(Object bean, String beanName) {
269269
}
270270

271271
@Override
272+
@Nullable
272273
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) {
273274
Object cacheKey = getCacheKey(beanClass, beanName);
274275

@@ -310,6 +311,7 @@ public PropertyValues postProcessProperties(PropertyValues pvs, Object bean, Str
310311
* @see #getAdvicesAndAdvisorsForBean
311312
*/
312313
@Override
314+
@Nullable
313315
public Object postProcessAfterInitialization(@Nullable Object bean, String beanName) {
314316
if (bean != null) {
315317
Object cacheKey = getCacheKey(bean.getClass(), beanName);

Diff for: spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public void setBeanNames(String... beanNames) {
8181
* @see #setBeanNames(String...)
8282
*/
8383
@Override
84+
@Nullable
8485
protected TargetSource getCustomTargetSource(Class<?> beanClass, String beanName) {
8586
return (isSupportedBeanName(beanClass, beanName) ?
8687
super.getCustomTargetSource(beanClass, beanName) : null);

Diff for: spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyBeanRegistrationAotProcessor.java

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class ScopedProxyBeanRegistrationAotProcessor implements BeanRegistrationAotProc
5353

5454

5555
@Override
56+
@Nullable
5657
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
5758
Class<?> beanClass = registeredBean.getBeanClass();
5859
if (beanClass.equals(ScopedProxyFactoryBean.class)) {

Diff for: spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyFactoryBean.java

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public void setBeanFactory(BeanFactory beanFactory) {
117117

118118

119119
@Override
120+
@Nullable
120121
public Object getObject() {
121122
if (this.proxy == null) {
122123
throw new FactoryBeanNotInitializedException();
@@ -125,6 +126,7 @@ public Object getObject() {
125126
}
126127

127128
@Override
129+
@Nullable
128130
public Class<?> getObjectType() {
129131
if (this.proxy != null) {
130132
return this.proxy.getClass();

Diff for: spring-beans/src/main/java/org/springframework/beans/BeanInstantiationException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public BeanInstantiationException(Class<?> beanClass, String msg, @Nullable Thro
6969
* @param cause the root cause
7070
* @since 4.3
7171
*/
72-
public BeanInstantiationException(Constructor<?> constructor, String msg, @Nullable Throwable cause) {
72+
public BeanInstantiationException(Constructor<?> constructor, @Nullable String msg, @Nullable Throwable cause) {
7373
super("Failed to instantiate [" + constructor.getDeclaringClass().getName() + "]: " + msg, cause);
7474
this.beanClass = constructor.getDeclaringClass();
7575
this.constructor = constructor;
@@ -84,7 +84,7 @@ public BeanInstantiationException(Constructor<?> constructor, String msg, @Nulla
8484
* @param cause the root cause
8585
* @since 4.3
8686
*/
87-
public BeanInstantiationException(Method constructingMethod, String msg, @Nullable Throwable cause) {
87+
public BeanInstantiationException(Method constructingMethod, @Nullable String msg, @Nullable Throwable cause) {
8888
super("Failed to instantiate [" + constructingMethod.getReturnType().getName() + "]: " + msg, cause);
8989
this.beanClass = constructingMethod.getReturnType();
9090
this.constructor = null;

Diff for: spring-beans/src/main/java/org/springframework/beans/MethodInvocationException.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.beans.PropertyChangeEvent;
2020

21+
import org.springframework.lang.Nullable;
22+
2123
/**
2224
* Thrown when a bean property getter or setter method throws an exception,
2325
* analogous to an InvocationTargetException.
@@ -38,7 +40,7 @@ public class MethodInvocationException extends PropertyAccessException {
3840
* @param propertyChangeEvent the PropertyChangeEvent that resulted in an exception
3941
* @param cause the Throwable raised by the invoked method
4042
*/
41-
public MethodInvocationException(PropertyChangeEvent propertyChangeEvent, Throwable cause) {
43+
public MethodInvocationException(PropertyChangeEvent propertyChangeEvent, @Nullable Throwable cause) {
4244
super(propertyChangeEvent, "Property '" + propertyChangeEvent.getPropertyName() + "' threw exception", cause);
4345
}
4446

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/BeanCreationException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public BeanCreationException(String beanName, String msg, Throwable cause) {
9494
* @param beanName the name of the bean requested
9595
* @param msg the detail message
9696
*/
97-
public BeanCreationException(@Nullable String resourceDescription, @Nullable String beanName, String msg) {
97+
public BeanCreationException(@Nullable String resourceDescription, @Nullable String beanName, @Nullable String msg) {
9898
super("Error creating bean with name '" + beanName + "'" +
9999
(resourceDescription != null ? " defined in " + resourceDescription : "") + ": " + msg);
100100
this.resourceDescription = resourceDescription;
@@ -110,7 +110,7 @@ public BeanCreationException(@Nullable String resourceDescription, @Nullable Str
110110
* @param msg the detail message
111111
* @param cause the root cause
112112
*/
113-
public BeanCreationException(@Nullable String resourceDescription, String beanName, String msg, Throwable cause) {
113+
public BeanCreationException(@Nullable String resourceDescription, String beanName, @Nullable String msg, Throwable cause) {
114114
this(resourceDescription, beanName, msg);
115115
initCause(cause);
116116
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/UnsatisfiedDependencyException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class UnsatisfiedDependencyException extends BeanCreationException {
4444
* @param msg the detail message
4545
*/
4646
public UnsatisfiedDependencyException(
47-
@Nullable String resourceDescription, @Nullable String beanName, String propertyName, String msg) {
47+
@Nullable String resourceDescription, @Nullable String beanName, String propertyName, @Nullable String msg) {
4848

4949
super(resourceDescription, beanName,
5050
"Unsatisfied dependency expressed through bean property '" + propertyName + "'" +
@@ -75,7 +75,7 @@ public UnsatisfiedDependencyException(
7575
* @since 4.3
7676
*/
7777
public UnsatisfiedDependencyException(
78-
@Nullable String resourceDescription, @Nullable String beanName, @Nullable InjectionPoint injectionPoint, String msg) {
78+
@Nullable String resourceDescription, @Nullable String beanName, @Nullable InjectionPoint injectionPoint, @Nullable String msg) {
7979

8080
super(resourceDescription, beanName,
8181
"Unsatisfied dependency expressed through " + injectionPoint +

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionPropertyValueCodeGeneratorDelegates.java

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.springframework.beans.factory.support.ManagedSet;
3838
import org.springframework.javapoet.AnnotationSpec;
3939
import org.springframework.javapoet.CodeBlock;
40+
import org.springframework.lang.Nullable;
4041

4142
/**
4243
* Code generator {@link Delegate} for common bean definition property values.
@@ -101,6 +102,7 @@ private static class ManagedMapDelegate implements Delegate {
101102
private static final CodeBlock EMPTY_RESULT = CodeBlock.of("$T.ofEntries()", ManagedMap.class);
102103

103104
@Override
105+
@Nullable
104106
public CodeBlock generateCode(ValueCodeGenerator valueCodeGenerator, Object value) {
105107
if (value instanceof ManagedMap<?, ?> managedMap) {
106108
return generateManagedMapCode(valueCodeGenerator, managedMap);
@@ -137,6 +139,7 @@ private <K, V> CodeBlock generateManagedMapCode(ValueCodeGenerator valueCodeGene
137139
private static class LinkedHashMapDelegate extends MapDelegate {
138140

139141
@Override
142+
@Nullable
140143
protected CodeBlock generateMapCode(ValueCodeGenerator valueCodeGenerator, Map<?, ?> map) {
141144
GeneratedMethods generatedMethods = valueCodeGenerator.getGeneratedMethods();
142145
if (map instanceof LinkedHashMap<?, ?> && generatedMethods != null) {
@@ -172,6 +175,7 @@ private CodeBlock generateLinkedHashMapCode(ValueCodeGenerator valueCodeGenerato
172175
private static class BeanReferenceDelegate implements Delegate {
173176

174177
@Override
178+
@Nullable
175179
public CodeBlock generateCode(ValueCodeGenerator valueCodeGenerator, Object value) {
176180
if (value instanceof RuntimeBeanReference runtimeBeanReference &&
177181
runtimeBeanReference.getBeanType() != null) {
@@ -193,6 +197,7 @@ else if (value instanceof BeanReference beanReference) {
193197
private static class TypedStringValueDelegate implements Delegate {
194198

195199
@Override
200+
@Nullable
196201
public CodeBlock generateCode(ValueCodeGenerator valueCodeGenerator, Object value) {
197202
if (value instanceof TypedStringValue typedStringValue) {
198203
return generateTypeStringValueCode(valueCodeGenerator, typedStringValue);

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public void afterPropertiesSet() throws Exception {
151151
* @see #getEarlySingletonInterfaces()
152152
*/
153153
@Override
154+
@Nullable
154155
public final T getObject() throws Exception {
155156
if (isSingleton()) {
156157
return (this.initialized ? this.singletonInstance : getEarlySingletonInstance());

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public Object getObject() throws IllegalAccessException {
226226
}
227227

228228
@Override
229+
@Nullable
229230
public Class<?> getObjectType() {
230231
return (this.fieldObject != null ? this.fieldObject.getType() : null);
231232
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/config/MethodInvokingFactoryBean.java

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public Object getObject() throws Exception {
136136
* or {@code null} if not known in advance.
137137
*/
138138
@Override
139+
@Nullable
139140
public Class<?> getObjectType() {
140141
if (!isPrepared()) {
141142
// Not fully initialized yet -> return null to indicate "not known yet".

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ public Object getObject() throws BeansException {
224224
}
225225

226226
@Override
227+
@Nullable
227228
public Class<?> getObjectType() {
228229
return this.resultType;
229230
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.java

+1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ public Object getObject() {
335335
}
336336

337337
@Override
338+
@Nullable
338339
public Class<?> getObjectType() {
339340
return this.serviceLocatorInterface;
340341
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/CglibSubclassingInstantiationStrategy.java

+1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ public LookupOverrideMethodInterceptor(RootBeanDefinition beanDefinition, BeanFa
241241
}
242242

243243
@Override
244+
@Nullable
244245
public Object intercept(Object obj, Method method, Object[] args, MethodProxy mp) throws Throwable {
245246
// Cast is safe, as CallbackFilter filters are used selectively.
246247
LookupOverride lo = (LookupOverride) getBeanDefinition().getMethodOverrides().getOverride(method);

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

+1
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,7 @@ public boolean hasShortcut() {
14351435
}
14361436

14371437
@Override
1438+
@Nullable
14381439
public Object resolveShortcut(BeanFactory beanFactory) {
14391440
String shortcut = this.shortcut;
14401441
return (shortcut != null ? beanFactory.getBean(shortcut, getDependencyType()) : null);

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ else if (!reactiveStreamsPresent || !new ReactiveDestroyMethodHandler().await(de
342342
}
343343
}
344344

345-
void logDestroyMethodException(Method destroyMethod, Throwable ex) {
345+
void logDestroyMethodException(Method destroyMethod, @Nullable Throwable ex) {
346346
if (logger.isWarnEnabled()) {
347347
String msg = "Custom destroy method '" + destroyMethod.getName() + "' on bean with name '" +
348348
this.beanName + "' propagated an exception";

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/InstanceSupplier.java

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public V get(RegisteredBean registeredBean) throws Exception {
8383
return after.applyWithException(registeredBean, InstanceSupplier.this.get(registeredBean));
8484
}
8585
@Override
86+
@Nullable
8687
public Method getFactoryMethod() {
8788
return InstanceSupplier.this.getFactoryMethod();
8889
}
@@ -126,6 +127,7 @@ public T get(RegisteredBean registeredBean) throws Exception {
126127
return supplier.getWithException();
127128
}
128129
@Override
130+
@Nullable
129131
public Method getFactoryMethod() {
130132
return factoryMethod;
131133
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java

+1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ public RootBeanDefinition(RootBeanDefinition original) {
277277

278278

279279
@Override
280+
@Nullable
280281
public String getParentName() {
281282
return null;
282283
}

Diff for: spring-beans/src/main/java/org/springframework/beans/factory/support/StaticListableBeanFactory.java

+2
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,13 @@ public boolean isTypeMatch(String name, @Nullable Class<?> typeToMatch) throws N
232232
}
233233

234234
@Override
235+
@Nullable
235236
public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
236237
return getType(name, true);
237238
}
238239

239240
@Override
241+
@Nullable
240242
public Class<?> getType(String name, boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException {
241243
String beanName = BeanFactoryUtils.transformedBeanName(name);
242244

Diff for: spring-core/src/main/java/org/springframework/util/MethodInvoker.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void setStaticMethod(String staticMethod) {
136136
* Set arguments for the method invocation. If this property is not set,
137137
* or the Object array is of length 0, a method with no arguments is assumed.
138138
*/
139-
public void setArguments(Object... arguments) {
139+
public void setArguments(@Nullable Object... arguments) {
140140
this.arguments = arguments;
141141
}
142142

Diff for: spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static void handleInvocationTargetException(InvocationTargetException ex)
137137
* @param ex the exception to rethrow
138138
* @throws RuntimeException the rethrown exception
139139
*/
140-
public static void rethrowRuntimeException(Throwable ex) {
140+
public static void rethrowRuntimeException(@Nullable Throwable ex) {
141141
if (ex instanceof RuntimeException runtimeException) {
142142
throw runtimeException;
143143
}
@@ -158,7 +158,7 @@ public static void rethrowRuntimeException(Throwable ex) {
158158
* @param throwable the exception to rethrow
159159
* @throws Exception the rethrown exception (in case of a checked exception)
160160
*/
161-
public static void rethrowException(Throwable throwable) throws Exception {
161+
public static void rethrowException(@Nullable Throwable throwable) throws Exception {
162162
if (throwable instanceof Exception exception) {
163163
throw exception;
164164
}

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/BadSqlGrammarException.java

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.sql.SQLException;
2020

2121
import org.springframework.dao.InvalidDataAccessResourceUsageException;
22+
import org.springframework.lang.Nullable;
2223

2324
/**
2425
* Exception thrown when SQL specified is invalid. Such exceptions always have
@@ -52,6 +53,7 @@ public BadSqlGrammarException(String task, String sql, SQLException ex) {
5253
/**
5354
* Return the wrapped SQLException.
5455
*/
56+
@Nullable
5557
public SQLException getSQLException() {
5658
return (SQLException) getCause();
5759
}

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/InvalidResultSetAccessException.java

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public InvalidResultSetAccessException(SQLException ex) {
6464
/**
6565
* Return the wrapped SQLException.
6666
*/
67+
@Nullable
6768
public SQLException getSQLException() {
6869
return (SQLException) getCause();
6970
}

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/SQLWarningException.java

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.sql.SQLWarning;
2020

2121
import org.springframework.dao.UncategorizedDataAccessException;
22+
import org.springframework.lang.Nullable;
2223

2324
/**
2425
* Exception thrown when we're not ignoring {@link java.sql.SQLWarning SQLWarnings}.
@@ -49,6 +50,7 @@ public SQLWarningException(String msg, SQLWarning ex) {
4950
* Return the underlying {@link SQLWarning}.
5051
* @since 5.3.29
5152
*/
53+
@Nullable
5254
public SQLWarning getSQLWarning() {
5355
return (SQLWarning) getCause();
5456
}
@@ -58,6 +60,7 @@ public SQLWarning getSQLWarning() {
5860
* @deprecated as of 5.3.29, in favor of {@link #getSQLWarning()}
5961
*/
6062
@Deprecated(since = "5.3.29")
63+
@Nullable
6164
public SQLWarning SQLWarning() {
6265
return getSQLWarning();
6366
}

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/UncategorizedSQLException.java

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public UncategorizedSQLException(String task, @Nullable String sql, SQLException
5353
/**
5454
* Return the underlying SQLException.
5555
*/
56+
@Nullable
5657
public SQLException getSQLException() {
5758
return (SQLException) getCause();
5859
}

Diff for: spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

+2
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,13 @@ public <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T>
907907

908908
@Deprecated
909909
@Override
910+
@Nullable
910911
public <T> T queryForObject(String sql, @Nullable Object[] args, Class<T> requiredType) throws DataAccessException {
911912
return queryForObject(sql, args, getSingleColumnRowMapper(requiredType));
912913
}
913914

914915
@Override
916+
@Nullable
915917
public <T> T queryForObject(String sql, Class<T> requiredType, @Nullable Object... args) throws DataAccessException {
916918
return queryForObject(sql, args, getSingleColumnRowMapper(requiredType));
917919
}

0 commit comments

Comments
 (0)