git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1562880 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
82664d556c
commit
42ef7d6bc8
|
@ -671,11 +671,11 @@ public class FieldUtils {
|
|||
* @throws IllegalArgumentException
|
||||
* if the field is {@code null}
|
||||
*/
|
||||
public static void removeFinalModifier(Field field) {
|
||||
public static void removeFinalModifier(Field field) {
|
||||
Validate.isTrue(field != null, "The field must not be null");
|
||||
|
||||
try {
|
||||
if(Modifier.isFinal(field.getModifiers())){
|
||||
if (Modifier.isFinal(field.getModifiers())) {
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
|
|
Loading…
Reference in New Issue