Packages, Compilation Units and Imports | Annotations | Declarations | Type Elements & Relations | Expressions | Statements | Body Level Attributes |
|---|
packageT(#id, 'fullname')
Represents the package declaration.
Arguments
#id: id
the unique ID assigned to this fact.
'fullname': atom
package name of this package declaration, as an atom.
E. g.:
packageT(42, 'org.cs3.pl.astvisitor').
packageT(defaultPackage, ' '). (for the default Java package) ← Changed in JT 2.6.3
Note: packageT does not have the ID of the children in his declaration. packageT has so called unreferenced_children, that means the children referencing the parent, but not the other way around.
The unreferenced_children from packageT are compilationUnitT, see also Program Element Facts for Java AST
Sample Java Source
package packaged.de.tests; public class tests { ... }
Its PEF Representation
packageT(#Package, 'packaged.de.tests'), compilationUnitT(#CompilationUnit, #Package, ..., [], #Class), classT(#Class, #CompilationUnit, 'tests', [#Children]),
AST Specification
ast_node_def('Java',packageT,[
ast_arg(id, mult(1,1,no ), id, [id]), % <-- convention!!!
ast_arg(name, mult(1,1,no ), attr, [atom])
]).


