Register hints for superclass in BindingReflectionHintsRegistrar
Closes gh-31552
This commit is contained in:
@@ -63,6 +63,28 @@ class BindingReflectionHintsRegistrarTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void registerTypeForSerializationWithExtendingClass() {
|
||||
bindingRegistrar.registerReflectionHints(this.hints.reflection(), SampleExtendingClass.class);
|
||||
assertThat(this.hints.reflection().typeHints()).satisfiesExactlyInAnyOrder(
|
||||
typeHint -> {
|
||||
assertThat(typeHint.getType()).isEqualTo(TypeReference.of(SampleEmptyClass.class));
|
||||
assertThat(typeHint.getMemberCategories()).containsExactlyInAnyOrder(
|
||||
MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
assertThat(typeHint.constructors()).isEmpty();
|
||||
assertThat(typeHint.fields()).isEmpty();
|
||||
assertThat(typeHint.methods()).isEmpty();
|
||||
},
|
||||
typeHint -> {
|
||||
assertThat(typeHint.getType()).isEqualTo(TypeReference.of(SampleExtendingClass.class));
|
||||
assertThat(typeHint.getMemberCategories()).containsExactlyInAnyOrder(
|
||||
MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
assertThat(typeHint.constructors()).isEmpty();
|
||||
assertThat(typeHint.fields()).isEmpty();
|
||||
assertThat(typeHint.methods()).isEmpty();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void registerTypeForSerializationWithNoProperty() {
|
||||
bindingRegistrar.registerReflectionHints(this.hints.reflection(), SampleClassWithNoProperty.class);
|
||||
@@ -284,6 +306,9 @@ class BindingReflectionHintsRegistrarTests {
|
||||
static class SampleEmptyClass {
|
||||
}
|
||||
|
||||
static class SampleExtendingClass extends SampleEmptyClass {
|
||||
}
|
||||
|
||||
static class SampleClassWithNoProperty {
|
||||
|
||||
String name() {
|
||||
|
||||
Reference in New Issue
Block a user