Fix StackOverflowError in BindingReflectionHintsRegistrar
This commit fixes the cycle detection in BindingReflectionHintsRegistrar. See gh-28683
This commit is contained in:
@@ -131,6 +131,15 @@ public class BindingReflectionHintsRegistrarTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void registerTypeForSerializationWithCycles() {
|
||||
bindingRegistrar.registerReflectionHints(this.hints.reflection(), SampleClassWithCycles.class);
|
||||
assertThat(this.hints.reflection().typeHints()).satisfiesExactlyInAnyOrder(
|
||||
typeHint -> assertThat(typeHint.getType()).isEqualTo(TypeReference.of(SampleClassWithCycles.class)),
|
||||
typeHint -> assertThat(typeHint.getType()).isEqualTo(TypeReference.of(List.class)));
|
||||
}
|
||||
|
||||
|
||||
static class SampleEmptyClass {
|
||||
}
|
||||
|
||||
@@ -172,4 +181,15 @@ public class BindingReflectionHintsRegistrarTests {
|
||||
}
|
||||
}
|
||||
|
||||
static class SampleClassWithCycles {
|
||||
|
||||
public SampleClassWithCycles getSampleClassWithCycles() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SampleClassWithCycles> getSampleClassWithCyclesList() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user