This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 01b2da35a55c8e527a3f166266a463352dc16ebb
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Dec 9 08:03:38 2024 -0500

    Javadoc
    
    Add @throws and @see tags for SecurityException and SecurityManager
    respectively
---
 .../lang3/builder/ReflectionDiffBuilder.java       | 27 +++++++
 .../org/apache/commons/lang3/event/EventUtils.java |  2 +
 .../commons/lang3/reflect/ConstructorUtils.java    |  6 ++
 .../apache/commons/lang3/reflect/FieldUtils.java   | 91 ++++++++++++++++++----
 .../apache/commons/lang3/reflect/MemberUtils.java  |  2 +
 .../apache/commons/lang3/reflect/MethodUtils.java  | 45 +++++++----
 6 files changed, 144 insertions(+), 29 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java 
b/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
index 8e4d0970f..df23bede6 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionDiffBuilder.java
@@ -193,6 +193,12 @@ public class ReflectionDiffBuilder<T> implements 
Builder<DiffResult<T>> {
         return !field.isAnnotationPresent(DiffExclude.class);
     }
 
+    /**
+     * Appends fields using reflection.
+     *
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
+     */
     private void appendFields(final Class<?> clazz) {
         for (final Field field : FieldUtils.getAllFields(clazz)) {
             if (accept(field)) {
@@ -207,6 +213,12 @@ public class ReflectionDiffBuilder<T> implements 
Builder<DiffResult<T>> {
         }
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
+     */
     @Override
     public DiffResult<T> build() {
         if (getLeft().equals(getRight())) {
@@ -234,6 +246,21 @@ public class ReflectionDiffBuilder<T> implements 
Builder<DiffResult<T>> {
         return diffBuilder.getRight();
     }
 
+    /**
+     * Reads a {@link Field}, forcing access if needed.
+     *
+     * @param field
+     *            the field to use
+     * @param target
+     *            the object to call on, may be {@code null} for {@code 
static} fields
+     * @return the field value
+     * @throws NullPointerException
+     *             if the field is {@code null}
+     * @throws IllegalAccessException
+     *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
+     */
     private Object readField(final Field field, final Object target) throws 
IllegalAccessException {
         return FieldUtils.readField(field, target, true);
     }
diff --git a/src/main/java/org/apache/commons/lang3/event/EventUtils.java 
b/src/main/java/org/apache/commons/lang3/event/EventUtils.java
index c5a21415d..a1f14fb4d 100644
--- a/src/main/java/org/apache/commons/lang3/event/EventUtils.java
+++ b/src/main/java/org/apache/commons/lang3/event/EventUtils.java
@@ -68,6 +68,8 @@ public class EventUtils {
          * @param method the method to be invoked
          * @param parameters the parameters for the method invocation
          * @return the result of the method call
+         * @throws SecurityException if an underlying accessible object's 
method denies the request.
+         * @see SecurityManager#checkPermission
          * @throws Throwable if an error occurs
          */
         @Override
diff --git 
a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java 
b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
index e9972f730..a3ea63a1f 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
@@ -103,6 +103,8 @@ public class ConstructorUtils {
      * @param parameterTypes find method with compatible parameters
      * @return the constructor, null if no matching accessible constructor 
found
      * @throws NullPointerException if {@code cls} is {@code null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static <T> Constructor<T> getMatchingAccessibleConstructor(final 
Class<T> cls,
             final Class<?>... parameterTypes) {
@@ -157,6 +159,8 @@ public class ConstructorUtils {
      * @throws IllegalAccessException if invocation is not permitted by 
security
      * @throws InvocationTargetException if an error occurs on invocation
      * @throws InstantiationException if an error occurs on instantiation
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @see #invokeConstructor(Class, Object[], Class[])
      */
     public static <T> T invokeConstructor(final Class<T> cls, Object... args)
@@ -183,6 +187,8 @@ public class ConstructorUtils {
      * @throws IllegalAccessException if invocation is not permitted by 
security
      * @throws InvocationTargetException if an error occurs on invocation
      * @throws InstantiationException if an error occurs on instantiation
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @see Constructor#newInstance
      */
     public static <T> T invokeConstructor(final Class<T> cls, Object[] args, 
Class<?>[] parameterTypes)
diff --git a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java 
b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
index 8810abefe..1d931f269 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
@@ -17,6 +17,7 @@
 package org.apache.commons.lang3.reflect;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
@@ -91,6 +92,8 @@ public class FieldUtils {
      *             if the class is {@code null}
      * @throws IllegalArgumentException
      *             if the field name is {@code null}, blank, or empty
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Field getDeclaredField(final Class<?> cls, final String 
fieldName) {
         return getDeclaredField(cls, fieldName, false);
@@ -106,13 +109,15 @@ public class FieldUtils {
      *            the field name to obtain
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @return the Field object
      * @throws NullPointerException
      *             if the class is {@code null}
      * @throws IllegalArgumentException
      *             if the field name is {@code null}, blank, or empty
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Field getDeclaredField(final Class<?> cls, final String 
fieldName, final boolean forceAccess) {
         Objects.requireNonNull(cls, "cls");
@@ -145,6 +150,8 @@ public class FieldUtils {
      *             if the class is {@code null}
      * @throws IllegalArgumentException
      *             if the field name is {@code null}, blank, or empty
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Field getField(final Class<?> cls, final String fieldName) {
         return MemberUtils.setAccessibleWorkaround(getField(cls, fieldName, 
false));
@@ -160,12 +167,14 @@ public class FieldUtils {
      *            the field name to obtain
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @return the Field object
      * @throws NullPointerException if the class is {@code null}
      * @throws IllegalArgumentException if the field name is blank or empty or 
is matched at multiple places
      * in the inheritance hierarchy
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Field getField(final Class<?> cls, final String fieldName, 
final boolean forceAccess) {
         Objects.requireNonNull(cls, "cls");
@@ -263,6 +272,8 @@ public class FieldUtils {
      *             if {@code fieldName} is {@code null}, blank or empty, or 
could not be found
      * @throws IllegalAccessException
      *             if the named field is not {@code public}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readDeclaredField(final Object target, final String 
fieldName) throws IllegalAccessException {
         return readDeclaredField(target, fieldName, false);
@@ -277,7 +288,7 @@ public class FieldUtils {
      *            the field name to obtain
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match public fields.
      * @return the Field object
      * @throws NullPointerException
@@ -286,6 +297,8 @@ public class FieldUtils {
      *             if {@code fieldName} is {@code null}, blank or empty, or 
could not be found
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readDeclaredField(final Object target, final String 
fieldName, final boolean forceAccess) throws IllegalAccessException {
         Objects.requireNonNull(target, "target");
@@ -311,6 +324,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank, empty, or is not 
{@code static}
      * @throws IllegalAccessException
      *             if the field is not accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readDeclaredStaticField(final Class<?> cls, final 
String fieldName) throws IllegalAccessException {
         return readDeclaredStaticField(cls, fieldName, false);
@@ -325,7 +340,7 @@ public class FieldUtils {
      *            the field name to obtain
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @return the Field object
      * @throws NullPointerException
@@ -334,6 +349,8 @@ public class FieldUtils {
      *             if the field name is blank or empty, is not {@code static}
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readDeclaredStaticField(final Class<?> cls, final 
String fieldName, final boolean forceAccess) throws IllegalAccessException {
         final Field field = getDeclaredField(cls, fieldName, forceAccess);
@@ -354,6 +371,8 @@ public class FieldUtils {
      *             if the field is {@code null}
      * @throws IllegalAccessException
      *             if the field is not accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readField(final Field field, final Object target) 
throws IllegalAccessException {
         return readField(field, target, false);
@@ -368,12 +387,16 @@ public class FieldUtils {
      *            the object to call on, may be {@code null} for {@code 
static} fields
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method.
+     *            {@link AccessibleObject#setAccessible(boolean)} method.
      * @return the field value
      * @throws NullPointerException
      *             if the field is {@code null}
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readField(final Field field, final Object target, 
final boolean forceAccess) throws IllegalAccessException {
         Objects.requireNonNull(field, "field");
@@ -399,6 +422,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank, empty, or could 
not be found
      * @throws IllegalAccessException
      *             if the named field is not {@code public}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readField(final Object target, final String 
fieldName) throws IllegalAccessException {
         return readField(target, fieldName, false);
@@ -413,7 +438,7 @@ public class FieldUtils {
      *            the field name to obtain
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @return the field value
      * @throws NullPointerException
@@ -422,6 +447,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank, empty, or could 
not be found
      * @throws IllegalAccessException
      *             if the named field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readField(final Object target, final String 
fieldName, final boolean forceAccess) throws IllegalAccessException {
         Objects.requireNonNull(target, "target");
@@ -446,6 +473,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank or empty, or is 
not {@code static}
      * @throws IllegalAccessException
      *             if the field is not accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readStaticField(final Class<?> cls, final String 
fieldName) throws IllegalAccessException {
         return readStaticField(cls, fieldName, false);
@@ -460,7 +489,7 @@ public class FieldUtils {
      *            the field name to obtain
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @return the Field object
      * @throws NullPointerException
@@ -469,6 +498,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank or empty, or is 
not {@code static}
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readStaticField(final Class<?> cls, final String 
fieldName, final boolean forceAccess) throws IllegalAccessException {
         final Field field = getField(cls, fieldName, forceAccess);
@@ -489,6 +520,8 @@ public class FieldUtils {
      *             if the field is not {@code static}
      * @throws IllegalAccessException
      *             if the field is not accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readStaticField(final Field field) throws 
IllegalAccessException {
         return readStaticField(field, false);
@@ -501,7 +534,7 @@ public class FieldUtils {
      *            to read
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method.
+     *            {@link AccessibleObject#setAccessible(boolean)} method.
      * @return the field value
      * @throws NullPointerException
      *             if the field is {@code null}
@@ -509,6 +542,8 @@ public class FieldUtils {
      *             if the field is not {@code static}
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object readStaticField(final Field field, final boolean 
forceAccess) throws IllegalAccessException {
         Objects.requireNonNull(field, "field");
@@ -523,6 +558,8 @@ public class FieldUtils {
      *            to remove the final modifier
      * @throws NullPointerException
      *             if the field is {@code null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @since 3.2
      */
     public static void removeFinalModifier(final Field field) {
@@ -536,10 +573,12 @@ public class FieldUtils {
      *            to remove the final modifier
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @throws NullPointerException
      *             if the field is {@code null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @deprecated As of Java 12, we can no longer drop the {@code final} 
modifier, thus
      *             rendering this method obsolete. The JDK discussion about 
this change can be found
      *             here: 
https://mail.openjdk.java.net/pipermail/core-libs-dev/2018-November/056486.html
@@ -592,6 +631,8 @@ public class FieldUtils {
      *             or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeDeclaredField(final Object target, final String 
fieldName, final Object value) throws IllegalAccessException {
         writeDeclaredField(target, fieldName, value, false);
@@ -608,13 +649,15 @@ public class FieldUtils {
      *            to set
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @throws IllegalArgumentException
      *             if {@code fieldName} is {@code null}, blank or empty, or 
could not be found,
      *             or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeDeclaredField(final Object target, final String 
fieldName, final Object value, final boolean forceAccess)
             throws IllegalAccessException {
@@ -641,6 +684,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank, empty, not {@code 
static}, or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not {@code public} or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeDeclaredStaticField(final Class<?> cls, final 
String fieldName, final Object value) throws IllegalAccessException {
         writeDeclaredStaticField(cls, fieldName, value, false);
@@ -664,6 +709,8 @@ public class FieldUtils {
      *             if the field name is {@code null}, blank, empty, not {@code 
static}, or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeDeclaredStaticField(final Class<?> cls, final 
String fieldName, final Object value, final boolean forceAccess)
             throws IllegalAccessException {
@@ -688,6 +735,8 @@ public class FieldUtils {
      *             if {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not accessible or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeField(final Field field, final Object target, 
final Object value) throws IllegalAccessException {
         writeField(field, target, value, false);
@@ -704,7 +753,7 @@ public class FieldUtils {
      *            to set
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @throws NullPointerException
      *             if the field is {@code null}
@@ -712,6 +761,8 @@ public class FieldUtils {
      *             if {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeField(final Field field, final Object target, 
final Object value, final boolean forceAccess)
             throws IllegalAccessException {
@@ -740,6 +791,8 @@ public class FieldUtils {
      *             or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeField(final Object target, final String fieldName, 
final Object value) throws IllegalAccessException {
         writeField(target, fieldName, value, false);
@@ -756,7 +809,7 @@ public class FieldUtils {
      *            to set
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @throws NullPointerException
      *             if {@code target} is {@code null}
@@ -765,6 +818,8 @@ public class FieldUtils {
      *             or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeField(final Object target, final String fieldName, 
final Object value, final boolean forceAccess)
             throws IllegalAccessException {
@@ -792,6 +847,8 @@ public class FieldUtils {
      *             not {@code static}, or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not {@code public} or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeStaticField(final Class<?> cls, final String 
fieldName, final Object value) throws IllegalAccessException {
         writeStaticField(cls, fieldName, value, false);
@@ -808,7 +865,7 @@ public class FieldUtils {
      *            to set
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @throws NullPointerException
      *             if {@code cls} is {@code null} or the field cannot be 
located
@@ -816,6 +873,8 @@ public class FieldUtils {
      *             if {@code fieldName} is {@code null}, blank or empty, the 
field not {@code static}, or {@code value} is not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeStaticField(final Class<?> cls, final String 
fieldName, final Object value, final boolean forceAccess)
             throws IllegalAccessException {
@@ -838,6 +897,8 @@ public class FieldUtils {
      *              if the field is not {@code static}, or {@code value} is 
not assignable
      * @throws IllegalAccessException
      *             if the field is not {@code public} or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeStaticField(final Field field, final Object value) 
throws IllegalAccessException {
         writeStaticField(field, value, false);
@@ -852,7 +913,7 @@ public class FieldUtils {
      *            to set
      * @param forceAccess
      *            whether to break scope restrictions using the
-     *            {@link 
java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code 
false} will only
+     *            {@link AccessibleObject#setAccessible(boolean)} method. 
{@code false} will only
      *            match {@code public} fields.
      * @throws NullPointerException
      *              if the field is {@code null}
@@ -860,6 +921,8 @@ public class FieldUtils {
      *              if the field is not {@code static}, or {@code value} is 
not assignable
      * @throws IllegalAccessException
      *             if the field is not made accessible or is {@code final}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static void writeStaticField(final Field field, final Object value, 
final boolean forceAccess) throws IllegalAccessException {
         Objects.requireNonNull(field, "field");
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java 
b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
index 1612e6034..c6ba44d68 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java
@@ -322,6 +322,8 @@ final class MemberUtils {
      *
      * @param obj the AccessibleObject to set as accessible, may be null.
      * @return a boolean indicating whether the accessibility of the object 
was set to true.
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     static <T extends AccessibleObject> T setAccessibleWorkaround(final T obj) 
{
         if (obj == null || obj.isAccessible()) {
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java 
b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
index f1b6e04c6..3685af926 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
@@ -263,19 +263,18 @@ public class MethodUtils {
      *            determines if underlying method has to be accessible
      * @return the first matching annotation, or {@code null} if not found
      * @throws NullPointerException if either the method or annotation class 
is {@code null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @since 3.6
      */
     public static <A extends Annotation> A getAnnotation(final Method method, 
final Class<A> annotationCls,
                                                          final boolean 
searchSupers, final boolean ignoreAccess) {
-
         Objects.requireNonNull(method, "method");
         Objects.requireNonNull(annotationCls, "annotationCls");
         if (!ignoreAccess && !MemberUtils.isAccessible(method)) {
             return null;
         }
-
         A annotation = method.getAnnotation(annotationCls);
-
         if (annotation == null && searchSupers) {
             final Class<?> mcls = method.getDeclaringClass();
             final List<Class<?>> classes = 
getAllSuperclassesAndInterfaces(mcls);
@@ -290,7 +289,6 @@ public class MethodUtils {
                 }
             }
         }
-
         return annotation;
     }
 
@@ -315,6 +313,8 @@ public class MethodUtils {
      * @param methodName find method with this name
      * @param parameterTypes find method with most compatible parameters
      * @return The accessible method
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Method getMatchingAccessibleMethod(final Class<?> cls,
         final String methodName, final Class<?>... parameterTypes) {
@@ -429,8 +429,10 @@ public class MethodUtils {
      * @param name the name of the method
      * @param parameterTypes the list of parameters
      * @return a Method or null.
-     * @since 3.15.0
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @see Class#getMethod(String, Class...)
+     * @since 3.15.0
      */
     public static Method getMethodObject(final Class<?> cls, final String 
name, final Class<?>... parameterTypes) {
         try {
@@ -528,6 +530,8 @@ public class MethodUtils {
      * @param interfacesBehavior whether to search interfaces, {@code null} 
{@code implies} false
      * @return a {@code Set<Method>} in ascending order from sub- to superclass
      * @throws NullPointerException if the specified method is {@code null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @since 3.2
      */
     public static Set<Method> getOverrideHierarchy(final Method method, final 
Interfaces interfacesBehavior) {
@@ -756,6 +760,8 @@ public class MethodUtils {
      * @throws NoSuchMethodException if there is no such accessible method
      * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
      * @throws IllegalAccessException if the requested method is not 
accessible via reflection
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @since 3.5
      */
     public static Object invokeMethod(final Object object, final boolean 
forceAccess, final String methodName)
@@ -783,6 +789,8 @@ public class MethodUtils {
      * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
      * @throws IllegalAccessException if the requested method is not 
accessible via reflection
      * @throws NullPointerException if the object or method name are {@code 
null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @since 3.5
      */
     public static Object invokeMethod(final Object object, final boolean 
forceAccess, final String methodName,
@@ -809,6 +817,8 @@ public class MethodUtils {
      * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
      * @throws IllegalAccessException if the requested method is not 
accessible via reflection
      * @throws NullPointerException if the object or method name are {@code 
null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      * @since 3.5
      */
     public static Object invokeMethod(final Object object, final boolean 
forceAccess, final String methodName, Object[] args, Class<?>[] parameterTypes)
@@ -855,8 +865,9 @@ public class MethodUtils {
      * @throws NoSuchMethodException if there is no such accessible method
      * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
      * @throws IllegalAccessException if the requested method is not 
accessible via reflection
-     *
-     *  @since 3.4
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
+     * @since 3.4
      */
     public static Object invokeMethod(final Object object, final String 
methodName) throws NoSuchMethodException,
             IllegalAccessException, InvocationTargetException {
@@ -884,6 +895,8 @@ public class MethodUtils {
      * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
      * @throws IllegalAccessException if the requested method is not 
accessible via reflection
      * @throws NullPointerException if the object or method name are {@code 
null}
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object invokeMethod(final Object object, final String 
methodName,
             Object... args) throws NoSuchMethodException,
@@ -909,6 +922,8 @@ public class MethodUtils {
      * @throws NoSuchMethodException if there is no such accessible method
      * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
      * @throws IllegalAccessException if the requested method is not 
accessible via reflection
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object invokeMethod(final Object object, final String 
methodName,
             final Object[] args, final Class<?>[] parameterTypes)
@@ -935,10 +950,10 @@ public class MethodUtils {
      * @param args use these arguments - treat {@code null} as empty array
      * @return The value returned by the invoked method
      * @throws NoSuchMethodException if there is no such accessible method
-     * @throws InvocationTargetException wraps an exception thrown by the
-     *  method invoked
-     * @throws IllegalAccessException if the requested method is not accessible
-     *  via reflection
+     * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
+     * @throws IllegalAccessException if the requested method is not 
accessible via reflection
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object invokeStaticMethod(final Class<?> cls, final String 
methodName,
             Object... args) throws NoSuchMethodException,
@@ -962,10 +977,10 @@ public class MethodUtils {
      * @param parameterTypes match these parameters - treat {@code null} as 
empty array
      * @return The value returned by the invoked method
      * @throws NoSuchMethodException if there is no such accessible method
-     * @throws InvocationTargetException wraps an exception thrown by the
-     *  method invoked
-     * @throws IllegalAccessException if the requested method is not accessible
-     *  via reflection
+     * @throws InvocationTargetException wraps an exception thrown by the 
method invoked
+     * @throws IllegalAccessException if the requested method is not 
accessible via reflection
+     * @throws SecurityException if an underlying accessible object's method 
denies the request.
+     * @see SecurityManager#checkPermission
      */
     public static Object invokeStaticMethod(final Class<?> cls, final String 
methodName,
             Object[] args, Class<?>[] parameterTypes)


Reply via email to