Polishing

This commit is contained in:
Juergen Hoeller
2018-06-28 14:51:31 +02:00
parent b68e692854
commit 40efcc933c
107 changed files with 510 additions and 624 deletions

View File

@@ -32,12 +32,12 @@ import org.springframework.util.StringUtils;
@SuppressWarnings("serial")
public class SimpleKey implements Serializable {
/**
* An empty key.
*/
/** An empty key. */
public static final SimpleKey EMPTY = new SimpleKey();
private final Object[] params;
private final int hashCode;
@@ -52,10 +52,11 @@ public class SimpleKey implements Serializable {
this.hashCode = Arrays.deepHashCode(this.params);
}
@Override
public boolean equals(Object obj) {
return (this == obj || (obj instanceof SimpleKey
&& Arrays.deepEquals(this.params, ((SimpleKey) obj).params)));
public boolean equals(Object other) {
return (this == other ||
(other instanceof SimpleKey && Arrays.deepEquals(this.params, ((SimpleKey) other).params)));
}
@Override

View File

@@ -553,7 +553,7 @@ class ConfigurationClassParser {
for (DeferredImportSelectorHolder deferredImport : deferredImports) {
Class<? extends Group> group = deferredImport.getImportSelector().getImportGroup();
DeferredImportSelectorGrouping grouping = groupings.computeIfAbsent(
(group == null ? deferredImport : group),
(group != null ? group : deferredImport),
key -> new DeferredImportSelectorGrouping(createGroup(group)));
grouping.add(deferredImport);
configurationClasses.put(deferredImport.getConfigurationClass().getMetadata(),
@@ -561,8 +561,7 @@ class ConfigurationClassParser {
}
for (DeferredImportSelectorGrouping grouping : groupings.values()) {
grouping.getImports().forEach(entry -> {
ConfigurationClass configurationClass = configurationClasses.get(
entry.getMetadata());
ConfigurationClass configurationClass = configurationClasses.get(entry.getMetadata());
try {
processImports(configurationClass, asSourceClass(configurationClass),
asSourceClasses(entry.getImportClassName()), false);
@@ -573,15 +572,14 @@ class ConfigurationClassParser {
catch (Throwable ex) {
throw new BeanDefinitionStoreException(
"Failed to process import candidates for configuration class [" +
configurationClass.getMetadata().getClassName() + "]", ex);
configurationClass.getMetadata().getClassName() + "]", ex);
}
});
}
}
private Group createGroup(@Nullable Class<? extends Group> type) {
Class<? extends Group> effectiveType = (type != null ? type
: DefaultDeferredImportSelectorGroup.class);
Class<? extends Group> effectiveType = (type != null ? type : DefaultDeferredImportSelectorGroup.class);
Group group = BeanUtils.instantiateClass(effectiveType);
ParserStrategyUtils.invokeAwareMethods(group,
ConfigurationClassParser.this.environment,

View File

@@ -1252,8 +1252,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/
@Nullable
protected BeanFactory getInternalParentBeanFactory() {
return (getParent() instanceof ConfigurableApplicationContext) ?
((ConfigurableApplicationContext) getParent()).getBeanFactory() : getParent();
return (getParent() instanceof ConfigurableApplicationContext ?
((ConfigurableApplicationContext) getParent()).getBeanFactory() : getParent());
}
@@ -1295,8 +1295,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
*/
@Nullable
protected MessageSource getInternalParentMessageSource() {
return (getParent() instanceof AbstractApplicationContext) ?
((AbstractApplicationContext) getParent()).messageSource : getParent();
return (getParent() instanceof AbstractApplicationContext ?
((AbstractApplicationContext) getParent()).messageSource : getParent());
}

View File

@@ -144,16 +144,16 @@ public class PeriodicTrigger implements Trigger {
@Override
public boolean equals(Object obj) {
if (this == obj) {
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(obj instanceof PeriodicTrigger)) {
if (!(other instanceof PeriodicTrigger)) {
return false;
}
PeriodicTrigger other = (PeriodicTrigger) obj;
return (this.fixedRate == other.fixedRate && this.initialDelay == other.initialDelay &&
this.period == other.period);
PeriodicTrigger otherTrigger = (PeriodicTrigger) other;
return (this.fixedRate == otherTrigger.fixedRate && this.initialDelay == otherTrigger.initialDelay &&
this.period == otherTrigger.period);
}
@Override

View File

@@ -715,8 +715,8 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @see #doBind(org.springframework.beans.MutablePropertyValues)
*/
public void bind(PropertyValues pvs) {
MutablePropertyValues mpvs = (pvs instanceof MutablePropertyValues) ?
(MutablePropertyValues) pvs : new MutablePropertyValues(pvs);
MutablePropertyValues mpvs = (pvs instanceof MutablePropertyValues ?
(MutablePropertyValues) pvs : new MutablePropertyValues(pvs));
doBind(mpvs);
}