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
research:jtransformer:api:java:pefs:4.0:preserve_diamondt [2014/07/08 13:22]
127.0.0.1 external edit
research:jtransformer:api:java:pefs:4.0:preserve_diamondt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +=== preserve_diamondT(#​id) ===
 +This fact is used for preserving the original appearance of the source code after transformations. It declares, that the type parameters in an [[newT|instance creation]] for a parameterized type are ommitted.
 +
 +<Code lang-java>​
 +List<​String>​ list = new ArrayList<>​();​
 +</​Code>​
 +
 +instead of 
 +
 +<Code lang-java>​
 +List<​String>​ list = new ArrayList<​String>​();​
 +</​Code>​
 +
 +<note info>
 +Keep in mind that the call ''​new ArrayList<>​()''​ is not the same as ''​new ArrayList()''​ (without the diamond). The first one inherits the type parameters implicitly from the left-hand-side of the assignment, while the second one is always a raw type, without any type parameters.
 +</​note>​
 +
 +== History ==
 +  * JTransformer 4.0: Added
 +
 +=== Arguments ===
 +== ==
 +**id:** [[newT|newT]]\\
 +ID of the corresponding newT
 +
 +===Sample Java Source===
 +== ==
 +<Code lang-java>​
 +List<​String>​ list = new ArrayList<>​();​
 +</​Code>​
 +
 +===Its PEF Representation ===
 +== ==
 +<Code lang-prolog>​
 +fieldT(Field,​ _, FieldType, list, New),
 +newT(New, Field, Field, null, [], _, [], TypeOfNew, null),
 +preserve_diamond(New).
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code> ​
 +ast_relation_type_spec(preserve_diamondT,​[
 +     ​ast_arg(id, ​    ​mult(1,​1,​no ), id,   ​[newT]) ​
 +]).
 +</​Code>​
research/jtransformer/api/java/pefs/4.0/preserve_diamondt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019