Polish (Linked)HashSet usage
See gh-32291
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -494,12 +495,11 @@ class ConfigurationClassParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code @Import} class, considering all meta-annotations.
|
||||
* Returns {@code @Import} classes, considering all meta-annotations.
|
||||
*/
|
||||
private Set<SourceClass> getImports(SourceClass sourceClass) throws IOException {
|
||||
Set<SourceClass> imports = new LinkedHashSet<>();
|
||||
Set<SourceClass> visited = new LinkedHashSet<>();
|
||||
collectImports(sourceClass, imports, visited);
|
||||
collectImports(sourceClass, imports, new HashSet<>());
|
||||
return imports;
|
||||
}
|
||||
|
||||
@@ -1038,7 +1038,7 @@ class ConfigurationClassParser {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
String[] classNames = (String[]) annotationAttributes.get(attribute);
|
||||
Set<SourceClass> result = new LinkedHashSet<>();
|
||||
Set<SourceClass> result = CollectionUtils.newLinkedHashSet(classNames.length);
|
||||
for (String className : classNames) {
|
||||
result.add(getRelated(className));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2024 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.
|
||||
@@ -36,6 +36,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.ImportRuntimeHints;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* {@link BeanFactoryInitializationAotProcessor} implementation that processes
|
||||
@@ -76,8 +77,9 @@ class RuntimeHintsBeanFactoryInitializationAotProcessor implements BeanFactoryIn
|
||||
private Set<Class<? extends RuntimeHintsRegistrar>> extractFromBeanDefinition(String beanName,
|
||||
ImportRuntimeHints annotation) {
|
||||
|
||||
Set<Class<? extends RuntimeHintsRegistrar>> registrars = new LinkedHashSet<>();
|
||||
for (Class<? extends RuntimeHintsRegistrar> registrarClass : annotation.value()) {
|
||||
Class<? extends RuntimeHintsRegistrar>[] registrarClasses = annotation.value();
|
||||
Set<Class<? extends RuntimeHintsRegistrar>> registrars = CollectionUtils.newLinkedHashSet(registrarClasses.length);
|
||||
for (Class<? extends RuntimeHintsRegistrar> registrarClass : registrarClasses) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(LogMessage.format("Loaded [%s] registrar from annotated bean [%s]",
|
||||
registrarClass.getCanonicalName(), beanName));
|
||||
|
||||
Reference in New Issue
Block a user