Skip to content

Commit f85752a

Browse files
committed
Fix hints and predicates for Field reflective access
This commit revisits the arrangement for Field hints after changes made in gh-34239. Closes gh-34294
1 parent 3302bc4 commit f85752a

File tree

21 files changed

+106
-136
lines changed

21 files changed

+106
-136
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public AspectJAdvisorContribution(Class<?> beanClass) {
7474

7575
@Override
7676
public void applyTo(GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) {
77-
generationContext.getRuntimeHints().reflection().registerType(this.beanClass, MemberCategory.INVOKE_DECLARED_FIELDS);
77+
generationContext.getRuntimeHints().reflection().registerType(this.beanClass, MemberCategory.ACCESS_DECLARED_FIELDS);
7878
}
7979
}
8080

spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectJAdvisorBeanRegistrationAotProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AspectJAdvisorBeanRegistrationAotProcessorTests {
4848
@Test
4949
void shouldProcessAspectJClass() {
5050
process(AspectJClass.class);
51-
assertThat(reflection().onType(AspectJClass.class).withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS))
51+
assertThat(reflection().onType(AspectJClass.class).withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS))
5252
.accepts(this.runtimeHints);
5353
}
5454

spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ private void registerReflectionHints(RootBeanDefinition beanDefinition, Method w
253253
// ReflectionUtils#findField searches recursively in the type hierarchy
254254
Class<?> searchType = beanDefinition.getTargetType();
255255
while (searchType != null && searchType != writeMethod.getDeclaringClass()) {
256-
this.hints.reflection().registerType(searchType, MemberCategory.INVOKE_DECLARED_FIELDS);
256+
this.hints.reflection().registerType(searchType, MemberCategory.ACCESS_DECLARED_FIELDS);
257257
searchType = searchType.getSuperclass();
258258
}
259-
this.hints.reflection().registerType(writeMethod.getDeclaringClass(), MemberCategory.INVOKE_DECLARED_FIELDS);
259+
this.hints.reflection().registerType(writeMethod.getDeclaringClass(), MemberCategory.ACCESS_DECLARED_FIELDS);
260260
}
261261

262262
private void addQualifiers(CodeBlock.Builder code, RootBeanDefinition beanDefinition) {

spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ private void assertHasMethodInvokeHints(Class<?> beanType, String... methodNames
574574

575575
private void assertHasDeclaredFieldsHint(Class<?> beanType) {
576576
assertThat(RuntimeHintsPredicates.reflection()
577-
.onType(beanType).withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS))
577+
.onType(beanType).withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS))
578578
.accepts(this.generationContext.getRuntimeHints());
579579
}
580580

