public interface ICookable
ClassBodyEvaluator
, then the tokens are interpreted as a class body and
compiled into a Class
which is accessible through IClassBodyEvaluator.getClazz()
.Modifier and Type | Field and Description |
---|---|
static ClassLoader |
BOOT_CLASS_LOADER
The
ClassLoader that loads this classes on the boot class path, i.e. the JARs in the JRE's "lib" and
"lib/ext" directories, but not the JARs and class directories specified through the class path. |
static String |
SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR
If the source code is not read from a file, debuggers have a hard time locating the source file for source-level
debugging.
|
static String |
SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE
Setting this system property to 'true' enables source-level debugging.
|
Modifier and Type | Method and Description |
---|---|
void |
cook(InputStream is)
Reads, scans, parses and compiles Java tokens from the given
InputStream , encoded
in the "platform default encoding". |
void |
cook(InputStream is,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the given
InputStream with the given encoding . |
void |
cook(Reader r)
Reads, scans, parses and compiles Java tokens from the given
Reader . |
void |
cook(String s)
Reads, scans, parses and compiles Java tokens from the given
String . |
void |
cook(String optionalFileName,
InputStream is)
Reads, scans, parses and compiles Java tokens from the given
InputStream , encoded
in the "platform default encoding". |
void |
cook(String optionalFileName,
InputStream is,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the given
InputStream with the given encoding . |
void |
cook(String optionalFileName,
Reader r)
Reads, scans, parses and compiles Java tokens from the given
Reader . |
void |
cook(String optionalFileName,
String s)
Reads, scans, parses and compiles Java tokens from the given
String . |
void |
cookFile(File file)
Reads, scans, parses and compiles Java tokens from the given
File , encoded in the "platform default
encoding". |
void |
cookFile(File file,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the given
File with the given encoding . |
void |
cookFile(String fileName)
Reads, scans, parses and compiles Java tokens from the named file, encoded in the "platform default encoding".
|
void |
cookFile(String fileName,
String optionalEncoding)
Reads, scans, parses and compiles Java tokens from the named file with the given optionalEncoding.
|
void |
setCompileErrorHandler(ErrorHandler optionalCompileErrorHandler)
By default,
CompileException s are thrown on compile errors, but an application my install its own
ErrorHandler . |
void |
setDebuggingInformation(boolean debugSource,
boolean debugLines,
boolean debugVars)
Determines what kind of debugging information is included in the generates classes.
|
void |
setParentClassLoader(ClassLoader optionalParentClassLoader)
The "parent class loader" is used to load referenced classes.
|
void |
setWarningHandler(WarningHandler optionalWarningHandler)
By default, warnings are discarded, but an application my install a custom
WarningHandler . |
static final ClassLoader BOOT_CLASS_LOADER
ClassLoader
that loads this classes on the boot class path, i.e. the JARs in the JRE's "lib" and
"lib/ext" directories, but not the JARs and class directories specified through the class path.static final String SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE
-g:all
" instead of "-g:none
".static final String SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR
void setParentClassLoader(@Nullable ClassLoader optionalParentClassLoader)
System.getSystemClassLoader() |
The running JVM's class path |
Thread.currentThread().getContextClassLoader() or null |
The class loader effective for the invoking thread |
BOOT_CLASS_LOADER |
The running JVM's boot class path |
The parent class loader defaults to the current thread's context class loader.
void setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars)
-g:none
", and "-g:all
" if the system property "org.codehaus.janino.source_debugging.enable"
is set to "true
".void cook(@Nullable String optionalFileName, Reader r) throws CompileException, IOException
Reader
.optionalFileName
- Used when reporting errors and warningsCompileException
IOException
void cook(Reader r) throws CompileException, IOException
Reader
.CompileException
IOException
void cook(InputStream is) throws CompileException, IOException
InputStream
, encoded
in the "platform default encoding".CompileException
IOException
void cook(@Nullable String optionalFileName, InputStream is) throws CompileException, IOException
InputStream
, encoded
in the "platform default encoding".optionalFileName
- Used when reporting errors and warningsCompileException
IOException
void cook(InputStream is, @Nullable String optionalEncoding) throws CompileException, IOException
InputStream
with the given encoding
.CompileException
IOException
void cook(@Nullable String optionalFileName, InputStream is, @Nullable String optionalEncoding) throws CompileException, IOException
InputStream
with the given encoding
.optionalFileName
- Used when reporting errors and warningsCompileException
IOException
void cook(String s) throws CompileException
String
.CompileException
void cook(@Nullable String optionalFileName, String s) throws CompileException
String
.optionalFileName
- Used when reporting errors and warningsCompileException
void cookFile(File file) throws CompileException, IOException
File
, encoded in the "platform default
encoding".CompileException
IOException
void cookFile(File file, @Nullable String optionalEncoding) throws CompileException, IOException
File
with the given encoding
.CompileException
IOException
void cookFile(String fileName) throws CompileException, IOException
CompileException
IOException
void cookFile(String fileName, @Nullable String optionalEncoding) throws CompileException, IOException
CompileException
IOException
void setCompileErrorHandler(@Nullable ErrorHandler optionalCompileErrorHandler)
CompileException
s are thrown on compile errors, but an application my install its own
ErrorHandler
.
Be aware that a single problem during compilation often causes a bunch of compile errors, so a good ErrorHandler
counts errors and throws a CompileException
when a limit is reached.
If the given ErrorHandler
throws CompileException
s, then the compilation is terminated and
the exception is propagated.
If the given ErrorHandler
does not throw CompileException
s, then the compiler may or may not
continue compilation, but must eventually throw a CompileException
.
In other words: The ErrorHandler
may throw a CompileException
or not, but the compiler must
definitely throw a CompileException
if one or more compile errors have occurred.
optionalCompileErrorHandler
- null
to restore the default behavior (throwing a CompileException
void setWarningHandler(@Nullable WarningHandler optionalWarningHandler)
WarningHandler
.optionalWarningHandler
- null
to indicate that no warnings be issuedCopyright © 2016. All rights reserved.