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 TypeMethodDescriptiondefault byte[]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 voidSignal this type manifold to fully parse the type corresponding withfqnand attach parse errors/warnings to the source file, for example usingIssueReporter<JavaFileObject>.
-
Method Details
-
isSelfCompile
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
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
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.
-