Migrate hint registration to shortcuts

Migrate code to make use of the `MemberCategory` and `FieldMode`
shortcuts.

See gh-29011
This commit is contained in:
Phillip Webb
2022-09-01 16:30:25 -07:00
parent bc0bf1fac3
commit 505da5c602
17 changed files with 147 additions and 198 deletions

View File

@@ -80,20 +80,20 @@ public class BindingReflectionHintsRegistrar {
if (clazz.isPrimitive() || clazz == Object.class) {
return;
}
hints.registerType(clazz, builder -> {
hints.registerType(clazz, typeHint -> {
if (seen.contains(type)) {
return;
}
seen.add(type);
if (shouldRegisterMembers(clazz)) {
if (clazz.isRecord()) {
builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
typeHint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
for (RecordComponent recordComponent : clazz.getRecordComponents()) {
registerRecordHints(hints, seen, recordComponent.getAccessor());
}
}
else {
builder.withMembers(
typeHint.withMembers(
MemberCategory.DECLARED_FIELDS,
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
try {