Browse Source

Merge pull request #43343 from Jae-Young98

* pr/43343:
  Polish "Remove redundant null check for sorter"
  Remove redundant null check for sorter

Closes gh-43343
pull/43347/head
Moritz Halbritter 1 year ago
parent
commit
a93055c65f
  1. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java

3
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java

@ -90,9 +90,8 @@ public abstract class Configurations { @@ -90,9 +90,8 @@ public abstract class Configurations {
protected Configurations(UnaryOperator<Collection<Class<?>>> sorter, Collection<Class<?>> classes,
Function<Class<?>, String> beanNameGenerator) {
Assert.notNull(classes, "Classes must not be null");
sorter = (sorter != null) ? sorter : UnaryOperator.identity();
Collection<Class<?>> sorted = sorter.apply(classes);
this.sorter = (sorter != null) ? sorter : UnaryOperator.identity();
Collection<Class<?>> sorted = this.sorter.apply(classes);
this.classes = Collections.unmodifiableSet(new LinkedHashSet<>(sorted));
this.beanNameGenerator = beanNameGenerator;
}

Loading…
Cancel
Save