【游戏服务器Util】 提高反射的速度

Constructor<?> constr = targetClass.getDeclaredConstructor();
constr.setAccessible(true);
Object inst = constr.newInstance();

Accessable属性是继承自AccessibleObject 类. 功能是启用或禁用安全检查

使用了method.setAccessible(true)后会大幅提升性能

你可能感兴趣的:(【游戏服务器Util】 提高反射的速度)