Browse Source

Polishing

pull/27217/head
Juergen Hoeller 6 years ago
parent
commit
015f7d8ce1
  1. 9
      spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
  2. 48
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java

9
spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -43,9 +43,9 @@ import org.springframework.util.StringUtils; @@ -43,9 +43,9 @@ import org.springframework.util.StringUtils;
* Internal class that caches JavaBeans {@link java.beans.PropertyDescriptor}
* information for a Java class. Not intended for direct use by application code.
*
* <p>Necessary for own caching of descriptors within the application's
* ClassLoader, rather than rely on the JDK's system-wide BeanInfo cache
* (in order to avoid leaks on ClassLoader shutdown).
* <p>Necessary for Spring's own caching of bean descriptors within the application
* {@link ClassLoader}, rather than relying on the JDK's system-wide {@link BeanInfo}
* cache (in order to avoid leaks on individual application shutdown in a shared JVM).
*
* <p>Information is cached statically, so we don't need to create new
* objects of this class for every JavaBean we manipulate. Hence, this class
@ -163,7 +163,6 @@ public final class CachedIntrospectionResults { @@ -163,7 +163,6 @@ public final class CachedIntrospectionResults {
* @return the corresponding CachedIntrospectionResults
* @throws BeansException in case of introspection failure
*/
@SuppressWarnings("unchecked")
static CachedIntrospectionResults forClass(Class<?> beanClass) throws BeansException {
CachedIntrospectionResults results = strongClassCache.get(beanClass);
if (results != null) {

48
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java

@ -1127,30 +1127,30 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -1127,30 +1127,30 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
return false;
}
AbstractBeanDefinition that = (AbstractBeanDefinition) other;
boolean rtn = ObjectUtils.nullSafeEquals(getBeanClassName(), that.getBeanClassName());
rtn = rtn && ObjectUtils.nullSafeEquals(this.scope, that.scope);
rtn = rtn && this.abstractFlag == that.abstractFlag;
rtn = rtn && this.lazyInit == that.lazyInit;
rtn = rtn && this.autowireMode == that.autowireMode;
rtn = rtn && this.dependencyCheck == that.dependencyCheck;
rtn = rtn && Arrays.equals(this.dependsOn, that.dependsOn);
rtn = rtn && this.autowireCandidate == that.autowireCandidate;
rtn = rtn && ObjectUtils.nullSafeEquals(this.qualifiers, that.qualifiers);
rtn = rtn && this.primary == that.primary;
rtn = rtn && this.nonPublicAccessAllowed == that.nonPublicAccessAllowed;
rtn = rtn && this.lenientConstructorResolution == that.lenientConstructorResolution;
rtn = rtn && ObjectUtils.nullSafeEquals(this.constructorArgumentValues, that.constructorArgumentValues);
rtn = rtn && ObjectUtils.nullSafeEquals(this.propertyValues, that.propertyValues);
rtn = rtn && ObjectUtils.nullSafeEquals(this.methodOverrides, that.methodOverrides);
rtn = rtn && ObjectUtils.nullSafeEquals(this.factoryBeanName, that.factoryBeanName);
rtn = rtn && ObjectUtils.nullSafeEquals(this.factoryMethodName, that.factoryMethodName);
rtn = rtn && ObjectUtils.nullSafeEquals(this.initMethodName, that.initMethodName);
rtn = rtn && this.enforceInitMethod == that.enforceInitMethod;
rtn = rtn && ObjectUtils.nullSafeEquals(this.destroyMethodName, that.destroyMethodName);
rtn = rtn && this.enforceDestroyMethod == that.enforceDestroyMethod;
rtn = rtn && this.synthetic == that.synthetic;
rtn = rtn && this.role == that.role;
return rtn && super.equals(other);
return (ObjectUtils.nullSafeEquals(getBeanClassName(), that.getBeanClassName()) &&
ObjectUtils.nullSafeEquals(this.scope, that.scope) &&
this.abstractFlag == that.abstractFlag &&
this.lazyInit == that.lazyInit &&
this.autowireMode == that.autowireMode &&
this.dependencyCheck == that.dependencyCheck &&
Arrays.equals(this.dependsOn, that.dependsOn) &&
this.autowireCandidate == that.autowireCandidate &&
ObjectUtils.nullSafeEquals(this.qualifiers, that.qualifiers) &&
this.primary == that.primary &&
this.nonPublicAccessAllowed == that.nonPublicAccessAllowed &&
this.lenientConstructorResolution == that.lenientConstructorResolution &&
ObjectUtils.nullSafeEquals(this.constructorArgumentValues, that.constructorArgumentValues) &&
ObjectUtils.nullSafeEquals(this.propertyValues, that.propertyValues) &&
ObjectUtils.nullSafeEquals(this.methodOverrides, that.methodOverrides) &&
ObjectUtils.nullSafeEquals(this.factoryBeanName, that.factoryBeanName) &&
ObjectUtils.nullSafeEquals(this.factoryMethodName, that.factoryMethodName) &&
ObjectUtils.nullSafeEquals(this.initMethodName, that.initMethodName) &&
this.enforceInitMethod == that.enforceInitMethod &&
ObjectUtils.nullSafeEquals(this.destroyMethodName, that.destroyMethodName) &&
this.enforceDestroyMethod == that.enforceDestroyMethod &&
this.synthetic == that.synthetic &&
this.role == that.role &&
super.equals(other));
}
@Override

Loading…
Cancel
Save