Class ReflectionWorld

java.lang.Object
org.aspectj.weaver.World
org.aspectj.weaver.reflect.ReflectionWorld
All Implemented Interfaces:
Dump.INode, IReflectionWorld

public class ReflectionWorld extends World implements IReflectionWorld
A ReflectionWorld is used solely for purposes of type resolution based on the runtime classpath (java.lang.reflect). It does not support weaving operations (creation of mungers etc..).
Author:
Adrian Colyer, Andy Clement
  • Constructor Details

    • ReflectionWorld

      public ReflectionWorld(WeakClassLoaderReference classloaderRef)
    • ReflectionWorld

      public ReflectionWorld(ClassLoader aClassLoader)
    • ReflectionWorld

      public ReflectionWorld(boolean forceUseOf14Delegates, ClassLoader aClassLoader)
  • Method Details

    • getReflectionWorldFor

      public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference)
    • cleanUpWorlds

      public static void cleanUpWorlds()
    • makeAnnotationFinderIfAny

      public static AnnotationFinder makeAnnotationFinderIfAny(ClassLoader loader, World world)
    • getClassLoader

      public ClassLoader getClassLoader()
    • getAnnotationFinder

      public AnnotationFinder getAnnotationFinder()
      Specified by:
      getAnnotationFinder in interface IReflectionWorld
    • resolve

      public ResolvedType resolve(Class aClass)
      Specified by:
      resolve in interface IReflectionWorld
    • resolve

      public static ResolvedType resolve(World world, Class<?> aClass)
    • resolveUsingClass

      public ResolvedType resolveUsingClass(Class<?> clazz)
      Resolve a type using the specified class. Normal resolution in a reflection world uses Class.forName() via the classloader (attached to this world) in order to find a named type then builds a reference type and a reference type delegate based on that. For some classes generated at runtime (e.g. proxy or lambda representation) the forName() call will not work. In those situations we should just use the clazz we have. Should the whole thing switch from using forName() to using the clazz objects? Possibly but that introduces a lot of change and we don't have a lot of test coverage for this scenario (reflection world). What we are doing right now is that this can optionally be used if the regular resolution scheme did not work. Although AspectJ is *not* multi threaded or re-entrant, Spring doesn't always respect that. There might be an issue here if two attempts are made to resolve the same thing at the same time via this method.
      Parameters:
      clazz - the class to use as the delegate for the resolved type
    • resolveDelegate

      protected ReferenceTypeDelegate resolveDelegate(ReferenceType ty)
      Description copied from class: World
      Find the ReferenceTypeDelegate behind this reference type so that it can fulfill its contract.
      Specified by:
      resolveDelegate in class World
    • getWeavingSupport

      public IWeavingSupport getWeavingSupport()
      Specified by:
      getWeavingSupport in class World
    • isLoadtimeWeaving

      public boolean isLoadtimeWeaving()
      Specified by:
      isLoadtimeWeaving in class World