CompilerConfiguration
Properties
When true, includes can be absolute file paths. When false, the paths can only be relative, and must not include ".." (parent directory).
Are operating system commands allowed? Only set this to true in a trusted environment. Never set it to true when Feather is used as a macro/extensions language within an application, where the script writers may be malicious!
Is the "include" keyword allowed? This allows extra files to be compiled, and was only designed to be used from the "feather" and "feathers" command line programs; not when Feather is embedded within an application.
The ClassLoader used to resolve class names. The default is to use ClassLoader.getSystemClassLoader. Note, if you use a different ClassLoader than the default one, then you must ensure that the same ClassLoader is used when running the script (otherwise some classes this the script requires may be unavailable at runtime).
When we encounter a decimal number, without a "d" or "f" suffix, then which type should we use? Currently, the options are RealType.DOUBLE and RealType.FLOAT, but later I may add support for BigDecimal.
If you want errors to be reported during the compilation (rather than all at once at the end), then set this to an error handler of your choosing.
Similar to impliedImportPackages, but for individual classes. The key is the name of the class as it will be referred to in the feather code, and the value is the actual Class.
Which packages are automatically imported. The default mimics Java, importing just java.reflect.
The following achieve similar results :
Names of static fields/methods which are automatically imported. The value is a Pair of the class name and the field/method name.
The java version for the compiled byte code. The default is Java 11, however, the default may change in later versions of Feather. I'm not sure what the lowest possible version number is, but do NOT go below 5, as we do need generics!
Decides which classes scripts are allowed to use. The default is AllowList with AllowList.allowStandardJavaClasses applied.
If set to true, then a static main method with no arguments is converted to one taking an array of String.
If set to true, then all loops will automatically check Thread.interrupted, and throw InterruptedException iff true. This is useful when feather is used as a scripting language, and you want the ability to stop the script cleanly. Run the script in a new Thread, then call that thread's interrupt() method to stop the script.
Functions
A less severe way to stop a script compared to includeExit. A script which calls abort, will cause an AbortFeather to be thrown (which extends Throwable, not Exception nor RuntimeException).
WARNING. This will allow scripts to call System.exit()
, which stops the entire JVM.
Adds "uk.co.nickthecoder.feather.runtime" to impliedImportPackages. Adds "uk.co.nickthecoder.feather.runtime.Extensions" and "uk.co.nickthecoder.feather.runtime.Print" to impliedImportClasses