public class CompileUnit extends Object
ModuleNode
instances. There's one instance of this that's shared by all modules and
classes compiled during a single invocation of the compiler.
It's attached to MethodNodes and ClassNodes and is used to find fully qualified names of classes, resolve imports, and that sort of thing.
Modifier and Type | Class and Description |
---|---|
static class |
CompileUnit.ConstructedOuterNestedClassNode
Represents a resolved type as a placeholder, SEE GROOVY-7812
|
Constructor and Description |
---|
CompileUnit(GroovyClassLoader classLoader,
CodeSource codeSource,
CompilerConfiguration config) |
CompileUnit(GroovyClassLoader classLoader,
CompilerConfiguration config) |
public CompileUnit(GroovyClassLoader classLoader, CompilerConfiguration config)
public CompileUnit(GroovyClassLoader classLoader, CodeSource codeSource, CompilerConfiguration config)
public List<ModuleNode> getModules()
public void addModule(ModuleNode node)
public ClassNode getClass(String name)
public List<ClassNode> getClasses()
public CompilerConfiguration getConfig()
public GroovyClassLoader getClassLoader()
public CodeSource getCodeSource()
public void addClass(ClassNode node)
public void addClassNodeToCompile(ClassNode node, SourceUnit location)
public SourceUnit getScriptSourceLocation(String className)
public boolean hasClassNodeToCompile()
public InnerClassNode getGeneratedInnerClass(String name)
public void addGeneratedInnerClass(InnerClassNode icn)
public Map<String,InnerClassNode> getGeneratedInnerClasses()
public Map<String,CompileUnit.ConstructedOuterNestedClassNode> getClassesToResolve()
public void addClassNodeToResolve(CompileUnit.ConstructedOuterNestedClassNode cn)
cn
- the constructed class nodepublic <T> T getNodeMetaData(Object key)
key
- - the meta data keypublic void setNodeMetaData(Object key, Object value)
key
- - the meta data keyvalue
- - the meta data valueGroovyBugError
- if key is null or there is already meta
data under that keypublic Object putNodeMetaData(Object key, Object value)
key
- - the meta data keyvalue
- - the meta data valueGroovyBugError
- if key is nullpublic void removeNodeMetaData(Object key)
key
- - the meta data keyGroovyBugError
- if the key is nullpublic Map<?,?> getNodeMetaData()
public ListHashMap getMetaDataMap()