Class SandboxClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.robolectric.internal.bytecode.SandboxClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
AndroidSandbox.SdkSandboxClassLoader
public class SandboxClassLoader extends URLClassLoader
Class loader that modifies the bytecode of Android classes to insert calls to Robolectric's
shadow classes.
-
Constructor Summary
Constructors Constructor Description SandboxClassLoader(ClassLoader erstwhileClassLoader, InstrumentationConfiguration config, ResourceProvider resourceProvider, ClassInstrumentor classInstrumentor)
SandboxClassLoader(InstrumentationConfiguration config, ResourceProvider resourceProvider, ClassInstrumentor classInstrumentor)
-
Method Summary
Modifier and Type Method Description protected byte[]
getByteCode(String className)
URL
getResource(String name)
Class<?>
loadClass(String name, boolean resolve)
protected Class<?>
maybeInstrumentClass(String className)
protected byte[]
postProcessUninstrumentedClass(ClassDetails classDetails)
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
SandboxClassLoader
@Inject public SandboxClassLoader(InstrumentationConfiguration config, ResourceProvider resourceProvider, ClassInstrumentor classInstrumentor) -
SandboxClassLoader
public SandboxClassLoader(ClassLoader erstwhileClassLoader, InstrumentationConfiguration config, ResourceProvider resourceProvider, ClassInstrumentor classInstrumentor)
-
-
Method Details
-
getResource
- Overrides:
getResource
in classClassLoader
-
loadClass
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
maybeInstrumentClass
- Throws:
ClassNotFoundException
-
postProcessUninstrumentedClass
-
getByteCode
- Throws:
ClassNotFoundException
-