mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-30 20:39:10 +00:00
perf(bukkit): 反射性能优化
This commit is contained in:
@@ -512,6 +512,15 @@ public class ReflectionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static MethodHandle unreflectConstructor(Constructor<?> constructor) throws IllegalAccessException {
|
||||
try {
|
||||
return LOOKUP.unreflectConstructor(constructor);
|
||||
} catch (IllegalAccessException e) {
|
||||
constructor.setAccessible(true);
|
||||
return LOOKUP.unreflectConstructor(constructor);
|
||||
}
|
||||
}
|
||||
|
||||
public static VarHandle findVarHandle(Class<?> clazz, String name, Class<?> type) {
|
||||
try {
|
||||
return MethodHandles.privateLookupIn(clazz, LOOKUP)
|
||||
|
||||
Reference in New Issue
Block a user