SDA SE Wiki

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

User Tools

Site Tools



preserve_qualifiedNameT(#id, #typeN, [#typeN-1, ...,#type1])

This fact is used for preserving the original appearance of the source code after transformations. It saves the information on how the type name was qualified in the original source code. For instance, preserve

java.lang.String s;                                  // fully qualified
InnerClass.InnerInnerClass c1;                       // partially qualified
myPackage.Class.InnerClass.InnerInnerClass c2;       // fully qualified

instead of using only simple names such as

String s; 
InnerInnerClass c1;         
InnerInnerClass c2;       
History
  • JTransformer 3.0: Added as srcQualifiedT
  • JTransformer 4.0: Renamed to preserve_qualifiedNameT

Arguments

id: id
ID of the corresponding element

typeN: Type reference
The referenced type (can differ from element type in case of parameterized types)

containingTypes: packageT, classT
List of IDs of classes that contain typeN and that where mentioned in the original qualified name. If typeN is a non-nested class, the list is empty. Otherwise, it contains one element for each outer class of typeN mentioned in the original source code. This is necessary since the original qualified name could have been partial and even a fully qualified name could have been different from the canonical name (See 6.7 Fully Qualified Names and Canonical Names).
Note that the order in the list is inversed: The top level class is at the end of the list, the immediately containing class of typeN at the top of the list.

Sample Java Source: Top-Level Class

java.lang.String s;           // fully qualified

Its PEF Representation

fieldT(#Field, ..., #String, 's', null).
preserve_qualifiedNameT(#Field, #String, [#JavaLangPackage]).

Sample Java Source: Nested Class

Nested classes can be qualified either by a full name or just by a part of it:

myPackage.Class.InnerClass.InnerInnerClass c1;       // fully qualified
InnerClass.InnerInnerClass c2;                       // partially qualified

Its PEF Representation

fieldT(#Field1, ..., #InnerInnerClass, 'c1', null).
preserve_qualifiedNameT(#Field1, #InnerInnerClass, [#InnerClass, #Class, #myPackage]). // fully qualified
...
fieldT(#Field2, ..., #InnerInnerClass, 'c2', null).
preserve_qualifiedNameT(#Field2, #InnerInnerClass, [#InnerClass]).                     // partially qualified

FIXME There is a NPE in the FBI when displaying this structure.

AST Specification

ast_relation_type_spec(preserve_qualifiedNameT,[
    ast_arg(id,       mult(1,1,no ), id,   [id]),
    ast_arg(type,     mult(1,1,no ), id,   [type_inst]),
    ast_arg(kind,     mult(1,1,no ), attr, [atomic]),
    ast_arg(headType, mult(0,*,no ), id,   [packageT, classT])
]).
research/jtransformer/api/java/pefs/4.0/preserve_qualifiednamet_new.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019