Class JavaBoxpiler
java.lang.Object
ortus.boxlang.compiler.Boxpiler
ortus.boxlang.compiler.javaboxpiler.JavaBoxpiler
- All Implemented Interfaces:
IBoxpiler
This class uses the Java compiler to turn a BoxLang script into a Java class
-
Field Summary
Fields inherited from class ortus.boxlang.compiler.Boxpiler
classGenerationDirectory, classPools, diskClassUtil, frTransService, logger, runtimeFields inherited from interface ortus.boxlang.compiler.IBoxpiler
BYTECODE_VERSION, RESERVED_WORDS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<byte[]> compileClassInfo(String classPoolName, String FQN) Compiles a class from the class pool into bytecode without loading it.generateJavaSource(BoxNode node, ClassInfo classInfo) Generate Java source code from BoxLang AST nodesgetName()Gets the unique name identifier for this Boxpiler implementation.voidprintTranspiledCode(ParsingResult result, ClassInfo classInfo, PrintStream target) Prints the transpiled Java source code for debugging purposes.Methods inherited from class ortus.boxlang.compiler.Boxpiler
clearPagePool, compileClass, compileClass, compileInterfaceProxy, compileScript, compileStatement, compileTemplate, compileTemplateBytes, ensureClassInfo, getClassPool, getClassPools, getSourceMapFromFQN, parse, parse, parseOrFail, parseOrFail, validateParse
-
Constructor Details
-
JavaBoxpiler
public JavaBoxpiler()Private constructor
-
-
Method Details
-
getName
Description copied from interface:IBoxpilerGets the unique name identifier for this Boxpiler implementation. This is used by the runtime to distinguish between different compiler implementations (e.g., ASM-based compiler vs. Java source compiler).- Returns:
- A Key representing the compiler's unique name
-
printTranspiledCode
Description copied from interface:IBoxpilerPrints the transpiled Java source code for debugging purposes. This method is useful for inspecting the generated Java code that results from compiling BoxLang source, particularly for troubleshooting compilation issues.- Parameters:
result- The parsing result containing the ASTclassInfo- The class information containing the transpiled codetarget- The PrintStream to write the transpiled code to (e.g., System.out)
-
generateJavaSource
Generate Java source code from BoxLang AST nodes- Parameters:
node- The BoxLang root AST nodeclassInfo- The class info object for this class- Returns:
- The generated Java source code as a string
-
compileClassInfo
Description copied from interface:IBoxpilerCompiles a class from the class pool into bytecode without loading it. This method retrieves a previously parsed class from the specified class pool and generates its bytecode for storage or transmission.- Parameters:
classPoolName- The name of the class pool containing the classFQN- The fully qualified name of the class to compile- Returns:
- A list of byte arrays representing the compiled class and any inner classes
-