org.extendj.ast
node type CompilationUnit

General Info

Production
CompilationUnit : ASTNode ::= <PackageDecl:String> ImportDecl* TypeDecl*;
Type Hierarchy:
java.lang.Object
  extended by beaver.Symbol
      extended by org.extendj.ast.ASTNode<ASTNode>
          extended by org.extendj.ast.CompilationUnit
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<ASTNode>, org.jastadd.util.PrettyPrintable
Direct Known Subclasses:
AnnotatedCompilationUnit, PrimitiveCompilationUnit, WildcardsCompilationUnit

Description

Source
Declared in /home/jesper/git/extendj/java4/grammar/Java.ast at line 4

Member Filters

API level:

Aspect:

Constructors

public CompilationUnit()
 
Source
Declared in /home/jesper/git/extendj/ASTNode at line 1
public CompilationUnit(java.lang.String p0,
                       List<ImportDecl> p1,
                       List<TypeDecl> p2)
 
Source
Declared in /home/jesper/git/extendj/ASTNode at line 15
public CompilationUnit(beaver.Symbol p0,
                       List<ImportDecl> p1,
                       List<TypeDecl> p2)
 
Source
Declared in /home/jesper/git/extendj/ASTNode at line 20

Attributes

Returns:
The path to the source file, or the path to the file inside a Jar file.
Source
Declared in /home/jesper/git/extendj/java4/frontend/ClassPath.jrag at line 66
Aspect
ClassPath
@ASTNodeAnnotation.Attribute
syn java.lang.String pathName()
Returns:
The path to the source file, or the enclosing Jar file.
Source
Declared in /home/jesper/git/extendj/java4/frontend/ClassPath.jrag at line 71
Aspect
ClassPath
Returns:
true if this compilation unit was parsed from source.
Source
Declared in /home/jesper/git/extendj/java4/frontend/ClassPath.jrag at line 76
Aspect
ClassPath
@ASTNodeAnnotation.Attribute
syn org.extendj.ast.SimpleSet localLookupType(java.lang.String name)
Searches for a type with the given simple name in this compilation unit.
Source
Declared in /home/jesper/git/extendj/java4/frontend/LookupType.jrag at line 387
Aspect
TypeScopePropagation
@ASTNodeAnnotation.Attribute
syn org.extendj.ast.SimpleSet importedTypes(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java4/frontend/LookupType.jrag at line 396
Aspect
TypeScopePropagation
@ASTNodeAnnotation.Attribute
syn org.extendj.ast.SimpleSet importedTypesOnDemand(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java4/frontend/LookupType.jrag at line 408
Aspect
TypeScopePropagation
Source
Declared in /home/jesper/git/extendj/java4/frontend/PrettyPrintUtil.jrag at line 261
Aspect
PrettyPrintUtil
Source
Declared in /home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag at line 106
Aspect
TypeName
Computes the path to the parent directory of the source file of this compilation unit.

If the parent directory of the source file could not be computed the path to the working directory is returned.

Returns:
The path to the parent directory of the source file for this compilation unit, or "." if the path could not be computed.
Source
Declared in /home/jesper/git/extendj/java4/backend/ConstantPoolNames.jrag at line 146
Aspect
ConstantPoolNames
@ASTNodeAnnotation.Attribute
syn org.extendj.ast.SimpleSet importedFields(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 186
Aspect
StaticImports
@ASTNodeAnnotation.Attribute
syn org.extendj.ast.SimpleSet importedFieldsOnDemand(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 198
Aspect
StaticImports
@ASTNodeAnnotation.Attribute
syn java.util.Collection importedMethods(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 228
Aspect
StaticImports
@ASTNodeAnnotation.Attribute
syn java.util.Collection importedMethodsOnDemand(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 238
Aspect
StaticImports
@ASTNodeAnnotation.Attribute
inh TypeDecl lookupType(java.lang.String packageName,
                                                java.lang.String typeName)
Source
Declared in /home/jesper/git/extendj/java4/frontend/LookupType.jrag at line 133
Aspect
LookupFullyQualifiedTypes
@ASTNodeAnnotation.Attribute
inh org.extendj.ast.SimpleSet lookupType(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java4/frontend/LookupType.jrag at line 336
Aspect
TypeScopePropagation
@ASTNodeAnnotation.Attribute
inh org.extendj.ast.SimpleSet lookupVariable(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 184
Aspect
StaticImports
@ASTNodeAnnotation.Attribute
inh java.util.Collection lookupMethod(java.lang.String name)
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 226
Aspect
StaticImports

Methods

public void setClassSource(ClassSource source)
Source
Declared in /home/jesper/git/extendj/java4/frontend/ClassPath.jrag at line 399
Aspect
ClassPath
Source
Declared in /home/jesper/git/extendj/java4/frontend/ClassPath.jrag at line 402
Aspect
ClassPath
public void setFromSource(boolean value)
Source
Declared in /home/jesper/git/extendj/java4/frontend/ClassPath.jrag at line 405
Aspect
ClassPath
public java.util.Collection parseErrors()
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 91
Aspect
ErrorCheck
public void addParseError(Problem msg)
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 92
Aspect
ErrorCheck
public java.util.Collection<Problem> errors()
Returns:
collection of semantic errors
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 261
Aspect
ErrorCheck
public java.util.Collection<Problem> warnings()
Returns:
collection of semantic warnings
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 268
Aspect
ErrorCheck
Source
Declared in /home/jesper/git/extendj/java4/frontend/NameCheck.jrag at line 63
Aspect
NameCheck
public void prettyPrint(org.jastadd.util.PrettyPrinter out)
Specified by:prettyPrint in interface org.jastadd.util.PrettyPrintableOverrides:prettyPrint in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd at line 302
Aspect
Java4PrettyPrint
public void generateClassfile()
Source
Declared in /home/jesper/git/extendj/java4/backend/GenerateClassfile.jrag at line 39
Aspect
GenerateClassfile
public void transformation()
Overrides:transformation in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/backend/Transformations.jrag at line 39
Aspect
Transformations
public void init$Children()
Initializes the child array to the correct size. Initializes List and Opt nta children.
Overrides:init$Children in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 10
protected int numChildren()
Overrides:numChildren in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 28
public boolean mayHaveRewrite()
Overrides:mayHaveRewrite in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 34
public void flushAttrCache()
Overrides:flushAttrCache in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 40
public void flushCollectionCache()
Overrides:flushCollectionCache in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 49
public void flushRewriteCache()
Overrides:flushRewriteCache in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 55
public CompilationUnit clone()
                      throws java.lang.CloneNotSupportedException
Overrides:clone in class ASTNode<ASTNode>
Throws:
java.lang.CloneNotSupportedException
Source
Declared in /home/jesper/git/extendj/ASTNode at line 61
public CompilationUnit copy()
Overrides:copy in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 68
@Deprecated
public CompilationUnit fullCopy()
Deprecated. Please use treeCopy or treeCopyNoTransform instead

Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.

Overrides:fullCopy in class ASTNode<ASTNode>
Returns:
dangling copy of the subtree at this node
Source
Declared in /home/jesper/git/extendj/ASTNode at line 87
public CompilationUnit treeCopyNoTransform()
Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
Overrides:treeCopyNoTransform in class ASTNode<ASTNode>
Returns:
dangling copy of the subtree at this node
Source
Declared in /home/jesper/git/extendj/ASTNode at line 97
public CompilationUnit treeCopy()
Create a deep copy of the AST subtree at this node. The subtree of this node is traversed to trigger rewrites before copy. The copy is dangling, i.e. has no parent.
Overrides:treeCopy in class ASTNode<ASTNode>
Returns:
dangling copy of the subtree at this node
Source
Declared in /home/jesper/git/extendj/ASTNode at line 117
protected boolean is$Equal(ASTNode node)
Overrides:is$Equal in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 124
public void setPackageDecl(java.lang.String value)
Replaces the lexeme PackageDecl.
Parameters:
value - The new value for the lexeme PackageDecl.
public void setPackageDecl(beaver.Symbol symbol)
JastAdd-internal setter for lexeme PackageDecl using the Beaver parser.
Parameters:
symbol - Symbol containing the new value for the lexeme PackageDecl
@ASTNodeAnnotation.Token(name="PackageDecl")
public java.lang.String getPackageDecl()
Retrieves the value for the lexeme PackageDecl.
Returns:
The value for the lexeme PackageDecl.
public void setImportDeclList(List<ImportDecl> list)
Replaces the ImportDecl list.
Parameters:
list - The new list node to be used as the ImportDecl list.
public int getNumImportDecl()
Retrieves the number of children in the ImportDecl list.
Returns:
Number of children in the ImportDecl list.
Retrieves the number of children in the ImportDecl list. Calling this method will not trigger rewrites.
Returns:
Number of children in the ImportDecl list.
public ImportDecl getImportDecl(int i)
Retrieves the element at index i in the ImportDecl list.
Parameters:
i - Index of the element to return.
Returns:
The element at position i in the ImportDecl list.
public boolean hasImportDecl()
Check whether the ImportDecl list has any children.
Returns:
true if it has at least one child, false otherwise.
public void addImportDecl(ImportDecl node)
Append an element to the ImportDecl list.
Parameters:
node - The element to append to the ImportDecl list.
public void setImportDecl(ImportDecl node,
                          int i)
Replaces the ImportDecl list element at index i with the new node node.
Parameters:
node - The new node to replace the old list element.
i - The list index of the node to be replaced.
Retrieves the ImportDecl list.
Returns:
The node representing the ImportDecl list.
Retrieves the ImportDecl list.

This method does not invoke AST transformations.

Returns:
The node representing the ImportDecl list.
Retrieves the ImportDecl list.
Returns:
The node representing the ImportDecl list.
Retrieves the ImportDecl list.

This method does not invoke AST transformations.

Returns:
The node representing the ImportDecl list.
public void setTypeDeclList(List<TypeDecl> list)
Replaces the TypeDecl list.
Parameters:
list - The new list node to be used as the TypeDecl list.
public int getNumTypeDecl()
Retrieves the number of children in the TypeDecl list.
Returns:
Number of children in the TypeDecl list.
Retrieves the number of children in the TypeDecl list. Calling this method will not trigger rewrites.
Returns:
Number of children in the TypeDecl list.
public TypeDecl getTypeDecl(int i)
Retrieves the element at index i in the TypeDecl list.
Parameters:
i - Index of the element to return.
Returns:
The element at position i in the TypeDecl list.
public boolean hasTypeDecl()
Check whether the TypeDecl list has any children.
Returns:
true if it has at least one child, false otherwise.
public void addTypeDecl(TypeDecl node)
Append an element to the TypeDecl list.
Parameters:
node - The element to append to the TypeDecl list.
public void addTypeDeclNoTransform(TypeDecl node)
public void setTypeDecl(TypeDecl node,
                        int i)
Replaces the TypeDecl list element at index i with the new node node.
Parameters:
node - The new node to replace the old list element.
i - The list index of the node to be replaced.
Retrieves the TypeDecl list.
Returns:
The node representing the TypeDecl list.
Retrieves the TypeDecl list.

This method does not invoke AST transformations.

Returns:
The node representing the TypeDecl list.
Retrieves the TypeDecl list.
Returns:
The node representing the TypeDecl list.
Retrieves the TypeDecl list.

This method does not invoke AST transformations.

Returns:
The node representing the TypeDecl list.
public void nameCheck()
Overrides:nameCheck in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java5/frontend/StaticImports.jrag at line 273
Aspect
StaticImports
Overrides:Define_compilationUnit in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 490
protected boolean canDefine_compilationUnit(ASTNode caller,
                                            ASTNode child)
public boolean Define_isIncOrDec(ASTNode caller,
                                 ASTNode child)
Overrides:Define_isIncOrDec in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/DefiniteAssignment.jrag at line 71
protected boolean canDefine_isIncOrDec(ASTNode caller,
                                       ASTNode child)
public boolean Define_handlesException(ASTNode caller,
                                       ASTNode child,
                                       TypeDecl exceptionType)
Overrides:Define_handlesException in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java7/frontend/TryWithResources.jrag at line 113
protected boolean canDefine_handlesException(ASTNode caller,
                                             ASTNode child,
                                             TypeDecl exceptionType)
public org.extendj.ast.SimpleSet Define_lookupType(ASTNode caller,
                                                   ASTNode child,
                                                   java.lang.String name)
Overrides:Define_lookupType in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag at line 197
protected boolean canDefine_lookupType(ASTNode caller,
                                       ASTNode child,
                                       java.lang.String name)
public org.extendj.ast.SimpleSet Define_allImportedTypes(ASTNode caller,
                                                         ASTNode child,
                                                         java.lang.String name)
Overrides:Define_allImportedTypes in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/NameCheck.jrag at line 52
protected boolean canDefine_allImportedTypes(ASTNode caller,
                                             ASTNode child,
                                             java.lang.String name)
public java.lang.String Define_packageName(ASTNode caller,
                                           ASTNode child)
Overrides:Define_packageName in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/QualifiedNames.jrag at line 103
protected boolean canDefine_packageName(ASTNode caller,
                                        ASTNode child)
public org.extendj.ast.NameType Define_nameType(ASTNode caller,
                                                ASTNode child)
Overrides:Define_nameType in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag at line 36
protected boolean canDefine_nameType(ASTNode caller,
                                     ASTNode child)
Overrides:Define_enclosingType in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag at line 544
protected boolean canDefine_enclosingType(ASTNode caller,
                                          ASTNode child)
public boolean Define_isNestedType(ASTNode caller,
                                   ASTNode child)
Overrides:Define_isNestedType in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag at line 569
protected boolean canDefine_isNestedType(ASTNode caller,
                                         ASTNode child)
public boolean Define_isMemberType(ASTNode caller,
                                   ASTNode child)
Overrides:Define_isMemberType in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag at line 577
protected boolean canDefine_isMemberType(ASTNode caller,
                                         ASTNode child)
public boolean Define_isLocalClass(ASTNode caller,
                                   ASTNode child)
Overrides:Define_isLocalClass in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag at line 591
protected boolean canDefine_isLocalClass(ASTNode caller,
                                         ASTNode child)
public java.lang.String Define_hostPackage(ASTNode caller,
                                           ASTNode child)
Overrides:Define_hostPackage in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag at line 622
protected boolean canDefine_hostPackage(ASTNode caller,
                                        ASTNode child)
public TypeDecl Define_hostType(ASTNode caller,
                                ASTNode child)
Overrides:Define_hostType in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java7/frontend/MultiCatch.jrag at line 71
protected boolean canDefine_hostType(ASTNode caller,
                                     ASTNode child)
public org.extendj.ast.SimpleSet Define_lookupVariable(ASTNode caller,
                                                       ASTNode child,
                                                       java.lang.String name)
Overrides:Define_lookupVariable in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/LookupVariable.jrag at line 30
protected boolean canDefine_lookupVariable(ASTNode caller,
                                           ASTNode child,
                                           java.lang.String name)
public java.util.Collection Define_lookupMethod(ASTNode caller,
                                                ASTNode child,
                                                java.lang.String name)
Overrides:Define_lookupMethod in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java4/frontend/LookupMethod.jrag at line 46
protected boolean canDefine_lookupMethod(ASTNode caller,
                                         ASTNode child,
                                         java.lang.String name)
Overrides:Define_enclosingLambda in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/EnclosingLambda.jrag at line 37
protected boolean canDefine_enclosingLambda(ASTNode caller,
                                            ASTNode child)
public boolean Define_assignmentContext(ASTNode caller,
                                        ASTNode child)
Overrides:Define_assignmentContext in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TargetType.jrag at line 196
protected boolean canDefine_assignmentContext(ASTNode caller,
                                              ASTNode child)
public boolean Define_invocationContext(ASTNode caller,
                                        ASTNode child)
Overrides:Define_invocationContext in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TargetType.jrag at line 197
protected boolean canDefine_invocationContext(ASTNode caller,
                                              ASTNode child)
public boolean Define_castContext(ASTNode caller,
                                  ASTNode child)
Overrides:Define_castContext in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TargetType.jrag at line 198
protected boolean canDefine_castContext(ASTNode caller,
                                        ASTNode child)
public boolean Define_stringContext(ASTNode caller,
                                    ASTNode child)
Overrides:Define_stringContext in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TargetType.jrag at line 199
protected boolean canDefine_stringContext(ASTNode caller,
                                          ASTNode child)
public boolean Define_numericContext(ASTNode caller,
                                     ASTNode child)
Overrides:Define_numericContext in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TargetType.jrag at line 200
protected boolean canDefine_numericContext(ASTNode caller,
                                           ASTNode child)
public int Define_typeVarPosition(ASTNode caller,
                                  ASTNode child)
Overrides:Define_typeVarPosition in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag at line 29
protected boolean canDefine_typeVarPosition(ASTNode caller,
                                            ASTNode child)
public boolean Define_typeVarInMethod(ASTNode caller,
                                      ASTNode child)
Overrides:Define_typeVarInMethod in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag at line 32
protected boolean canDefine_typeVarInMethod(ASTNode caller,
                                            ASTNode child)
public int Define_genericMethodLevel(ASTNode caller,
                                     ASTNode child)
Overrides:Define_genericMethodLevel in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/java8/frontend/TypeVariablePositions.jrag at line 30
protected boolean canDefine_genericMethodLevel(ASTNode caller,
                                               ASTNode child)
Overrides:rewriteTo in class ASTNode<ASTNode>

Fields

protected java.util.Collection<Problem> errors
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 88
Aspect
ErrorCheck
protected java.util.Collection<Problem> warnings
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 89
Aspect
ErrorCheck
protected java.util.Collection parseErrors
Source
Declared in /home/jesper/git/extendj/java4/frontend/ErrorCheck.jrag at line 93
Aspect
ErrorCheck
protected java.lang.String tokenString_PackageDecl
public int PackageDeclstart
public int PackageDeclend
protected boolean packageName_computed
protected java.lang.String packageName_value
protected boolean destinationPath_computed
protected java.lang.String destinationPath_value
protected java.util.Map lookupType_String_values

Inherited Members

Attributes inherited from org.extendj.ast.ASTNode

Methods inherited from class org.extendj.ast.ASTNode

Methods inherited from class beaver.Symbol

getColumn
getEnd
getId
getLine
getStart
makePosition

Methods inherited from class java.lang.Object

equals
finalize
getClass
hashCode
notify
notifyAll
wait
wait
wait

Fields inherited from org.extendj.ast.ASTNode

Fields inherited from beaver.Symbol

end
id
start
value