Class DefaultNativeRuntimeLoader

java.lang.Object
org.robolectric.nativeruntime.DefaultNativeRuntimeLoader
All Implemented Interfaces:
NativeRuntimeLoader

@AutoService(NativeRuntimeLoader.class) @Priority(-2147483648) public class DefaultNativeRuntimeLoader extends Object implements NativeRuntimeLoader
Loads the Robolectric native runtime.
  • Field Details

    • loaded

      protected static final AtomicBoolean loaded
    • METHOD_BINDING_FORMAT

      protected static final String METHOD_BINDING_FORMAT
      See Also:
    • CORE_CLASS_NATIVES

      protected static final com.google.common.collect.ImmutableList<String> CORE_CLASS_NATIVES
    • GRAPHICS_CLASS_NATIVES

      protected static final com.google.common.collect.ImmutableList<String> GRAPHICS_CLASS_NATIVES
    • DEFERRED_STATIC_INITIALIZERS

      protected static final com.google.common.collect.ImmutableList<String> DEFERRED_STATIC_INITIALIZERS
      DEFERRED_STATIC_INITIALIZERS that invoke their own native methods in static initializers. Unlike libcore, registering JNI on the JVM causes static initialization to be performed on the class. Because of this, static initializers cannot invoke the native methods of the class under registration. Executing these static initializers must be deferred until after JNI has been registered.
  • Constructor Details

    • DefaultNativeRuntimeLoader

      public DefaultNativeRuntimeLoader()
  • Method Details

    • injectAndLoad

      public static void injectAndLoad()
    • maybeCopyExtraResources

      protected void maybeCopyExtraResources(TempDirectory dir)
      Overridable in Android, due to private resources.
    • getCoreClassNatives

      protected List<String> getCoreClassNatives()
      Overridable in Android, due to changing shadows in private branches.
    • getDeferredStaticInitializers

      protected List<String> getDeferredStaticInitializers()
      Overridable in Android, due to changing shadows in private branches.
    • getGraphicsNatives

      protected List<String> getGraphicsNatives()
      Overridable in Android, due to changing shadows in private branches.
    • ensureLoaded

      public void ensureLoaded()
      Specified by:
      ensureLoaded in interface NativeRuntimeLoader
    • libraryName

      protected static String libraryName()
    • invokeDeferredStaticInitializers

      protected void invokeDeferredStaticInitializers()