sad because java reflection is more protected :C

This commit is contained in:
2022-07-28 02:48:19 +02:00
parent 0a558c6b83
commit c45b501ed8
2 changed files with 8 additions and 1 deletions

View File

@@ -27,7 +27,11 @@ public final class ReflectField<T> extends ReflectMember<T, String, Field, NoSuc
}
try {
modifiersFieldInFieldClass = Reflect.ofClass(Field.class).filteredField("modifiers").get();
@SuppressWarnings("deprecation")
Field f = Runtime.version().feature() < 16
? Reflect.ofClass(Field.class).filteredField("modifiers").get()
: null;
modifiersFieldInFieldClass = f;
} catch (Exception e) {
RuntimeException newEx = new RuntimeException("Cannot access " + Field.class + ".modifiers field.", e);
if (ex != null)