Package org.aoju.bus.core.lang.reflect
Class LookupFactory
java.lang.Object
org.aoju.bus.core.lang.reflect.LookupFactory
MethodHandles.Lookup工厂,用于创建MethodHandles.Lookup对象
jdk8中如果直接调用MethodHandles.lookup()获取到的MethodHandles.Lookup在调用findSpecial和unreflectSpecial
时会出现权限不够问题,抛出"no private access for invokespecial"异常,因此针对JDK8及JDK9+分别封装lookup方法。- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MethodHandles.Lookupjdk8中如果直接调用MethodHandles.lookup()获取到的MethodHandles.Lookup在调用findSpecial和unreflectSpecial 时会出现权限不够问题,抛出"no private access for invokespecial"异常,因此针对JDK8及JDK9+分别封装lookup方法。
-
Constructor Details
-
LookupFactory
public LookupFactory()
-
-
Method Details
-
lookup
jdk8中如果直接调用MethodHandles.lookup()获取到的MethodHandles.Lookup在调用findSpecial和unreflectSpecial 时会出现权限不够问题,抛出"no private access for invokespecial"异常,因此针对JDK8及JDK9+分别封装lookup方法。- Parameters:
callerClass- 被调用的类或接口- Returns:
MethodHandles.Lookup
-