Browse Source

Revise contribution

See gh-35660
pull/35665/head
Sam Brannen 2 months ago
parent
commit
0fbebd856f
  1. 7
      spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java
  2. 6
      spring-aop/src/main/java/org/springframework/aop/framework/adapter/DefaultAdvisorAdapterRegistry.java
  3. 5
      spring-beans/src/main/java/org/springframework/beans/MutablePropertyValues.java
  4. 10
      spring-beans/src/main/java/org/springframework/beans/factory/parsing/BeanComponentDefinition.java
  5. 5
      spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotationsCollection.java
  6. 3
      spring-expression/src/main/java/org/springframework/expression/common/TemplateAwareExpressionParser.java

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

@ -70,14 +70,15 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -70,14 +70,15 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
/** use serialVersionUID from Spring 2.0 for interoperability. */
private static final long serialVersionUID = 2651364800145442165L;
private static final Advisor[] EMPTY_ADVISOR_ARRAY = new Advisor[0];
/**
* Canonical TargetSource when there's no target, and behavior is
* supplied by the advisors.
*/
public static final TargetSource EMPTY_TARGET_SOURCE = EmptyTargetSource.INSTANCE;
/** Empty advisor array constant. */
public static final Advisor[] EMPTY_ADVISORS = new Advisor[0];
/** Package-protected to allow direct access for efficiency. */
@SuppressWarnings("serial")
@ -289,7 +290,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised { @@ -289,7 +290,7 @@ public class AdvisedSupport extends ProxyConfig implements Advised {
@Override
public final Advisor[] getAdvisors() {
return this.advisors.toArray(EMPTY_ADVISORS);
return this.advisors.toArray(EMPTY_ADVISOR_ARRAY);
}
@Override

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

@ -39,7 +39,9 @@ import org.springframework.aop.support.DefaultPointcutAdvisor; @@ -39,7 +39,9 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
*/
@SuppressWarnings("serial")
public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Serializable {
private static final MethodInterceptor [] EMPTY_INTERCEPTOR_ARRAY = new MethodInterceptor[0];
private static final MethodInterceptor[] EMPTY_METHOD_INTERCEPTOR_ARRAY = new MethodInterceptor[0];
private final List<AdvisorAdapter> adapters = new ArrayList<>(3);
@ -90,7 +92,7 @@ public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Se @@ -90,7 +92,7 @@ public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Se
if (interceptors.isEmpty()) {
throw new UnknownAdviceTypeException(advisor.getAdvice());
}
return interceptors.toArray(EMPTY_INTERCEPTOR_ARRAY);
return interceptors.toArray(EMPTY_METHOD_INTERCEPTOR_ARRAY);
}
@Override

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

@ -44,7 +44,8 @@ import org.springframework.util.StringUtils; @@ -44,7 +44,8 @@ import org.springframework.util.StringUtils;
@SuppressWarnings("serial")
public class MutablePropertyValues implements PropertyValues, Serializable {
private static final PropertyValue[] EMPTY_PROPERTY_VALUES = new PropertyValue[0];
private static final PropertyValue[] EMPTY_PROPERTY_VALUE_ARRAY = new PropertyValue[0];
private final List<PropertyValue> propertyValueList;
@ -266,7 +267,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable { @@ -266,7 +267,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
@Override
public PropertyValue[] getPropertyValues() {
return this.propertyValueList.toArray(EMPTY_PROPERTY_VALUES);
return this.propertyValueList.toArray(EMPTY_PROPERTY_VALUE_ARRAY);
}
@Override

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

@ -37,8 +37,10 @@ import org.springframework.beans.factory.config.BeanReference; @@ -37,8 +37,10 @@ import org.springframework.beans.factory.config.BeanReference;
*/
public class BeanComponentDefinition extends BeanDefinitionHolder implements ComponentDefinition {
private static final BeanDefinition[] EMPTY_BEAN_DEFINITIONS = new BeanDefinition[0];
private static final BeanReference[] EMPTY_BEAN_REFERENCES = new BeanReference[0];
private static final BeanDefinition[] EMPTY_BEAN_DEFINITION_ARRAY = new BeanDefinition[0];
private static final BeanReference[] EMPTY_BEAN_REFERENCE_ARRAY = new BeanReference[0];
private final BeanDefinition[] innerBeanDefinitions;
@ -87,8 +89,8 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com @@ -87,8 +89,8 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
references.add(beanRef);
}
}
this.innerBeanDefinitions = innerBeans.toArray(EMPTY_BEAN_DEFINITIONS);
this.beanReferences = references.toArray(EMPTY_BEAN_REFERENCES);
this.innerBeanDefinitions = innerBeans.toArray(EMPTY_BEAN_DEFINITION_ARRAY);
this.beanReferences = references.toArray(EMPTY_BEAN_REFERENCE_ARRAY);
}

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

@ -40,7 +40,8 @@ import org.springframework.util.Assert; @@ -40,7 +40,8 @@ import org.springframework.util.Assert;
*/
final class MergedAnnotationsCollection implements MergedAnnotations {
private static final MergedAnnotation<?> [] EMPTY_ANNOTATIONS = new MergedAnnotation<?>[0];
private static final MergedAnnotation<?>[] EMPTY_MERGED_ANNOTATION_ARRAY = new MergedAnnotation<?>[0];
private final MergedAnnotation<?>[] annotations;
@ -49,7 +50,7 @@ final class MergedAnnotationsCollection implements MergedAnnotations { @@ -49,7 +50,7 @@ final class MergedAnnotationsCollection implements MergedAnnotations {
private MergedAnnotationsCollection(Collection<MergedAnnotation<?>> annotations) {
Assert.notNull(annotations, "Annotations must not be null");
this.annotations = annotations.toArray(EMPTY_ANNOTATIONS);
this.annotations = annotations.toArray(EMPTY_MERGED_ANNOTATION_ARRAY);
this.mappings = new AnnotationTypeMappings[this.annotations.length];
for (int i = 0; i < this.annotations.length; i++) {
MergedAnnotation<?> annotation = this.annotations[i];

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

@ -44,7 +44,8 @@ import org.springframework.util.Assert; @@ -44,7 +44,8 @@ import org.springframework.util.Assert;
*/
public abstract class TemplateAwareExpressionParser implements ExpressionParser {
private static final Expression [] EMPTY_EXPRESSION_ARRAY = new Expression[0];
private static final Expression[] EMPTY_EXPRESSION_ARRAY = new Expression[0];
@Override
public Expression parseExpression(String expressionString) throws ParseException {

Loading…
Cancel
Save