Polishing regarding JDK baseline upgrade
Closes gh-28440
This commit is contained in:
@@ -841,7 +841,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
|
||||
String canonicalName = tokens.canonicalName;
|
||||
Object value = getPropertyValue(tokens);
|
||||
if (value == null || (value instanceof Optional && !((Optional<?>) value).isPresent())) {
|
||||
if (value == null || (value instanceof Optional<?> optional && optional.isEmpty()) {
|
||||
if (isAutoGrowNestedPaths()) {
|
||||
value = setDefaultValue(tokens);
|
||||
}
|
||||
|
||||
@@ -162,9 +162,8 @@ public abstract class BeanFactoryUtils {
|
||||
Assert.notNull(lbf, "ListableBeanFactory must not be null");
|
||||
String[] result = lbf.getBeanNamesForType(type);
|
||||
if (lbf instanceof HierarchicalBeanFactory hbf) {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory pbf) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(pbf, type);
|
||||
result = mergeNamesWithParent(result, parentResult, hbf);
|
||||
}
|
||||
}
|
||||
@@ -225,9 +224,8 @@ public abstract class BeanFactoryUtils {
|
||||
Assert.notNull(lbf, "ListableBeanFactory must not be null");
|
||||
String[] result = lbf.getBeanNamesForType(type);
|
||||
if (lbf instanceof HierarchicalBeanFactory hbf) {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory pbf) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(pbf, type);
|
||||
result = mergeNamesWithParent(result, parentResult, hbf);
|
||||
}
|
||||
}
|
||||
@@ -371,9 +369,8 @@ public abstract class BeanFactoryUtils {
|
||||
Map<String, T> result = new LinkedHashMap<>(4);
|
||||
result.putAll(lbf.getBeansOfType(type, includeNonSingletons, allowEagerInit));
|
||||
if (lbf instanceof HierarchicalBeanFactory hbf) {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory pbf) {
|
||||
Map<String, T> parentResult = beansOfTypeIncludingAncestors(pbf, type, includeNonSingletons, allowEagerInit);
|
||||
parentResult.forEach((beanName, beanInstance) -> {
|
||||
if (!result.containsKey(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
result.put(beanName, beanInstance);
|
||||
|
||||
Reference in New Issue
Block a user