Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
This commit is contained in:
@@ -203,7 +203,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||
*/
|
||||
public void setWrappedInstance(Object object, String nestedPath, Object rootObject) {
|
||||
Assert.notNull(object, "Target object must not be null");
|
||||
if (object.getClass().equals(javaUtilOptionalClass)) {
|
||||
if (object.getClass() == javaUtilOptionalClass) {
|
||||
this.object = OptionalUnwrapper.unwrap(object);
|
||||
}
|
||||
else {
|
||||
@@ -834,7 +834,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
|
||||
String canonicalName = tokens.canonicalName;
|
||||
Object value = getPropertyValue(tokens);
|
||||
if (value == null || (value.getClass().equals(javaUtilOptionalClass) && OptionalUnwrapper.isEmpty(value))) {
|
||||
if (value == null || (value.getClass() == javaUtilOptionalClass && OptionalUnwrapper.isEmpty(value))) {
|
||||
if (isAutoGrowNestedPaths()) {
|
||||
value = setDefaultValue(tokens);
|
||||
}
|
||||
@@ -846,7 +846,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||
// Lookup cached sub-PropertyAccessor, create new one if not found.
|
||||
AbstractNestablePropertyAccessor nestedPa = this.nestedPropertyAccessors.get(canonicalName);
|
||||
if (nestedPa == null || nestedPa.getWrappedInstance() !=
|
||||
(value.getClass().equals(javaUtilOptionalClass) ? OptionalUnwrapper.unwrap(value) : value)) {
|
||||
(value.getClass() == javaUtilOptionalClass ? OptionalUnwrapper.unwrap(value) : value)) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Creating new nested " + getClass().getSimpleName() + " for property '" + canonicalName + "'");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -105,7 +105,7 @@ public class InjectionMetadata {
|
||||
|
||||
|
||||
public static boolean needsRefresh(InjectionMetadata metadata, Class<?> clazz) {
|
||||
return (metadata == null || !metadata.targetClass.equals(clazz));
|
||||
return (metadata == null || metadata.targetClass != clazz);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationSt
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return (getClass().equals(other.getClass()) &&
|
||||
return (getClass() == other.getClass() &&
|
||||
this.beanDefinition.equals(((CglibIdentitySupport) other).beanDefinition));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user