Fix BindingReflectionHintsRegistrar anonymous classes support

This commit ensures that giving an anonymous class for reflection hints
registration does not result in a NullPointerException, since the
canonical name of anonymous classes is null.

Fixes gh-29657
This commit is contained in:
Brian Clozel
2022-12-07 16:37:01 +01:00
parent 92a6e7ddcd
commit d601f3196a
2 changed files with 7 additions and 1 deletions

View File

@@ -221,6 +221,12 @@ public class BindingReflectionHintsRegistrarTests {
});
}
@Test
void registerTypeForSerializationWithAnonymousClass() {
Runnable anonymousRunnable = () -> { };
bindingRegistrar.registerReflectionHints(this.hints.reflection(), anonymousRunnable.getClass());
}
@Test
void registerTypeForJacksonAnnotations() {
bindingRegistrar.registerReflectionHints(this.hints.reflection(), SampleClassWithJsonProperty.class);