Package manifold.api.type
Interface ISelfCompiled
-
- All Known Subinterfaces:
ITypeManifold
- All Known Implementing Classes:
JavaTypeManifold,ResourceFileTypeManifold,UrlTypeManifold
public interface ISelfCompiledA self-compiled type manifold provides its own Java bytecode for some or all of its types. Thus, its implementation ofITypeManifold.contribute(javax.tools.JavaFileManager.Location, java.lang.String, boolean, java.lang.String, javax.tools.DiagnosticListener<javax.tools.JavaFileObject>)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 ofcompile(String).
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default byte[]compile(String fqn)Instructs a self-compiling type manifold to compilefqnand return resulting Java byte-code.default booleanisSelfCompile(String fqn)Tests if a typefqnis self-compiled where subsequent calls toparse(String)andcompile(String)are necessary to compile the type to bytecode.default voidparse(String fqn)Signal this type manifold to fully parse the type corresponding withfqnand attach parse errors/warnings to the source file, for example usingIssueReporter<JavaFileObject>.
-
-
-
Method Detail
-
isSelfCompile
default boolean isSelfCompile(String fqn)
Tests if a typefqnis self-compiled where subsequent calls toparse(String)andcompile(String)are necessary to compile the type to bytecode.- Parameters:
fqn- The fully qualified name of the type.- Returns:
trueif the type corresponding withfqnis self-compiled.
-
parse
default void parse(String fqn)
Signal this type manifold to fully parse the type corresponding withfqnand attach parse errors/warnings to the source file, for example usingIssueReporter<JavaFileObject>. For instance, the Gosu language manifold has its own bytecode compiler and handles this call by fully parsingfqn. 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 compilefqnand return resulting Java byte-code. Note this call is only made if no errors were attached duringparse(String).- Parameters:
fqn- The fully qualified name of the type to compile.
-
-