Merge pull request #17962 from OLPMO

* pr/17962:
  Polish contribution
  Polish

Closes gh-17962
pull/17984/head
Stephane Nicoll 5 years ago
commit 5939834c3d

@ -136,8 +136,7 @@ class AutoConfigurationSorter {
}
Set<String> getClassesRequestedAfter(String className) {
Set<String> classesRequestedAfter = new LinkedHashSet<>();
classesRequestedAfter.addAll(get(className).getAfter());
Set<String> classesRequestedAfter = new LinkedHashSet<>(get(className).getAfter());
this.classes.forEach((name, autoConfigurationClass) -> {
if (autoConfigurationClass.getBefore().contains(className)) {
classesRequestedAfter.add(name);

@ -58,8 +58,8 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
@Override
public Set<Object> determineImports(AnnotationMetadata metadata) {
Set<String> result = new LinkedHashSet<>();
result.addAll(getCandidateConfigurations(metadata, null));
List<String> candidateConfigurations = getCandidateConfigurations(metadata, null);
Set<String> result = new LinkedHashSet<>(candidateConfigurations);
result.removeAll(getExclusions(metadata, null));
return Collections.unmodifiableSet(result);
}

@ -376,9 +376,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
return result;
}
result = (result != null) ? result : new LinkedHashSet<>();
for (String addition : additional) {
result.add(addition);
}
Collections.addAll(result, additional);
return result;
}
@ -454,9 +452,7 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
}
private void merge(Set<String> result, String... additional) {
for (String addition : additional) {
result.add(addition);
}
Collections.addAll(result, additional);
}
private Set<Class<?>> resolveWhenPossible(Set<String> classNames) {

@ -102,10 +102,7 @@ public class GroovyTemplateAutoConfiguration {
try {
ProtectionDomain domain = MarkupTemplateEngine.class.getProtectionDomain();
CodeSource codeSource = domain.getCodeSource();
if (codeSource != null && codeSource.getLocation().toString().contains("-all")) {
return true;
}
return false;
return codeSource != null && codeSource.getLocation().toString().contains("-all");
}
catch (Exception ex) {
return false;

@ -57,8 +57,7 @@ public class ParentAwareNamingStrategy extends MetadataNamingStrategy implements
@Override
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
ObjectName name = super.getObjectName(managedBean, beanKey);
Hashtable<String, String> properties = new Hashtable<>();
properties.putAll(name.getKeyPropertyList());
Hashtable<String, String> properties = new Hashtable<>(name.getKeyPropertyList());
if (this.ensureUniqueRuntimeObjectNames) {
properties.put("identity", ObjectUtils.getIdentityHexString(managedBean));
}

@ -112,10 +112,7 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
: "none");
Map<String, Object> hibernate = this.hibernateProperties.determineHibernateProperties(
this.jpaProperties.getProperties(), new HibernateSettings().ddlAuto(defaultDdlAuto));
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {
return true;
}
return false;
return hibernate.containsKey("hibernate.hbm2ddl.auto");
}
/**

@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Properties;
@ -192,9 +193,7 @@ class AutoConfigurationSorterTests {
for (Class<?> type : value) {
items.add(type.getName());
}
for (String type : name) {
items.add(type);
}
Collections.addAll(items, name);
return StringUtils.collectionToCommaDelimitedString(items);
}

Loading…
Cancel
Save