Interface CurvedSpacetimeLoader

All Known Implementing Classes:
CurvedSpacetimeLoaderClosedLoader, CurvedSpacetimeLoaderQuiltLoader

public interface CurvedSpacetimeLoader
Discovers modules and resolves their entrypoints on the engine's behalf.

An implementation is free to resolve entrypoints however it likes. The closed-world loader holds them in static tables so that GraalVM native-image can reach them by ordinary static analysis; the Quilt loader delegates to Quilt Loader, which discovers them dynamically. Neither strategy is privileged by this interface.

Implementations must satisfy requirements R6 through R11 of the Module System Specification.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the engine this loader was prepared with.
    <E> List<E>
    getEntrypoints(String name, Class<E> moduleInitializerClass)
    Returns every entrypoint registered under the given name whose runtime type is assignable to moduleInitializerClass.
    <E> void
    invokeEntrypoints(String name, Class<E> moduleInitializerClass, Consumer<? super E> moduleInitializerConsumer)
    Applies the given consumer to every entrypoint getEntrypoints(String, Class) would return for the same arguments.
    void
    prepareModInit(Path path, Object engine)
    Prepares this loader for module initialization.
  • Method Details

    • prepareModInit

      void prepareModInit(Path path, Object engine)
      Prepares this loader for module initialization.

      The engine calls this exactly once, before invoking any entrypoint. An implementation must retain engine such that getEngine() returns it thereafter.

      Parameters:
      path - the run directory modules resolve their resources against
      engine - the engine driving initialization
    • getEntrypoints

      <E> List<E> getEntrypoints(String name, Class<E> moduleInitializerClass)
      Returns every entrypoint registered under the given name whose runtime type is assignable to moduleInitializerClass.

      An implementation returns the same instances across repeated calls within one run. The dependency handshake relies on that: a dependent locates its own main entrypoint by filtering this list, then transfers to the queue owned by that exact object.

      Type Parameters:
      E - the entrypoint type
      Parameters:
      name - the entrypoint name, such as main
      moduleInitializerClass - the type registered entrypoints must be assignable to
      Returns:
      the matching entrypoints, empty when the name is recognised but nothing is registered
      Throws:
      IllegalArgumentException - if the entrypoint name is not recognised
    • invokeEntrypoints

      <E> void invokeEntrypoints(String name, Class<E> moduleInitializerClass, Consumer<? super E> moduleInitializerConsumer)
      Applies the given consumer to every entrypoint getEntrypoints(String, Class) would return for the same arguments.

      No ordering is imposed, and callers must not depend on one.

      Type Parameters:
      E - the entrypoint type
      Parameters:
      name - the entrypoint name, such as main
      moduleInitializerClass - the type registered entrypoints must be assignable to
      moduleInitializerConsumer - the action to apply to each entrypoint
      Throws:
      IllegalArgumentException - if the entrypoint name is not recognised
    • getEngine

      Object getEngine()
      Returns the engine this loader was prepared with.
      Returns:
      the engine passed to prepareModInit(Path, Object), or null before that call