SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools



compilationUnitT(#id, #package, #fileS, [#import_1, ...], [#def_1, ...] )

Represents a Java compilation unit, that is a file that contains a set of import and type declarations that are compiled together and belong to the same package. The import and type declarations are children of the compilation unit. The package is the parent of the compilation unit. The file is a reference to an element that is not part of the Java AST. This is specified by: fileS Changed in JT 2.6

Arguments

#id: id
the unique ID assigned to this fact.

#package: packageT, 'defaultPackage'
Id of the containing package or 'defaultPackage'.

#file: fileS, 'dummyFile'
Id of the file that contains this compilation unit or 'dummyFile' for Bytecode classes.

[#import_1,…]: importT
List of IDs of import declarations contained in the compilation unit. The order in the list corresponds to the textual order in the file.

[#def_1,…]: classT
List of IDs of type declarations contained in the compilation unit. The order in the list corresponds to the textual order in the file.

Sample Java Source

package packaged;

import java.util.List;

public class DummyClass {
	List list;
}

Its PEF Representation

packageT(#Package, 'packaged'),
compilationUnitT(#CompilationUnit, #Package, #File, [#Import], [#Class]),
importT(#Import, #CompilationUnit, #Imported),
classT(#Class, #CompilationUnit, 'DummyClass', [#Field]),
fieldT(...

AST Specification

ast_node_type_spec(compilationUnitT,[
     ast_arg(id,     mult(1,1,no ), id,    [compilationUnitT]),
     ast_arg(parent, mult(0,1,no),  id,    [packageT]),
     ast_arg(file,   mult(1,1,no ), id,    [fileS]),
     ast_arg(imports,mult(0,*,ord), id,    [importT]),
     ast_arg(defs,   mult(0,*,ord), id,    [classT])
]).
research/jtransformer/api/java/pefs/4.0/compilationunitt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024