Skip to content

Commit 0fbebd8

Browse files
committed
Revise contribution
See gh-35660
1 parent 9483670 commit 0fbebd8

6 files changed

Lines changed: 22 additions & 14 deletions

File tree

spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
7070
/** use serialVersionUID from Spring 2.0 for interoperability. */
7171
private static final long serialVersionUID = 2651364800145442165L;
7272

73+
private static final Advisor[] EMPTY_ADVISOR_ARRAY = new Advisor[0];
74+
7375

7476
/**
7577
* Canonical TargetSource when there's no target, and behavior is
7678
* supplied by the advisors.
7779
*/
7880
public static final TargetSource EMPTY_TARGET_SOURCE = EmptyTargetSource.INSTANCE;
79-
/** Empty advisor array constant. */
80-
public static final Advisor[] EMPTY_ADVISORS = new Advisor[0];
81+
8182

8283
/** Package-protected to allow direct access for efficiency. */
8384
@SuppressWarnings("serial")
@@ -289,7 +290,7 @@ private boolean isAdvisorIntroducedInterface(Class<?> ifc) {
289290

290291
@Override
291292
public final Advisor[] getAdvisors() {
292-
return this.advisors.toArray(EMPTY_ADVISORS);
293+
return this.advisors.toArray(EMPTY_ADVISOR_ARRAY);
293294
}
294295

295296
@Override

spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
*/
4040
@SuppressWarnings("serial")
4141
public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Serializable {
42-
private static final MethodInterceptor [] EMPTY_INTERCEPTOR_ARRAY = new MethodInterceptor[0];
42+
43+
private static final MethodInterceptor[] EMPTY_METHOD_INTERCEPTOR_ARRAY = new MethodInterceptor[0];
44+
4345

4446
private final List<AdvisorAdapter> adapters = new ArrayList<>(3);
4547

@@ -90,7 +92,7 @@ public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdvice
9092
if (interceptors.isEmpty()) {
9193
throw new UnknownAdviceTypeException(advisor.getAdvice());
9294
}
93-
return interceptors.toArray(EMPTY_INTERCEPTOR_ARRAY);
95+
return interceptors.toArray(EMPTY_METHOD_INTERCEPTOR_ARRAY);
9496
}
9597

9698
@Override

spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
@SuppressWarnings("serial")
4545
public class MutablePropertyValues implements PropertyValues, Serializable {
4646

47-
private static final PropertyValue[] EMPTY_PROPERTY_VALUES = new PropertyValue[0];
47+
private static final PropertyValue[] EMPTY_PROPERTY_VALUE_ARRAY = new PropertyValue[0];
48+
4849

4950
private final List<PropertyValue> propertyValueList;
5051

@@ -266,7 +267,7 @@ public Stream<PropertyValue> stream() {
266267

267268
@Override
268269
public PropertyValue[] getPropertyValues() {
269-
return this.propertyValueList.toArray(EMPTY_PROPERTY_VALUES);
270+
return this.propertyValueList.toArray(EMPTY_PROPERTY_VALUE_ARRAY);
270271
}
271272

272273
@Override

spring-beans/src/main/java/org/springframework/beans/factory/parsing/BeanComponentDefinition.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@
3737
*/
3838
public class BeanComponentDefinition extends BeanDefinitionHolder implements ComponentDefinition {
3939

40-
private static final BeanDefinition[] EMPTY_BEAN_DEFINITIONS = new BeanDefinition[0];
41-
private static final BeanReference[] EMPTY_BEAN_REFERENCES = new BeanReference[0];
40+
private static final BeanDefinition[] EMPTY_BEAN_DEFINITION_ARRAY = new BeanDefinition[0];
41+
42+
private static final BeanReference[] EMPTY_BEAN_REFERENCE_ARRAY = new BeanReference[0];
43+
4244

4345
private final BeanDefinition[] innerBeanDefinitions;
4446

@@ -87,8 +89,8 @@ else if (value instanceof BeanReference beanRef) {
8789
references.add(beanRef);
8890
}
8991
}
90-
this.innerBeanDefinitions = innerBeans.toArray(EMPTY_BEAN_DEFINITIONS);
91-
this.beanReferences = references.toArray(EMPTY_BEAN_REFERENCES);
92+
this.innerBeanDefinitions = innerBeans.toArray(EMPTY_BEAN_DEFINITION_ARRAY);
93+
this.beanReferences = references.toArray(EMPTY_BEAN_REFERENCE_ARRAY);
9294
}
9395

9496

spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationsCollection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
*/
4141
final class MergedAnnotationsCollection implements MergedAnnotations {
4242

43-
private static final MergedAnnotation<?> [] EMPTY_ANNOTATIONS = new MergedAnnotation<?>[0];
43+
private static final MergedAnnotation<?>[] EMPTY_MERGED_ANNOTATION_ARRAY = new MergedAnnotation<?>[0];
44+
4445

4546
private final MergedAnnotation<?>[] annotations;
4647

@@ -49,7 +50,7 @@ final class MergedAnnotationsCollection implements MergedAnnotations {
4950

5051
private MergedAnnotationsCollection(Collection<MergedAnnotation<?>> annotations) {
5152
Assert.notNull(annotations, "Annotations must not be null");
52-
this.annotations = annotations.toArray(EMPTY_ANNOTATIONS);
53+
this.annotations = annotations.toArray(EMPTY_MERGED_ANNOTATION_ARRAY);
5354
this.mappings = new AnnotationTypeMappings[this.annotations.length];
5455
for (int i = 0; i < this.annotations.length; i++) {
5556
MergedAnnotation<?> annotation = this.annotations[i];

spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
*/
4545
public abstract class TemplateAwareExpressionParser implements ExpressionParser {
4646

47-
private static final Expression [] EMPTY_EXPRESSION_ARRAY = new Expression[0];
47+
private static final Expression[] EMPTY_EXPRESSION_ARRAY = new Expression[0];
48+
4849

4950
@Override
5051
public Expression parseExpression(String expressionString) throws ParseException {

0 commit comments

Comments
 (0)