Support properties on records in BindingReflectionHintsRegistrar

Closes gh-29571
This commit is contained in:
Sébastien Deleuze
2022-12-10 16:12:23 +01:00
parent 2b6f3caff4
commit dc5a773b2b
2 changed files with 25 additions and 13 deletions

View File

@@ -221,6 +221,13 @@ public class BindingReflectionHintsRegistrarTests {
});
}
@Test
void registerTypeForSerializationWithRecordWithProperty() {
bindingRegistrar.registerReflectionHints(this.hints.reflection(), SampleRecordWithProperty.class);
assertThat(RuntimeHintsPredicates.reflection().onMethod(SampleRecordWithProperty.class, "getNameProperty"))
.accepts(this.hints);
}
@Test
void registerTypeForSerializationWithAnonymousClass() {
Runnable anonymousRunnable = () -> { };
@@ -329,6 +336,13 @@ public class BindingReflectionHintsRegistrarTests {
record SampleRecord(String name) {}
record SampleRecordWithProperty(String name) {
public String getNameProperty() {
return "";
}
}
static class SampleClassWithJsonProperty {
@JsonProperty