Interface ITypeManifold

All Superinterfaces:
IFileConnected, ISelfCompiled
All Known Implementing Classes:
JavaTypeManifold, ResourceFileTypeManifold, UrlTypeManifold

public interface ITypeManifold extends IFileConnected, ISelfCompiled
A ITypeManifold is a fundamental component of the Manifold API. Implementors of this interface work together to dynamically provide the Java compiler with type information as it requests it.

Its primary duties include:

  • Define a domain of types via getTypeNames(String)
  • Resolve types in that domain via isType(String), isTopLevelType(String), and isPackage(String)
  • Contribute source toward a given type projection via contribute(JavaFileManager.Location, String, boolean, String, DiagnosticListener)
  • Separate instances of a given implementation of this interface exist per IModule.

    • Field Details

      • ARG_DUMP_SOURCE

        static final String ARG_DUMP_SOURCE
        System property to aid in debugging generated source.
        See Also:
    • Method Details

      • accept

        default boolean accept(IModule module)
        A module calls this method to determine whether to include this type manifold in its collection of type manifolds. Gives this type manifold an opportunity to opt out of inclusion based on the module. For instance, if a module should only operate in a runtime environment, it should return false if the module's host is not an instance of IRuntimeManifoldHost.

        Called after instantiation and, if returns true, before init(IModule).

        Parameters:
        module - The module asking for acceptance
        Returns:
        true If this type manifold should be initialized and included in the module, otherwise false to be discarded.
      • init

        void init(IModule module)
        Initialize this type manifold. Avoid defining types in the scope of this method.
        Parameters:
        module - The module to which this type manifold exclusively belongs
      • getModule

        IModule getModule()
        The module to which this producer is scoped
      • getSourceKind

        ISourceKind getSourceKind()
        What kind of source is produced? Java?
      • getContributorKind

        ContributorKind getContributorKind()
        How does this producer contribute toward the source file produced
      • isType

        boolean isType(String fqn)
        Does this producer supply source for the specified fqn?
      • isTopLevelType

        boolean isTopLevelType(String fqn)
      • isPackage

        boolean isPackage(String pkg)
        Verifies whether or not the specified package may be provided by this source producer
      • getClassType

        ClassType getClassType(String fqn)
        What kind of type corresponds with fqn?
      • getPackage

        String getPackage(String fqn)
        What is the package name for the specified fqn?
      • contribute

        String contribute(JavaFileManager.Location location, String fqn, boolean genStubs, String existing, DiagnosticListener<JavaFileObject> errorHandler)
        Contribute source corresponding with the fqn.
      • getAllTypeNames

        Collection<String> getAllTypeNames()
      • getTypeNames

        Collection<TypeName> getTypeNames(String namespace)
      • findFilesForType

        List<IFile> findFilesForType(String fqn)
      • clear

        void clear()
        Clear all cached data
      • enterPostJavaCompilation

        default void enterPostJavaCompilation()
        Signals that normal javac compilation is complete with respect to the supplied Java source file list passed to javac. Any "other" source files passed in (via other.source.files property using -Akey=value arg) are about to be compiled. This method was added to facilitate a self-compiled type manifold such as Gosu where it can reliably depend on Java ClassSymbols to be complete from the JavacPlugin's javacTask. This in turn enables the sharing of these symbols so the type manifold doesn't have to load a second javacTask and potentially duplicate expensive work.