Fix BindingReflectionHintsRegistrar enum support

This commit prevents a StackOverflowError in
BindingReflectionHintsRegistrar when processing enum types
and refine related generated hints.

See gh-28683
This commit is contained in:
Sébastien Deleuze
2022-06-27 12:18:43 +02:00
parent 730d6c95fc
commit fb1aa4f5d5
2 changed files with 16 additions and 3 deletions

View File

@@ -196,6 +196,13 @@ public class BindingReflectionHintsRegistrarTests {
typeHint -> assertThat(typeHint.getType()).isEqualTo(TypeReference.of(Set.class)));
}
@Test
void registerTypeForSerializationWithEnum() {
bindingRegistrar.registerReflectionHints(this.hints.reflection(), SampleEnum.class);
assertThat(this.hints.reflection().typeHints()).singleElement()
.satisfies(typeHint -> assertThat(typeHint.getType()).isEqualTo(TypeReference.of(SampleEnum.class)));
}
static class SampleEmptyClass {
}
@@ -274,4 +281,8 @@ public class BindingReflectionHintsRegistrarTests {
}
}
enum SampleEnum {
value1, value2
}
}