SDA SE Wiki

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

User Tools

Site Tools



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 instance creation for a parameterized type are ommitted.

List<String> list = new ArrayList<>();

instead of

List<String> list = new ArrayList<String>();
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.
History
  • JTransformer 4.0: Added

Arguments

id: newT
ID of the corresponding newT

Sample Java Source

List<String> list = new ArrayList<>();

Its PEF Representation

fieldT(Field, _, FieldType, list, New),
newT(New, Field, Field, null, [], _, [], TypeOfNew, null),
preserve_diamond(New).

AST Specification

ast_relation_type_spec(preserve_diamondT,[
     ast_arg(id,     mult(1,1,no ), id,   [newT]) 
]).
research/jtransformer/api/java/pefs/4.2/preserve_diamondt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019