From 8e7faab4f659f73d06205056e64ea3340ad42418 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 28 Jul 2022 16:32:51 +0200 Subject: [PATCH] Polish --- .../org/springframework/beans/factory/aot/AotServices.java | 3 ++- .../beans/factory/aot/BeanRegistrationAotProcessor.java | 2 +- .../factory/aot/BeanDefinitionMethodGeneratorFactoryTests.java | 3 +++ .../beans/factory/aot/BeanDefinitionMethodGeneratorTests.java | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java b/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java index 912eb48d10..b632556d8e 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/aot/AotServices.java @@ -192,6 +192,7 @@ public final class AotServices implements Iterable { private final SpringFactoriesLoader springFactoriesLoader; + @Nullable private final ListableBeanFactory beanFactory; @@ -208,7 +209,7 @@ public final class AotServices implements Iterable { * @return a new {@link AotServices} instance */ public AotServices load(Class type) { - return new AotServices(this.springFactoriesLoader.load(type), loadBeans(type)); + return new AotServices<>(this.springFactoriesLoader.load(type), loadBeans(type)); } private Map loadBeans(Class type) { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java index ef0b3b0e59..39e5092a9f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanRegistrationAotProcessor.java @@ -60,7 +60,7 @@ public interface BeanRegistrationAotProcessor { /** * Return if the bean instance associated with this processor should be - * excluded from AOT processing itself. By default this method will return + * excluded from AOT processing itself. By default, this method returns * {@code true} to automatically exclude the bean, if the definition should * be written then this method may be overridden to return {@code true}. * @return if the bean should be excluded from AOT processing diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorFactoryTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorFactoryTests.java index 1a357389f3..4347460a2b 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorFactoryTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorFactoryTests.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.core.Ordered; import org.springframework.core.mock.MockSpringFactoriesLoader; +import org.springframework.lang.Nullable; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; @@ -172,6 +173,7 @@ class BeanDefinitionMethodGeneratorFactoryTests { private final int order; + @Nullable private RegisteredBean registeredBean; MockBeanRegistrationExcludeFilter(boolean excluded, int order) { @@ -234,6 +236,7 @@ class BeanDefinitionMethodGeneratorFactoryTests { } + @SuppressWarnings("unused") static class InnerTestBean { } diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java index 4b949f8838..0e38227187 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java @@ -75,7 +75,7 @@ class BeanDefinitionMethodGeneratorTests { this.generationContext = new TestGenerationContext(); this.beanFactory = new DefaultListableBeanFactory(); this.methodGeneratorFactory = new BeanDefinitionMethodGeneratorFactory( - AotServices.factoriesAndBeans( new MockSpringFactoriesLoader(), beanFactory)); + AotServices.factoriesAndBeans(new MockSpringFactoriesLoader(), this.beanFactory)); this.beanRegistrationsCode = new MockBeanRegistrationsCode(this.generationContext); }