Class ClassResourceClassInformationRepository
- All Implemented Interfaces:
ClassInformationRepository
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClassResourceClassInformationRepository(ClassLoader classLoader) Constructs aClassLoaderClassInformationRepositoryobject. -
Method Summary
Modifier and TypeMethodDescriptiongetInformation(String internalClassName) Get information for a class.
-
Field Details
-
classLoader
-
-
Constructor Details
-
ClassResourceClassInformationRepository
Constructs aClassLoaderClassInformationRepositoryobject.- Parameters:
classLoader- classloader to extract information from- Throws:
NullPointerException- if any argument isnull
-
-
Method Details
-
getInformation
Description copied from interface:ClassInformationRepositoryGet 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:
getInformationin interfaceClassInformationRepository- Parameters:
internalClassName- internal class name- Returns:
- information for that class, or
nullif not found
-