diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java index 124fceb815..eaefe0d8a4 100644 --- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java @@ -608,10 +608,11 @@ public abstract class ReflectionUtils { } /** - * Set the field represented by the supplied {@link Field field object} on the - * specified {@link Object target object} to the specified {@code value}. - * In accordance with {@link Field#set(Object, Object)} semantics, the new value + * Set the field represented by the supplied {@linkplain Field field object} on + * the specified {@linkplain Object target object} to the specified {@code value}. + *

In accordance with {@link Field#set(Object, Object)} semantics, the new value * is automatically unwrapped if the underlying field has a primitive type. + *

This method does not support setting {@code static final} fields. *

Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}. * @param field the field to set * @param target the target object on which to set the field diff --git a/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java b/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java index 3a662ec89c..2197d861b0 100644 --- a/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java +++ b/spring-test/src/main/java/org/springframework/test/util/ReflectionTestUtils.java @@ -112,6 +112,7 @@ public abstract class ReflectionTestUtils { * the provided {@code targetClass} to the supplied {@code value}. *

This method delegates to {@link #setField(Object, Class, String, Object, Class)}, * supplying {@code null} for the {@code targetObject} and {@code type} arguments. + *

This method does not support setting {@code static final} fields. * @param targetClass the target class on which to set the static field; * never {@code null} * @param name the name of the field to set; never {@code null} @@ -128,6 +129,7 @@ public abstract class ReflectionTestUtils { * the supplied {@code value}. *

This method delegates to {@link #setField(Object, Class, String, Object, Class)}, * supplying {@code null} for the {@code targetObject} argument. + *

This method does not support setting {@code static final} fields. * @param targetClass the target class on which to set the static field; * never {@code null} * @param name the name of the field to set; may be {@code null} if @@ -154,6 +156,7 @@ public abstract class ReflectionTestUtils { * field. In addition, an attempt will be made to make non-{@code public} * fields accessible, thus allowing one to set {@code protected}, * {@code private}, and package-private fields. + *

This method does not support setting {@code static final} fields. * @param targetObject the target object on which to set the field; may be * {@code null} if the field is static * @param targetClass the target class on which to set the field; may