From 43dd22ba31bb9325f49337786af97b7cf69c90c3 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 6 May 2024 20:10:40 +0200 Subject: [PATCH] Polishing (cherry picked from commit 05d9b52b19e1f740001abe40640fc02fd3001355) --- .../quartz/SchedulerFactoryBeanRuntimeHints.java | 6 +++--- ...ocessorBeanFactoryInitializationAotProcessor.java | 12 +++++++----- .../aot/hint/annotation/Reflective.java | 5 ++--- .../annotation/RegisterReflectionForBinding.java | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java index c2d727a45588..67e69ed07fd4 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java @@ -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,7 +36,7 @@ class SchedulerFactoryBeanRuntimeHints implements RuntimeHintsRegistrar { private static final String SCHEDULER_FACTORY_CLASS_NAME = "org.quartz.impl.StdSchedulerFactory"; - private final ReflectiveRuntimeHintsRegistrar reflectiveRegistrar = new ReflectiveRuntimeHintsRegistrar(); + private static final ReflectiveRuntimeHintsRegistrar registrar = new ReflectiveRuntimeHintsRegistrar(); @Override @@ -48,7 +48,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) { .registerType(TypeReference.of(SCHEDULER_FACTORY_CLASS_NAME), this::typeHint) .registerTypes(TypeReference.listOf(ResourceLoaderClassLoadHelper.class, LocalTaskExecutorThreadPool.class, LocalDataSourceJobStore.class), this::typeHint); - this.reflectiveRegistrar.registerRuntimeHints(hints, LocalTaskExecutorThreadPool.class); + registrar.registerRuntimeHints(hints, LocalTaskExecutorThreadPool.class); } private void typeHint(Builder typeHint) { diff --git a/spring-context/src/main/java/org/springframework/context/aot/ReflectiveProcessorBeanFactoryInitializationAotProcessor.java b/spring-context/src/main/java/org/springframework/context/aot/ReflectiveProcessorBeanFactoryInitializationAotProcessor.java index 238350ffc226..9cba020aef54 100644 --- a/spring-context/src/main/java/org/springframework/context/aot/ReflectiveProcessorBeanFactoryInitializationAotProcessor.java +++ b/spring-context/src/main/java/org/springframework/context/aot/ReflectiveProcessorBeanFactoryInitializationAotProcessor.java @@ -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. @@ -39,7 +39,8 @@ */ class ReflectiveProcessorBeanFactoryInitializationAotProcessor implements BeanFactoryInitializationAotProcessor { - private static final ReflectiveRuntimeHintsRegistrar REGISTRAR = new ReflectiveRuntimeHintsRegistrar(); + private static final ReflectiveRuntimeHintsRegistrar registrar = new ReflectiveRuntimeHintsRegistrar(); + @Override public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) { @@ -49,7 +50,9 @@ public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableL return new ReflectiveProcessorBeanFactoryInitializationAotContribution(beanTypes); } - private static class ReflectiveProcessorBeanFactoryInitializationAotContribution implements BeanFactoryInitializationAotContribution { + + private static class ReflectiveProcessorBeanFactoryInitializationAotContribution + implements BeanFactoryInitializationAotContribution { private final Class[] types; @@ -60,9 +63,8 @@ public ReflectiveProcessorBeanFactoryInitializationAotContribution(Class[] ty @Override public void applyTo(GenerationContext generationContext, BeanFactoryInitializationCode beanFactoryInitializationCode) { RuntimeHints runtimeHints = generationContext.getRuntimeHints(); - REGISTRAR.registerRuntimeHints(runtimeHints, this.types); + registrar.registerRuntimeHints(runtimeHints, this.types); } - } } diff --git a/spring-core/src/main/java/org/springframework/aot/hint/annotation/Reflective.java b/spring-core/src/main/java/org/springframework/aot/hint/annotation/Reflective.java index e12ceae9d490..02dcdcef6ba4 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/annotation/Reflective.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/annotation/Reflective.java @@ -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. @@ -39,8 +39,7 @@ * @see ReflectiveRuntimeHintsRegistrar * @see RegisterReflectionForBinding @RegisterReflectionForBinding */ -@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.CONSTRUCTOR, - ElementType.FIELD, ElementType.METHOD }) +@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Reflective { diff --git a/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java b/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java index d0a5b9c98ba9..d8e8be8adadb 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java @@ -36,7 +36,7 @@ * *
  * @Configuration
- * @RegisterReflectionForBinding({ Foo.class, Bar.class })
+ * @RegisterReflectionForBinding({Foo.class, Bar.class})
  * public class MyConfig {
  *     // ...
  * }
@@ -78,7 +78,7 @@ /** * Classes for which reflection hints should be registered. *

At least one class must be specified either via {@link #value} or - * {@link #classes}. + * {@code #classes}. * @see #value() */ @AliasFor("value")