Class ReflectUtil

  • public class ReflectUtil
    extends Object
    • Method Detail

      • installLookupHelper

        public static void installLookupHelper​(ReflectUtil.PrivateLookupableClassLoader cl)
        Allows private Lookups to be created for classes in this ClassLoader

        Due 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​( injector)
      • invalidateAnnotationCaches

        public static void invalidateAnnotationCaches()