fix ReflectField
This commit is contained in:
parent
f7dc774dbd
commit
0a558c6b83
@ -9,6 +9,9 @@ import java.lang.reflect.Modifier;
|
|||||||
*/
|
*/
|
||||||
public final class ReflectField<T> extends ReflectMember<T, String, Field, NoSuchFieldException> {
|
public final class ReflectField<T> extends ReflectMember<T, String, Field, NoSuchFieldException> {
|
||||||
|
|
||||||
|
/* Those fields are used to modify the value of a static variable. Depending of the current Java version,
|
||||||
|
* one of them whill be used for this purpose.
|
||||||
|
*/
|
||||||
private static sun.misc.Unsafe sunMiscUnsafeInstance;
|
private static sun.misc.Unsafe sunMiscUnsafeInstance;
|
||||||
private static Field modifiersFieldInFieldClass;
|
private static Field modifiersFieldInFieldClass;
|
||||||
static {
|
static {
|
||||||
@ -24,7 +27,7 @@ public final class ReflectField<T> extends ReflectMember<T, String, Field, NoSuc
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
modifiersFieldInFieldClass = Reflect.ofClass(Field.class).field("modifiers").fetchFiltered();
|
modifiersFieldInFieldClass = Reflect.ofClass(Field.class).filteredField("modifiers").get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
RuntimeException newEx = new RuntimeException("Cannot access " + Field.class + ".modifiers field.", e);
|
RuntimeException newEx = new RuntimeException("Cannot access " + Field.class + ".modifiers field.", e);
|
||||||
if (ex != null)
|
if (ex != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user