From e9dc6be51c21fb5234bf0b86ad4c3070c92d80c4 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 21 Jan 2025 17:12:37 +0100 Subject: [PATCH] Fix Javadoc for field reflection hints Closes gh-34297 --- .../springframework/aot/hint/MemberCategory.java | 14 +++++++++----- .../springframework/aot/hint/ReflectionHints.java | 6 +++--- .../org/springframework/aot/hint/TypeHint.java | 4 +++- .../hint/predicate/ReflectionHintsPredicates.java | 4 +--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java b/spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java index 697431698a..4edd8a9179 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/MemberCategory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,15 +32,19 @@ import java.lang.reflect.Method; public enum MemberCategory { /** - * A category that represents public {@linkplain Field fields}. - * @see Class#getFields() + * A category that represents reflective field access on public {@linkplain Field fields}. + * @see Field#get(Object) + * @see Field#set(Object, Object) */ PUBLIC_FIELDS, /** - * A category that represents {@linkplain Class#getDeclaredFields() declared - * fields}: all fields defined by the class but not inherited fields. + * A category that represents reflective field access on + * {@linkplain Class#getDeclaredFields() declared fields}: all fields defined by the + * class but not inherited fields. * @see Class#getDeclaredFields() + * @see Field#get(Object) + * @see Field#set(Object, Object) */ DECLARED_FIELDS, diff --git a/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java b/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java index d16778dac9..c6fc5bc2a7 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/ReflectionHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -199,8 +199,8 @@ public class ReflectionHints { } /** - * Register the need for reflection on the specified {@link Field}. - * @param field the field that requires reflection + * Register the need for reflective field access on the specified {@link Field}. + * @param field the field that requires reflective access * @return {@code this}, to facilitate method chaining */ public ReflectionHints registerField(Field field) { diff --git a/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java b/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java index 70b7b7ea0e..3418248c87 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/TypeHint.java @@ -182,9 +182,11 @@ public final class TypeHint implements ConditionalHint { } /** - * Register the need for reflection on the field with the specified name. + * Register the need for reflective access on the field with the specified name. * @param name the name of the field * @return {@code this}, to facilitate method chaining + * @see java.lang.reflect.Field#get(Object) + * @see java.lang.reflect.Field#set(Object, Object) */ public Builder withField(String name) { this.fields.add(name); diff --git a/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java b/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java index a9f87de77a..6a4a0be115 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java @@ -183,9 +183,7 @@ public class ReflectionHintsPredicates { } /** - * Return a predicate that checks whether a reflection hint is registered for the given field. - * By default, unsafe or write access is not considered. - *

The returned type exposes additional methods that refine the predicate behavior. + * Return a predicate that checks whether a reflective field access hint is registered for the given field. * @param field the field * @return the {@link RuntimeHints} predicate */