Class CachedClassfiles
java.lang.Object
mockit.internal.state.CachedClassfiles
- All Implemented Interfaces:
ClassFileTransformer
Holds a map of internal class names to the corresponding class files (bytecode arrays), for the classes that have
already been loaded during the test run. These classfiles are not necessarily the same as those stored in the
corresponding ".class" files available from the runtime classpath. If any third-party
ClassFileTransformers
are active, those original classfiles may have been modified before being loaded by the JVM. JMockit installs a
ClassFileTransformer of its own which saves all potentially modified classfiles here.
This bytecode cache allows classes to be mocked and un-mocked correctly, even in the presence of other bytecode modification agents such as the AspectJ load-time weaver.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddClassfile(Class<?> aClass, byte[] classfile) static byte[]getClassfile(Class<?> aClass) static byte[]getClassfile(ClassLoader loader, String internalClassName) static byte[]getClassfile(String classDesc) byte[]transform(ClassLoader loader, String classDesc, Class<?> classBeingRedefinedOrRetransformed, ProtectionDomain protectionDomain, byte[] classfileBuffer) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClassFileTransformer
transform
-
Field Details
-
INSTANCE
-
-
Method Details
-
transform
@Nullable public byte[] transform(@Nullable ClassLoader loader, String classDesc, @Nullable Class<?> classBeingRedefinedOrRetransformed, @Nullable ProtectionDomain protectionDomain, @NonNull byte[] classfileBuffer) - Specified by:
transformin interfaceClassFileTransformer
-
getClassfile
-
getClassfile
-
getClassfile
@Nullable public static byte[] getClassfile(@Nullable ClassLoader loader, @NonNull String internalClassName) -
addClassfile
-