Class ClassResourceClassInformationRepository

java.lang.Object
com.offbynull.coroutines.instrumenter.asm.ClassResourceClassInformationRepository
All Implemented Interfaces:
ClassInformationRepository

public final class ClassResourceClassInformationRepository extends Object implements ClassInformationRepository
Provides information on classes contained within a ClassLoader. The difference between this class and ClassLoaderClassInformationRepository is that this class loads the class as a resource (byte array) instead of actually loading the class in to the JVM. Parsing of the resource is done the same way as FileSystemClassInformationRepository.

This is an attempt to work around the issue with loading classes and ClassFileTransformer (something we need to do for resolving stack map frames after instrumenting the class). If ClassFileTransformer.transform(java.lang.ClassLoader, java.lang.String, java.lang.Class, java.security.ProtectionDomain, byte[]) calls Class.forName(java.lang.String) for a class that hasn't been passed to that transformer yet, that class will never get passed to that transformer.

As a work-around, we load the class bytes and parse that rather than loading the actual class.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getInformation

      public ClassInformation getInformation(String internalClassName)
      Description copied from interface: ClassInformationRepository
      Get information for a class.

      This method returns class information as if it were encountered in a class file. In a class file, if the class is an interface, then its superclass is set to Object. Note that this is different from what Class.getSuperclass() returns when the class represents an interface (it returns null).

      Specified by:
      getInformation in interface ClassInformationRepository
      Parameters:
      internalClassName - internal class name
      Returns:
      information for that class, or null if not found