Polishing
This commit is contained in:
parent
7631a09405
commit
a052f9a34e
|
@ -100,8 +100,7 @@ public abstract class RuntimeHintsUtils {
|
|||
Class<?> annotationAttribute = aliasFor.annotation();
|
||||
Class<?> targetAnnotation = (annotationAttribute != Annotation.class
|
||||
? annotationAttribute : annotationType);
|
||||
if (!types.contains(targetAnnotation)) {
|
||||
types.add(targetAnnotation);
|
||||
if (types.add(targetAnnotation)) {
|
||||
if (!targetAnnotation.equals(annotationType)) {
|
||||
collectAliasedAnnotations(seen, types, targetAnnotation);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import org.springframework.aot.hint.JdkProxyHint;
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.ReflectionHints;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.TypeHint;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
|
@ -74,7 +73,8 @@ class RuntimeHintsUtilsTests {
|
|||
RuntimeHintsUtils.registerAnnotation(this.hints, RetryInvoker.class);
|
||||
assertThat(this.hints.reflection().typeHints())
|
||||
.anySatisfy(annotationHint(RetryInvoker.class))
|
||||
.anySatisfy(annotationHint(SampleInvoker.class));
|
||||
.anySatisfy(annotationHint(SampleInvoker.class))
|
||||
.hasSize(2);
|
||||
assertThat(this.hints.proxies().jdkProxies())
|
||||
.anySatisfy(annotationProxy(RetryInvoker.class))
|
||||
.anySatisfy(annotationProxy(SampleInvoker.class))
|
||||
|
@ -92,8 +92,7 @@ class RuntimeHintsUtilsTests {
|
|||
@Test
|
||||
void registerAnnotationTypeWhereUsedAsAMetaAnnotationRegistersHierarchy() {
|
||||
RuntimeHintsUtils.registerAnnotation(this.hints, RetryWithEnabledFlagInvoker.class);
|
||||
ReflectionHints reflection = this.hints.reflection();
|
||||
assertThat(reflection.typeHints())
|
||||
assertThat(this.hints.reflection().typeHints())
|
||||
.anySatisfy(annotationHint(RetryWithEnabledFlagInvoker.class))
|
||||
.anySatisfy(annotationHint(RetryInvoker.class))
|
||||
.anySatisfy(annotationHint(SampleInvoker.class))
|
||||
|
@ -117,8 +116,7 @@ class RuntimeHintsUtilsTests {
|
|||
|
||||
private Consumer<JdkProxyHint> annotationProxy(Class<?> type) {
|
||||
return jdkProxyHint -> assertThat(jdkProxyHint.getProxiedInterfaces())
|
||||
.containsExactly(TypeReference.of(type),
|
||||
TypeReference.of(SynthesizedAnnotation.class));
|
||||
.containsExactly(TypeReference.of(type), TypeReference.of(SynthesizedAnnotation.class));
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,7 +152,7 @@ class RuntimeHintsUtilsTests {
|
|||
@RetryInvoker
|
||||
@interface RetryWithEnabledFlagInvoker {
|
||||
|
||||
@AliasFor(attribute = "value", annotation = RetryInvoker.class)
|
||||
@AliasFor(annotation = RetryInvoker.class)
|
||||
int value() default 5;
|
||||
|
||||
boolean enabled() default true;
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.springframework.lang.Nullable;
|
|||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that make web binding
|
||||
* annotations at runtime.
|
||||
* {@link RuntimeHintsRegistrar} implementation that makes web binding
|
||||
* annotations available at runtime.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.0
|
||||
|
|
Loading…
Reference in New Issue