public interface ISimpleCompiler extends ICookable
Opposed to a normal ".java" file, you can declare multiple public classes here.
To set up an ISimpleCompiler object, proceed as follows:
ISimpleCompiler-implementing objectICookable.setParentClassLoader(ClassLoader).ICookable.cook(String, Reader) methods to scan, parse, compile and load the compilation
unit into the JVM.
getClassLoader() to obtain a ClassLoader that you can use to access the compiled classes.
BOOT_CLASS_LOADER| Modifier and Type | Method and Description |
|---|---|
ClassLoader |
getClassLoader()
Returns a
ClassLoader object through which the previously compiled classes can be accessed. |
void |
setNoPermissions()
Installs a security manager in the running JVM such that all generated code, when executed, is not allowed to
execute any checked operations.
|
void |
setPermissions(Permissions permissions)
Installs a security manager in the running JVM such that all generated code, when executed, will be checked
against the given permissions.
|
cook, cook, cook, cook, cook, cook, cook, cook, cookFile, cookFile, cookFile, cookFile, setCompileErrorHandler, setDebuggingInformation, setParentClassLoader, setWarningHandlerClassLoader getClassLoader()
ClassLoader object through which the previously compiled classes can be accessed. This ClassLoader can be used for subsequent ISimpleCompilers in order to compile compilation units that use
types (e.g. declare derived types) declared in the previous one.
This method must only be called after exactly one of the ICookable.cook(String, java.io.Reader) methods was
called.
void setPermissions(Permissions permissions)
By default, generated code is executed with the same permissions as the rest of the running JVM, which typically means that any generated code can easily compromise the system, e.g. by reading or deleting files on the local file system.
Thus, if you compile and execute any user-written code and cannot be sure that the code is written carefully, then you should definitely restrict the permissions for the generated code.
void setNoPermissions()
Copyright © 2019. All rights reserved.