mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-15 13:44:45 +00:00
shuffle classes around
This commit is contained in:
10 files changed
+36
-53
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package com.falsepattern.lib.util;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
public class ReflectionUtil {
|
||||
private static final Field f_modifiers;
|
||||
static {
|
||||
try {
|
||||
f_modifiers = Field.class.getDeclaredField("modifiers");
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
f_modifiers.setAccessible(true);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void jailBreak(Field field) {
|
||||
field.setAccessible(true);
|
||||
f_modifiers.set(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
}
|
||||
|
||||
public static void jailBreak(Method method) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user