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;
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.
java.lang.String s; // fully qualified
fieldT(#Field, ..., #String, 's', null). preserve_qualifiedNameT(#Field, #String, [#JavaLangPackage]).
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
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
There is a NPE in the FBI when displaying this structure.
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]) ]).