Class SimpleCompiler
java.lang.Object
org.codehaus.commons.compiler.Cookable
org.codehaus.commons.compiler.jdk.SimpleCompiler
- All Implemented Interfaces:
ICookable,ISimpleCompiler
- Direct Known Subclasses:
ClassBodyEvaluator
-
Field Summary
Fields inherited from interface org.codehaus.commons.compiler.ICookable
BOOT_CLASS_LOADER, SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR, SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThrow anIllegalStateExceptionif thisCookableis not yet cooked.protected voidThrow anIllegalStateExceptionif thisCookableis already cooked.voidReads, scans, parses and compiles Java tokens from the givenReader.protected voidcook(JavaFileObject compilationUnit) Returns aClassLoaderobject through which the previously compiled classes can be accessed.voidsetDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars) Determines what kind of debugging information is included in the generates classes.voidsetParentClassLoader(ClassLoader optionalParentClassLoader) The "parent class loader" is used to load referenced classes.voidsetParentClassLoader(ClassLoader optionalParentClassLoader, Class<?>[] auxiliaryClasses) Deprecated.Methods inherited from class org.codehaus.commons.compiler.Cookable
cook, cook, cook, cook, cook, cook, cook, cookFile, cookFile, cookFile, cookFile, readString
-
Constructor Details
-
SimpleCompiler
public SimpleCompiler()
-
-
Method Details
-
getClassLoader
Description copied from interface:ISimpleCompilerReturns aClassLoaderobject through which the previously compiled classes can be accessed. ThisClassLoadercan be used for subsequentISimpleCompilers 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 on of the
ICookable.cook(String, java.io.Reader)methods was called.- Specified by:
getClassLoaderin interfaceISimpleCompiler
-
cook
Description copied from interface:ICookableReads, scans, parses and compiles Java tokens from the givenReader.- Specified by:
cookin interfaceICookable- Specified by:
cookin classCookable- Parameters:
optionalFileName- Used when reporting errors and warnings.- Throws:
CompileExceptionIOException- See Also:
-
cook
- Throws:
CompileExceptionIOException
-
setDebuggingInformation
public void setDebuggingInformation(boolean debugSource, boolean debugLines, boolean debugVars) Description copied from interface:ICookableDetermines what kind of debugging information is included in the generates classes. The default is typically '-g:none', and '-g:all' if the system property 'org.codehaus.janino.source_debugging.enable' is set to 'true'.- Specified by:
setDebuggingInformationin interfaceICookable
-
setParentClassLoader
Description copied from interface:ICookableThe "parent class loader" is used to load referenced classes. Useful values are:
The parent class loader defaults to the current thread's context class loader.System.getSystemClassLoader()The running JVM's class path Thread.currentThread().getContextClassLoader()ornullThe class loader effective for the invoking thread ICookable.BOOT_CLASS_LOADERThe running JVM's boot class path - Specified by:
setParentClassLoaderin interfaceICookable
-
setParentClassLoader
@Deprecated public void setParentClassLoader(ClassLoader optionalParentClassLoader, Class<?>[] auxiliaryClasses) Deprecated.Auxiliary classes never really worked... don't use them.- Parameters:
optionalParentClassLoader-auxiliaryClasses-
-
assertCooked
protected void assertCooked()Throw anIllegalStateExceptionif thisCookableis not yet cooked. -
assertNotCooked
protected void assertNotCooked()Throw anIllegalStateExceptionif thisCookableis already cooked.
-