This commit is contained in:
Basil Crow 2025-07-30 12:09:40 -07:00
parent fcaeb1ddfd
commit 8c83f18d60
1 changed files with 1 additions and 6 deletions

View File

@ -44,14 +44,9 @@ public final class FieldUtils {
public static void setProtectedFieldValue(String protectedField, Object object, Object newValue) {
try {
// acgegi would silently fail to write to final fields
// FieldUtils.writeField(Object, field, true) only sets accessible on *non* public fields
// and then fails with IllegalAccessException (even if you make the field accessible in the interim!
// for backwards compatability we need to use a few steps
Field field = getField(object.getClass(), protectedField);
field.setAccessible(true);
field.set(object, newValue);
} catch (Exception x) {
} catch (IllegalAccessException x) {
throw new RuntimeException(x);
}
}