Interface SummaryClassShellLoader

All Superinterfaces:
IClassLoader
All Known Implementing Classes:
BypassSyntheticClassLoader, CAstAbstractModuleLoader, JavaScriptLoader

public interface SummaryClassShellLoader extends IClassLoader
A capability, implemented by class loaders that can introduce "shell" classes for types modeled only by a summary, so that source classes subclassing such a type can resolve their base at definition time rather than falling back to the language root.

This exists because a class resolves its superclass through its own loader; a summary-modeled framework base materialized late (and in the BypassSyntheticClassLoader) is invisible to a source subclass at class-hierarchy-build time. Loaders that own a mutable set of classes (the BypassSyntheticClassLoader and the CAst module loaders) can instead register a shell eagerly, before the hierarchy is built. See #1957.

See Also:
  • Method Details

    • defineSummaryClassShell

      IClass defineSummaryClassShell(TypeName name, TypeName superName)
      Register a shell IClass for a summary-modeled type, so that classes loaded by this loader can resolve it as a superclass.

      Idempotent: if a class is already registered under name, it is returned unchanged.

      Parameters:
      name - the type to register a shell for
      superName - the shell's superclass, or null for this loader's language root type
      Returns:
      the registered (or pre-existing) class
    • defineSummaryClassShell

      default IClass defineSummaryClassShell(TypeName name, TypeName superName, Collection<MethodSummary> methods)
      Register a shell IClass that also exposes the given method summaries as its own declared methods, so that a walk of the shell (e.g. when resolving an inherited method on a subclass) finds them. The method bodies are still bound late by the usual bypass mechanism; only the declarations need to exist on the shell.

      The default implementation ignores methods and delegates to defineSummaryClassShell(TypeName, TypeName); implementations whose shells can carry methods (such as the BypassSyntheticClassLoader) override this.

      Parameters:
      name - the type to register a shell for
      superName - the shell's superclass, or null for this loader's language root type
      methods - summaries for the methods the shell should declare
      Returns:
      the registered (or pre-existing) class