Register proxy hint for meta-annotations with attribute override
Closes gh-28767
This commit is contained in:
parent
e0190c12d4
commit
56a8c1a9db
|
|
@ -60,7 +60,10 @@ public abstract class RuntimeHintsUtils {
|
||||||
hints.reflection().registerType(annotationType, ANNOTATION_HINT);
|
hints.reflection().registerType(annotationType, ANNOTATION_HINT);
|
||||||
Set<Class<?>> allAnnotations = new LinkedHashSet<>();
|
Set<Class<?>> allAnnotations = new LinkedHashSet<>();
|
||||||
collectAliasedAnnotations(new HashSet<>(), allAnnotations, annotationType);
|
collectAliasedAnnotations(new HashSet<>(), allAnnotations, annotationType);
|
||||||
allAnnotations.forEach(annotation -> hints.reflection().registerType(annotation, ANNOTATION_HINT));
|
allAnnotations.forEach(annotation -> {
|
||||||
|
hints.reflection().registerType(annotation, ANNOTATION_HINT);
|
||||||
|
hints.proxies().registerJdkProxy(annotation, SynthesizedAnnotation.class);
|
||||||
|
});
|
||||||
if (!allAnnotations.isEmpty()) {
|
if (!allAnnotations.isEmpty()) {
|
||||||
hints.proxies().registerJdkProxy(annotationType, SynthesizedAnnotation.class);
|
hints.proxies().registerJdkProxy(annotationType, SynthesizedAnnotation.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,13 +60,15 @@ class RuntimeHintsUtilsTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void registerAnnotationTypeProxyRegistersJdkProxy() {
|
void registerAnnotationTypeProxyRegistersJdkProxies() {
|
||||||
RuntimeHintsUtils.registerAnnotation(this.hints, RetryInvoker.class);
|
RuntimeHintsUtils.registerAnnotation(this.hints, RetryInvoker.class);
|
||||||
assertThat(this.hints.reflection().typeHints())
|
assertThat(this.hints.reflection().typeHints())
|
||||||
.anySatisfy(annotationHint(RetryInvoker.class))
|
.anySatisfy(annotationHint(RetryInvoker.class))
|
||||||
.anySatisfy(annotationHint(SampleInvoker.class));
|
.anySatisfy(annotationHint(SampleInvoker.class));
|
||||||
assertThat(this.hints.proxies().jdkProxies()).singleElement()
|
assertThat(this.hints.proxies().jdkProxies())
|
||||||
.satisfies(annotationProxy(RetryInvoker.class));
|
.anySatisfy(annotationProxy(RetryInvoker.class))
|
||||||
|
.anySatisfy(annotationProxy(SampleInvoker.class))
|
||||||
|
.hasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -78,8 +80,11 @@ class RuntimeHintsUtilsTests {
|
||||||
.anySatisfy(annotationHint(RetryInvoker.class))
|
.anySatisfy(annotationHint(RetryInvoker.class))
|
||||||
.anySatisfy(annotationHint(SampleInvoker.class))
|
.anySatisfy(annotationHint(SampleInvoker.class))
|
||||||
.hasSize(3);
|
.hasSize(3);
|
||||||
assertThat(this.hints.proxies().jdkProxies()).singleElement()
|
assertThat(this.hints.proxies().jdkProxies())
|
||||||
.satisfies(annotationProxy(RetryWithEnabledFlagInvoker.class));
|
.anySatisfy(annotationProxy(RetryWithEnabledFlagInvoker.class))
|
||||||
|
.anySatisfy(annotationProxy(RetryInvoker.class))
|
||||||
|
.anySatisfy(annotationProxy(SampleInvoker.class))
|
||||||
|
.hasSize(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Consumer<TypeHint> annotationHint(Class<?> type) {
|
private Consumer<TypeHint> annotationHint(Class<?> type) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue