Interface ISelfCompiled

All Known Subinterfaces:
ITypeManifold
All Known Implementing Classes:
JavaTypeManifold, ResourceFileTypeManifold, UrlTypeManifold

public interface ISelfCompiled
A self-compiled type manifold provides its own Java bytecode for some or all of its types. Thus, its implementation of ITypeManifold.contribute(JavaFileManager.Location, String, boolean, String, DiagnosticListener) is typically a stub limited to member declarations. So, instead of using javac to compile your source to disk, you use it to parse your stub to allow other types to make references to your type. But the bytecode for your type comes from your implementation of compile(String).
  • Method Summary

    Modifier and Type
    Method
    Description
    default byte[]
    Instructs a self-compiling type manifold to compile fqn and return resulting Java byte-code.
    default boolean
    Tests if a type fqn is self-compiled where subsequent calls to parse(String) and compile(String) are necessary to compile the type to bytecode.
    default void
    Signal this type manifold to fully parse the type corresponding with fqn and attach parse errors/warnings to the source file, for example using IssueReporter<JavaFileObject>.
  • Method Details

    • isSelfCompile

      default boolean isSelfCompile(String fqn)
      Tests if a type fqn is self-compiled where subsequent calls to parse(String) and compile(String) are necessary to compile the type to bytecode.

      Parameters:
      fqn - The fully qualified name of the type.
      Returns:
      true if the type corresponding with fqn is self-compiled.
    • parse

      default void parse(String fqn)
      Signal this type manifold to fully parse the type corresponding with fqn and attach parse errors/warnings to the source file, for example using IssueReporter<JavaFileObject>.

      For instance, the Gosu language manifold has its own bytecode compiler and handles this call by fully parsing fqn. Note this call is made immediately before the Java compiler's attribution phase, which makes it ok for member definitions and such to fully resolve.

      Parameters:
      fqn - The fully qualified name of the type to parse.
    • compile

      default byte[] compile(String fqn)
      Instructs a self-compiling type manifold to compile fqn and return resulting Java byte-code. Note this call is only made if no errors were attached during parse(String).
      Parameters:
      fqn - The fully qualified name of the type to compile.