spring-context/src/main/java/org/springframework/validation/beanvalidation/BeanValidationBeanRegistrationAotProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public AotContribution(Collection<Class<?>> validatedClasses,
233233
public void applyTo(GenerationContext generationContext, BeanRegistrationCode beanRegistrationCode) {
234234
ReflectionHints hints = generationContext.getRuntimeHints().reflection();
235235
for (Class<?> validatedClass : this.validatedClasses) {
236-
hints.registerType(validatedClass, MemberCategory.INVOKE_DECLARED_FIELDS);
236+
hints.registerType(validatedClass, MemberCategory.ACCESS_DECLARED_FIELDS);
237237
}
238238
for (Class<? extends ConstraintValidator<?, ?>> constraintValidatorClass : this.constraintValidatorClasses) {
239239
hints.registerType(constraintValidatorClass, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);

spring-context/src/test/java/org/springframework/context/annotation/AnnotationConfigApplicationContextTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ void refreshForAotRegisterHintsForCglibProxy() {
534534
TypeReference cglibType = TypeReference.of(CglibConfiguration.class.getName() + "$$SpringCGLIB$$0");
535535
assertThat(RuntimeHintsPredicates.reflection().onType(cglibType)
536536
.withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
537-
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_FIELDS))
537+
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.ACCESS_DECLARED_FIELDS))
538538
.accepts(runtimeHints);
539539
assertThat(RuntimeHintsPredicates.reflection().onType(CglibConfiguration.class)
540540
.withMemberCategories(MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.INVOKE_DECLARED_METHODS))

spring-context/src/test/java/org/springframework/validation/beanvalidation/BeanValidationBeanRegistrationAotProcessorTests.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void shouldProcessMethodParameterLevelConstraint() {
7979
process(MethodParameterLevelConstraint.class);
8080
assertThat(this.generationContext.getRuntimeHints().reflection().typeHints()).hasSize(2);
8181
assertThat(RuntimeHintsPredicates.reflection().onType(MethodParameterLevelConstraint.class)
82-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
82+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
8383
assertThat(RuntimeHintsPredicates.reflection().onType(ExistsValidator.class)
8484
.withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.generationContext.getRuntimeHints());
8585
}
@@ -89,7 +89,7 @@ void shouldProcessConstructorParameterLevelConstraint() {
8989
process(ConstructorParameterLevelConstraint.class);
9090
assertThat(this.generationContext.getRuntimeHints().reflection().typeHints()).hasSize(2);
9191
assertThat(RuntimeHintsPredicates.reflection().onType(ConstructorParameterLevelConstraint.class)
92-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
92+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
9393
assertThat(RuntimeHintsPredicates.reflection().onType(ExistsValidator.class)
9494
.withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.generationContext.getRuntimeHints());
9595
}
@@ -99,7 +99,7 @@ void shouldProcessPropertyLevelConstraint() {
9999
process(PropertyLevelConstraint.class);
100100
assertThat(this.generationContext.getRuntimeHints().reflection().typeHints()).hasSize(2);
101101
assertThat(RuntimeHintsPredicates.reflection().onType(PropertyLevelConstraint.class)
102-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
102+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
103103
assertThat(RuntimeHintsPredicates.reflection().onType(ExistsValidator.class)
104104
.withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.generationContext.getRuntimeHints());
105105
}
@@ -109,7 +109,7 @@ void shouldProcessGenericTypeLevelConstraint() {
109109
process(GenericTypeLevelConstraint.class);
110110
assertThat(this.generationContext.getRuntimeHints().reflection().typeHints()).hasSize(2);
111111
assertThat(RuntimeHintsPredicates.reflection().onType(GenericTypeLevelConstraint.class)
112-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
112+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
113113
assertThat(RuntimeHintsPredicates.reflection().onType(PatternValidator.class)
114114
.withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.generationContext.getRuntimeHints());
115115
}
@@ -119,9 +119,9 @@ void shouldProcessTransitiveGenericTypeLevelConstraint() {
119119
process(TransitiveGenericTypeLevelConstraint.class);
120120
assertThat(this.generationContext.getRuntimeHints().reflection().typeHints()).hasSize(3);
121121
assertThat(RuntimeHintsPredicates.reflection().onType(TransitiveGenericTypeLevelConstraint.class)
122-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
122+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
123123
assertThat(RuntimeHintsPredicates.reflection().onType(Exclude.class)
124-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
124+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
125125
assertThat(RuntimeHintsPredicates.reflection().onType(PatternValidator.class)
126126
.withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)).accepts(this.generationContext.getRuntimeHints());
127127
}
@@ -132,7 +132,7 @@ void shouldProcessRecursiveGenericsWithoutInfiniteRecursion(Class<?> beanClass)
132132
process(beanClass);
133133
assertThat(this.generationContext.getRuntimeHints().reflection().typeHints()).hasSize(1);
134134
assertThat(RuntimeHintsPredicates.reflection().onType(beanClass)
135-
.withMemberCategory(MemberCategory.INVOKE_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
135+
.withMemberCategory(MemberCategory.ACCESS_DECLARED_FIELDS)).accepts(this.generationContext.getRuntimeHints());
136136
}
137137

138138
@Test // gh-33940

spring-core-test/src/main/java/org/springframework/aot/agent/InstrumentedMethod.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ enum InstrumentedMethod {
243243
* {@link Field#get(Object)}.
244244
*/
245245
FIELD_GET(Field.class, "get", HintType.REFLECTION,
246-
invocation -> reflection().onFieldInvocation(invocation.getInstance())),
246+
invocation -> reflection().onFieldAccess(invocation.getInstance())),
247247

248248
/**
249249
* {@link Field#set(Object, Object)}.
250250
*/
251251
FIELD_SET(Field.class, "set", HintType.REFLECTION,
252-
invocation -> reflection().onFieldInvocation(invocation.getInstance())),
252+
invocation -> reflection().onFieldAccess(invocation.getInstance())),
253253

254254

255255
/*

spring-core/src/main/java/org/springframework/aot/hint/BindingReflectionHintsRegistrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void registerReflectionHints(ReflectionHints hints, Set<Type> seen, Type
100100
typeHint.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
101101
MemberCategory.INVOKE_PUBLIC_METHODS);
102102
}
103-
typeHint.withMembers(MemberCategory.INVOKE_DECLARED_FIELDS,
103+
typeHint.withMembers(MemberCategory.ACCESS_DECLARED_FIELDS,
104104
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
105105
for (Method method : clazz.getMethods()) {
106106
String methodName = method.getName();

spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public enum MemberCategory {
3333

3434
/**
3535
* A category that represents reflective field access on public {@linkplain Field fields}.
36-
* @deprecated in favor of @link #INVOKE_PUBLIC_FIELDS} with similar semantics.
36+
* @deprecated in favor of {@link #ACCESS_PUBLIC_FIELDS} with similar semantics.
3737
* @see Field#get(Object)
3838
* @see Field#set(Object, Object)
3939
*/
@@ -44,7 +44,7 @@ public enum MemberCategory {
4444
* A category that represents reflective field access on
4545
* {@linkplain Class#getDeclaredFields() declared fields}: all fields defined by the
4646
* class but not inherited fields.
47-
* @deprecated in favor of @link #INVOKE_DECLARED_FIELDS} with similar semantics.
47+
* @deprecated in favor of {@link #ACCESS_DECLARED_FIELDS} with similar semantics.
4848
* @see Class#getDeclaredFields()
4949
* @see Field#get(Object)
5050
* @see Field#set(Object, Object)
@@ -53,20 +53,23 @@ public enum MemberCategory {
5353
DECLARED_FIELDS,
5454

5555
/**
56-
* A category that represents getting/setting values on public {@linkplain Field fields}.
56+
* A category that represents reflective field access on public {@linkplain Field fields}..
5757
* @see Field#get(Object)
5858
* @see Field#set(Object, Object)
5959
* @since 7.0
6060
*/
61-
INVOKE_PUBLIC_FIELDS,
61+
ACCESS_PUBLIC_FIELDS,
6262

6363
/**
64-
* A category that represents getting/setting values on declared {@linkplain Field fields}.
64+
* A category that represents reflective field access on
65+
* {@linkplain Class#getDeclaredFields() declared fields}: all fields defined by the
66+
* class but not inherited fields.
67+
* @see Class#getDeclaredFields()
6568
* @see Field#get(Object)
6669
* @see Field#set(Object, Object)
6770
* @since 7.0
6871
*/
69-
INVOKE_DECLARED_FIELDS,
72+
ACCESS_DECLARED_FIELDS,
7073

7174
/**
7275
* A category that defines public {@linkplain Constructor constructors} can

spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java

Lines changed: 39 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -212,69 +212,55 @@ else if (methods.size() > 1) {
212212
}
213213

214214
/**
215-
* Return a predicate that checks whether a reflection hint is registered for the field that matches the given selector.
215+
* Return a predicate that checks whether a reflective field access hint is registered for the field.
216216
* This looks up a field on the given type with the expected name, if present.
217-
* By default, unsafe or write access is not considered.
218-
* <p>The returned type exposes additional methods that refine the predicate behavior.
219217
* @param type the type holding the field
220218
* @param fieldName the field name
221219
* @return the {@link RuntimeHints} predicate
222220
* @throws IllegalArgumentException if a field cannot be found with the given name.
223-
* @deprecated since 7.0 in favor of {@link #onFieldInvocation(Class, String)}
224-
* or {@link #onType(Class)}.
221+
* @deprecated since 7.0 in favor of {@link #onFieldAccess(Class, String)} with similar semantics.
225222
*/
226223
@Deprecated(since = "7.0", forRemoval = true)
227-
public FieldHintPredicate onField(Class<?> type, String fieldName) {
228-
Assert.notNull(type, "'type' must not be null");
229-
Assert.hasText(fieldName, "'fieldName' must not be empty");
230-
Field field = ReflectionUtils.findField(type, fieldName);
231-
if (field == null) {
232-
throw new IllegalArgumentException("No field named '%s' on class %s".formatted(fieldName, type.getName()));
233-
}
234-
return new FieldHintPredicate(field);
224+
public Predicate<RuntimeHints> onField(Class<?> type, String fieldName) {
225+
return onFieldAccess(type, fieldName);
235226
}
236227

237228
/**
238-
* Return a predicate that checks whether an invocation hint is registered for the field that matches the given selector.
229+
* Return a predicate that checks whether a reflective field access hint is registered for the field.
239230
* This looks up a field on the given type with the expected name, if present.
240231
* @param type the type holding the field
241232
* @param fieldName the field name
242233
* @return the {@link RuntimeHints} predicate
243234
* @throws IllegalArgumentException if a field cannot be found with the given name.
244235
* @since 7.0
245236
*/
246-
public Predicate<RuntimeHints> onFieldInvocation(Class<?> type, String fieldName) {
237+
public Predicate<RuntimeHints> onFieldAccess(Class<?> type, String fieldName) {
247238
Assert.notNull(type, "'type' must not be null");
248239
Assert.hasText(fieldName, "'fieldName' must not be empty");
249240
Field field = ReflectionUtils.findField(type, fieldName);
250241
if (field == null) {
251242
throw new IllegalArgumentException("No field named '%s' on class %s".formatted(fieldName, type.getName()));
252243
}
253-
return new FieldHintPredicate(field).invocation();
244+
return new FieldHintPredicate(field);
254245
}
255246

256247
/**
257-
* Return a predicate that checks whether a reflection hint is registered for the field that matches the given selector.
248+
* Return a predicate that checks whether a reflective field access hint is registered for the field.
258249
* This looks up a field on the given type with the expected name, if present.
259-
* By default, unsafe or write access is not considered.
260-
* <p>The returned type exposes additional methods that refine the predicate behavior.
261250
* @param className the name of the class holding the field
262251
* @param fieldName the field name
263252
* @return the {@link RuntimeHints} predicate
264253
* @throws ClassNotFoundException if the class cannot be resolved.
265254
* @throws IllegalArgumentException if a field cannot be found with the given name.
266-
* @deprecated since 7.0 in favor of {@link #onFieldInvocation(String, String)}
267-
* or {@link #onType(Class)}.
255+
* @deprecated since 7.0 in favor of {@link #onFieldAccess(String, String)} with similar semantics.
268256
*/
269257
@Deprecated(since = "7.0", forRemoval = true)
270-
public FieldHintPredicate onField(String className, String fieldName) throws ClassNotFoundException {
271-
Assert.hasText(className, "'className' must not be empty");
272-
Assert.hasText(fieldName, "'fieldName' must not be empty");
273-
return onField(Class.forName(className), fieldName);
258+
public Predicate<RuntimeHints> onField(String className, String fieldName) throws ClassNotFoundException {
259+
return onFieldAccess(className, fieldName);
274260
}
275261

276262
/**
277-
* Return a predicate that checks whether an invocation hint is registered for the field that matches the given selector.
263+
* Return a predicate that checks whether an invocation hint is registered for the field.
278264
* This looks up a field on the given type with the expected name, if present.
279265
* @param className the name of the class holding the field
280266
* @param fieldName the field name
@@ -283,23 +269,21 @@ public FieldHintPredicate onField(String className, String fieldName) throws Cla
283269
* @throws IllegalArgumentException if a field cannot be found with the given name.
284270
* @since 7.0
285271
*/
286-
public Predicate<RuntimeHints> onFieldInvocation(String className, String fieldName) throws ClassNotFoundException {
272+
public Predicate<RuntimeHints> onFieldAccess(String className, String fieldName) throws ClassNotFoundException {
287273
Assert.hasText(className, "'className' must not be empty");
288274
Assert.hasText(fieldName, "'fieldName' must not be empty");
289-
return onField(Class.forName(className), fieldName).invocation();
275+
return onFieldAccess(Class.forName(className), fieldName);
290276
}
291277

292278
/**
293279
* Return a predicate that checks whether a reflective field access hint is registered for the given field.
294280
* @param field the field
295281
* @return the {@link RuntimeHints} predicate
296-
* @deprecated since 7.0 in favor of {@link #onFieldInvocation(Field)}
297-
* or {@link #onType(Class)}.
282+
* @deprecated since 7.0 in favor of {@link #onFieldAccess(Field)} with similar semantics.
298283
*/
299284
@Deprecated(since = "7.0", forRemoval = true)
300-
public FieldHintPredicate onField(Field field) {
301-
Assert.notNull(field, "'field' must not be null");
302-
return new FieldHintPredicate(field);
285+
public Predicate<RuntimeHints> onField(Field field) {
286+
return onFieldAccess(field);
303287
}
304288

305289
/**
@@ -308,9 +292,9 @@ public FieldHintPredicate onField(Field field) {
308292
* @return the {@link RuntimeHints} predicate
309293
* @since 7.0
310294
*/
311-
public Predicate<RuntimeHints> onFieldInvocation(Field field) {
295+
public Predicate<RuntimeHints> onFieldAccess(Field field) {
312296
Assert.notNull(field, "'field' must not be null");
313-
return new FieldHintPredicate(field).invocation();
297+
return new FieldHintPredicate(field);
314298
}
315299

316300

@@ -494,39 +478,34 @@ public static class FieldHintPredicate implements Predicate<RuntimeHints> {
494478

495479
private final Field field;
496480

497-
private @Nullable ExecutableMode executableMode;
498-
499481
FieldHintPredicate(Field field) {
500482
this.field = field;
501483
}
502484

503-
/**
504-
* Refine the current predicate to only match if an invocation hint is registered for this field.
505-
* @return the refined {@link RuntimeHints} predicate
506-
* @since 7.0
507-
*/
508-
public FieldHintPredicate invocation() {
509-
this.executableMode = ExecutableMode.INVOKE;
510-
return this;
511-
}
512-
513485
@Override
514486
public boolean test(RuntimeHints runtimeHints) {
515487
TypeHint typeHint = runtimeHints.reflection().getTypeHint(this.field.getDeclaringClass());
516-
if (typeHint != null) {
517-
if (this.executableMode == ExecutableMode.INVOKE) {
518-
if (Modifier.isPublic(this.field.getModifiers())) {
519-
return typeHint.getMemberCategories().contains(MemberCategory.INVOKE_PUBLIC_FIELDS);
520-
}
521-
else {
522-
return typeHint.getMemberCategories().contains(MemberCategory.INVOKE_DECLARED_FIELDS);
523-
}
524-
}
525-
else {
526-
return true;
527-
}
488+
if (typeHint == null) {
489+
return false;
490+
}
491+
return memberCategoryMatch(typeHint) || exactMatch(typeHint);
492+
}
493+
494+
@SuppressWarnings("removal")
495+
private boolean memberCategoryMatch(TypeHint typeHint) {
496+
if (Modifier.isPublic(this.field.getModifiers())) {
497+
return typeHint.getMemberCategories().contains(MemberCategory.ACCESS_PUBLIC_FIELDS)
498+
|| typeHint.getMemberCategories().contains(MemberCategory.PUBLIC_FIELDS);
499+
}
500+
else {
501+
return typeHint.getMemberCategories().contains(MemberCategory.ACCESS_DECLARED_FIELDS)
502+
|| typeHint.getMemberCategories().contains(MemberCategory.DECLARED_FIELDS);
528503
}
529-
return false;
504+
}
505+
506+
private boolean exactMatch(TypeHint typeHint) {
507+
return typeHint.fields().anyMatch(fieldHint ->
508+
this.field.getName().equals(fieldHint.getName()));
530509
}
531510
}
532511

spring-core/src/main/java/org/springframework/aot/hint/support/ClassHintUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public abstract class ClassHintUtils {
4444
private static final Consumer<TypeHint.Builder> asClassBasedProxy = hint ->
4545
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
4646
MemberCategory.INVOKE_DECLARED_METHODS,
47-
MemberCategory.INVOKE_DECLARED_FIELDS);
47+
MemberCategory.ACCESS_DECLARED_FIELDS);
4848

4949
private static final Consumer<TypeHint.Builder> asProxiedUserClass = hint ->
5050
hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS,

0 commit comments

Comments
 (0)