[FEATURE] Support createHackLookupNative

This commit is contained in:
Gravita 2023-11-26 20:51:58 +07:00
parent 380179faa3
commit 43626bf1f4

View file

@ -7,8 +7,13 @@
import java.util.function.Consumer; import java.util.function.Consumer;
public class HackHelper { public class HackHelper {
private static native MethodHandles.Lookup createHackLookupNative(Class<?> lookupClass);
private static MethodHandles.Lookup createHackLookupImpl(Class<?> lookupClass) { private static MethodHandles.Lookup createHackLookupImpl(Class<?> lookupClass) {
try {
return createHackLookupNative(lookupClass);
} catch (Throwable ignored) {
}
try { try {
Field trusted = MethodHandles.Lookup.class.getDeclaredField("TRUSTED"); Field trusted = MethodHandles.Lookup.class.getDeclaredField("TRUSTED");
trusted.setAccessible(true); trusted.setAccessible(true);