Method Detail

classInitializing

Called by Robolectric when an instrumented class is first loaded into a sandbox and is ready to be statically initialized.

This happens in place of any static initialization that may be performed by the class being loaded. The class will have a method named __staticInitializer__ which may be invoked to perform its normal initialization from <clinit>.

getShadowCreator

Called by Robolectric to determine how to create and initialize a shadow object when a new instance of an instrumented class has been instantiated. (but only on JVMs which support the invokedynamic instruction).

The returned MethodHandle will be invoked after the new object has been allocated but before its constructor code is executed.

Note that this is not directly analogous to initializing(Object); the return value from this method will be cached and used again for other instantiations of instances of the same class.

intercept

Unlike instrumented methods, calls to intercepted methods are modified in place by Robolectric in the calling code. This is useful when the method about to be invoked doesn’t exist in the current JVM (e.g. because of Android differences).

Parameters:

signature - the JVM internal-format signature of the method being invoked (e.g. android/view/View/measure(II)V)