Class ReflectUtil
- java.lang.Object
-
- net.runelite.client.util.ReflectUtil
-
public class ReflectUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ReflectUtil.PrivateLookupableClassLoader
static class
ReflectUtil.PrivateLookupHelper
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
installLookupHelper(ReflectUtil.PrivateLookupableClassLoader cl)
Allows private Lookups to be created for classes in this ClassLoaderstatic void
invalidateAnnotationCaches()
static MethodHandles.Lookup
privateLookupIn(Class<?> clazz)
static void
queueInjectorAnnotationCacheInvalidation(com.google.inject.Injector injector)
-
-
-
Method Detail
-
privateLookupIn
public static MethodHandles.Lookup privateLookupIn(Class<?> clazz)
-
installLookupHelper
public static void installLookupHelper(ReflectUtil.PrivateLookupableClassLoader cl)
Allows private Lookups to be created for classes in this ClassLoaderDue to JDK-8173978 it is impossible to create get a lookup with module scoped permissions when teleporting between modules. Since external plugins are loaded in a separate classloader to us they are contained in unique unnamed modules. Since we (via LambdaMetafactory) are creating a hidden class in that module, we require module scoped access to it, and since the methods can be private, we also require private access. The only way to get MODULE|PRIVATE is to either 1) invokedynamic in that class, 2) call MethodHandles.lookup() from that class, or 3) call privateLookupIn with an existing lookup with PRIVATE|MODULE created from a class in the same module. Our solution is to make classloaders call this method which will define a class in the classloader's unnamed module that calls MethodHandles.lookup() and stores it in the classloader for later use.
-
queueInjectorAnnotationCacheInvalidation
public static void queueInjectorAnnotationCacheInvalidation(com.google.inject.Injector injector)
-
invalidateAnnotationCaches
public static void invalidateAnnotationCaches()
-
-