Class ClassResourceClassInformationRepository
- java.lang.Object
-
- com.offbynull.coroutines.instrumenter.asm.ClassResourceClassInformationRepository
-
- All Implemented Interfaces:
ClassInformationRepository
public final class ClassResourceClassInformationRepository extends java.lang.Object implements ClassInformationRepository
Provides information on classes contained within aClassLoader
. The difference between this class andClassLoaderClassInformationRepository
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 asFileSystemClassInformationRepository
.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). IfClassFileTransformer.transform(java.lang.ClassLoader, java.lang.String, java.lang.Class, java.security.ProtectionDomain, byte[])
callsClass.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:
ClassLoaderClassInformationRepository
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ClassLoader
classLoader
-
Constructor Summary
Constructors Constructor Description ClassResourceClassInformationRepository(java.lang.ClassLoader classLoader)
Constructs aClassLoaderClassInformationRepository
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassInformation
getInformation(java.lang.String internalClassName)
Get information for a class.
-
-
-
Constructor Detail
-
ClassResourceClassInformationRepository
public ClassResourceClassInformationRepository(java.lang.ClassLoader classLoader)
Constructs aClassLoaderClassInformationRepository
object.- Parameters:
classLoader
- classloader to extract information from- Throws:
java.lang.NullPointerException
- if any argument isnull
-
-
Method Detail
-
getInformation
public ClassInformation getInformation(java.lang.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 whatClass.getSuperclass()
returns when the class represents an interface (it returnsnull
).- Specified by:
getInformation
in interfaceClassInformationRepository
- Parameters:
internalClassName
- internal class name- Returns:
- information for that class, or
null
if not found
-
-