All branches in a conditional structure should not have exactly the same implementation

This commit is contained in:
igor-suhorukov 2018-03-30 00:14:37 +03:00 committed by Juergen Hoeller
parent ab96bb5428
commit 93abe0e94b
5 changed files with 6 additions and 23 deletions

View File

@ -385,10 +385,8 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
int numUnboundArgs = this.parameterTypes.length; int numUnboundArgs = this.parameterTypes.length;
Class<?>[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes(); Class<?>[] parameterTypes = this.aspectJAdviceMethod.getParameterTypes();
if (maybeBindJoinPoint(parameterTypes[0]) || maybeBindProceedingJoinPoint(parameterTypes[0])) { if (maybeBindJoinPoint(parameterTypes[0]) || maybeBindProceedingJoinPoint(parameterTypes[0]) ||
numUnboundArgs--; maybeBindJoinPointStaticPart(parameterTypes[0])) {
}
else if (maybeBindJoinPointStaticPart(parameterTypes[0])) {
numUnboundArgs--; numUnboundArgs--;
} }

View File

@ -285,11 +285,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
for (PropertyValue newPv : this.propertyValueList) { for (PropertyValue newPv : this.propertyValueList) {
// if there wasn't an old one, add it // if there wasn't an old one, add it
PropertyValue pvOld = old.getPropertyValue(newPv.getName()); PropertyValue pvOld = old.getPropertyValue(newPv.getName());
if (pvOld == null) { if (pvOld == null || !pvOld.equals(newPv)) {
changes.addPropertyValue(newPv);
}
else if (!pvOld.equals(newPv)) {
// it's changed
changes.addPropertyValue(newPv); changes.addPropertyValue(newPv);
} }
} }

View File

@ -409,12 +409,7 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
} }
private boolean addDeferredProperty(String property, Object newValue) { private boolean addDeferredProperty(String property, Object newValue) {
if (newValue instanceof List) { if (newValue instanceof List || newValue instanceof Map) {
this.deferredProperties.put(this.currentBeanDefinition.getBeanName() + '.' + property,
new DeferredProperty(this.currentBeanDefinition, property, newValue));
return true;
}
else if (newValue instanceof Map) {
this.deferredProperties.put(this.currentBeanDefinition.getBeanName() + '.' + property, this.deferredProperties.put(this.currentBeanDefinition.getBeanName() + '.' + property,
new DeferredProperty(this.currentBeanDefinition, property, newValue)); new DeferredProperty(this.currentBeanDefinition, property, newValue));
return true; return true;

View File

@ -347,10 +347,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
if (typeDescriptor == null) { if (typeDescriptor == null) {
// Attempt to populate the cache entry // Attempt to populate the cache entry
try { try {
if (canRead(context, target, name)) { if (canRead(context, target, name) || canWrite(context, target, name)) {
typeDescriptor = this.typeDescriptorCache.get(cacheKey);
}
else if (canWrite(context, target, name)) {
typeDescriptor = this.typeDescriptorCache.get(cacheKey); typeDescriptor = this.typeDescriptorCache.get(cacheKey);
} }
} }

View File

@ -268,10 +268,7 @@ public class UrlPathHelper {
} }
c1 = requestUri.charAt(index1); c1 = requestUri.charAt(index1);
} }
if (c1 == c2) { if (c1 == c2 || ignoreCase && (Character.toLowerCase(c1) == Character.toLowerCase(c2))) {
continue;
}
else if (ignoreCase && (Character.toLowerCase(c1) == Character.toLowerCase(c2))) {
continue; continue;
} }
return null; return null;