removeFinalModifier does not clean up after itself.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1562985 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c8822657d
commit
c79f82491a
|
@ -680,7 +680,11 @@ public class FieldUtils {
|
||||||
if (Modifier.isFinal(field.getModifiers())) {
|
if (Modifier.isFinal(field.getModifiers())) {
|
||||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||||
modifiersField.setAccessible(true);
|
modifiersField.setAccessible(true);
|
||||||
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
try {
|
||||||
|
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||||
|
} finally {
|
||||||
|
modifiersField.setAccessible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException ignored) {
|
} catch (NoSuchFieldException ignored) {
|
||||||
// The field class contains always a modifiers field
|
// The field class contains always a modifiers field
|
||||||
|
|
Loading…
Reference in New Issue