SDA SE Wiki

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

User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
research:jtransformer:api:java:pefs:4.0:preserve_qualifiednamet_new [2014/07/24 12:17]
Günter Kniesel
research:jtransformer:api:java:pefs:4.0:preserve_qualifiednamet_new [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +=== 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
 +
 +<Code lang-java>​
 +java.lang.String s;                                  // fully qualified
 +InnerClass.InnerInnerClass c1;                       // partially qualified
 +myPackage.Class.InnerClass.InnerInnerClass c2;       // fully qualified
 +</​Code> ​
 +
 +instead of using only simple names such as
 +
 +<Code lang-java>​
 +String s; 
 +InnerInnerClass c1;         
 +InnerInnerClass c2;       
 +</​Code> ​
 +
 +== History ==
 +  * JTransformer 3.0: Added as srcQualifiedT
 +  * JTransformer 4.0: Renamed to preserve_qualifiedNameT
 +
 +=== Arguments ===
 +== ==
 +**id:** id\\
 +ID of the corresponding element
 +
 +**typeN:** [[type_inst]]\\
 +The referenced type (can differ from element type in case of parameterized types)
 +
 +**containingTypes:​** ​ [[packageT|packageT]],​ [[classT|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 
 +[[http://​docs.oracle.com/​javase/​specs/​jls/​se5.0/​html/​names.html#​6.7 | 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 ===
 +== ==
 +<Code lang-java>​
 +java.lang.String s;           // fully qualified
 +</​Code>​
 +===Its PEF Representation ===
 +== ==
 +<Code lang-prolog>​
 +fieldT(#​Field,​ ..., #String, '​s',​ null).
 +preserve_qualifiedNameT(#​Field,​ #String, [#​JavaLangPackage]).
 +</​Code>​
 +
 +===Sample Java Source: Nested Class ===
 +== ==
 +Nested classes can be qualified either by a full name or just by a part of it:
 +<Code lang-java>​
 +myPackage.Class.InnerClass.InnerInnerClass c1;       // fully qualified
 +InnerClass.InnerInnerClass c2;                       // partially qualified
 +</​Code>​
 +===Its PEF Representation ===
 +== ==
 +<Code lang-prolog>​
 +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
 +</​Code>​
 +FIXME There is a NPE in the FBI when displaying this structure. ​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +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])
 +]).
 +</​Code>​
research/jtransformer/api/java/pefs/4.0/preserve_qualifiednamet_new.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019