Merge pull request #11743 from dreis2211
* pr/11743: Narrow scope of some variables
This commit is contained in:
commit
55f44dc510
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -160,11 +160,11 @@ final class BeanTypeRegistry implements SmartInitializingSingleton {
|
|||
|
||||
private void addBeanTypeForNonAliasDefinition(String name) {
|
||||
try {
|
||||
String factoryName = BeanFactory.FACTORY_BEAN_PREFIX + name;
|
||||
RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory
|
||||
.getMergedBeanDefinition(name);
|
||||
if (!beanDefinition.isAbstract()
|
||||
&& !requiresEagerInit(beanDefinition.getFactoryBeanName())) {
|
||||
String factoryName = BeanFactory.FACTORY_BEAN_PREFIX + name;
|
||||
if (this.beanFactory.isFactoryBean(factoryName)) {
|
||||
Class<?> factoryBeanGeneric = getFactoryBeanGeneric(this.beanFactory,
|
||||
beanDefinition, name);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -157,10 +157,10 @@ class OnClassCondition extends SpringBootCondition
|
|||
Class<?> annotationType) {
|
||||
MultiValueMap<String, Object> attributes = metadata
|
||||
.getAllAnnotationAttributes(annotationType.getName(), true);
|
||||
List<String> candidates = new ArrayList<>();
|
||||
if (attributes == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> candidates = new ArrayList<>();
|
||||
addAll(candidates, attributes.get("value"));
|
||||
addAll(candidates, attributes.get("name"));
|
||||
return candidates;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -64,7 +64,6 @@ public class EntityScanner {
|
|||
if (packages.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Set<Class<?>> entitySet = new HashSet<>();
|
||||
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
|
||||
false);
|
||||
scanner.setEnvironment(this.context.getEnvironment());
|
||||
|
|
@ -72,6 +71,7 @@ public class EntityScanner {
|
|||
for (Class<? extends Annotation> annotationType : annotationTypes) {
|
||||
scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
|
||||
}
|
||||
Set<Class<?>> entitySet = new HashSet<>();
|
||||
for (String basePackage : packages) {
|
||||
if (StringUtils.hasText(basePackage)) {
|
||||
for (BeanDefinition candidate : scanner
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 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.
|
||||
|
|
@ -135,7 +135,6 @@ public class ConditionEvaluationReportMessage {
|
|||
|
||||
private Map<String, ConditionAndOutcomes> orderByName(
|
||||
Map<String, ConditionAndOutcomes> outcomes) {
|
||||
Map<String, ConditionAndOutcomes> result = new LinkedHashMap<>();
|
||||
List<String> names = new ArrayList<>();
|
||||
Map<String, String> classNames = new HashMap<>();
|
||||
for (String name : outcomes.keySet()) {
|
||||
|
|
@ -144,6 +143,7 @@ public class ConditionEvaluationReportMessage {
|
|||
classNames.put(shortName, name);
|
||||
}
|
||||
Collections.sort(names);
|
||||
Map<String, ConditionAndOutcomes> result = new LinkedHashMap<>();
|
||||
for (String shortName : names) {
|
||||
result.put(shortName, outcomes.get(classNames.get(shortName)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,6 @@ public class ServletContextInitializerBeans
|
|||
|
||||
private <T> List<Entry<String, T>> getOrderedBeansOfType(
|
||||
ListableBeanFactory beanFactory, Class<T> type, Set<?> excludes) {
|
||||
List<Entry<String, T>> beans = new ArrayList<>();
|
||||
Comparator<Entry<String, T>> comparator = (o1,
|
||||
o2) -> AnnotationAwareOrderComparator.INSTANCE.compare(o1.getValue(),
|
||||
o2.getValue());
|
||||
|
|
@ -230,6 +229,7 @@ public class ServletContextInitializerBeans
|
|||
}
|
||||
}
|
||||
}
|
||||
List<Entry<String, T>> beans = new ArrayList<>();
|
||||
beans.addAll(map.entrySet());
|
||||
beans.sort(comparator);
|
||||
return beans;
|
||||
|
|
|
|||
Loading…
Reference in New Issue