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:3.0:markert [2013/11/15 01:53]
127.0.0.1 external edit
research:jtransformer:api:java:pefs:3.0:markert [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +
 +=== markerT (#id, #comment, '​kind',​ ['​args'​]) ​ ===
 +
 +Java annotations **cannot** be added inside nested expressions. However, some analysis ​
 +results refer to deeply nested program elements. ​
 +Therefore, JTransformer offers '​markerT'​ as a generic annotation facility that can be
 +added to every element. JTransformer markers are basically Java comments whose internal ​
 +structure obeys a simple syntax: The initial part must have the form 
 +   ​annotationKind(arg1,​ ..., argN)
 +There may be an arbitrary trailing part up to the closing */. E.g. 
 + 
 +<code Java>
 +  /​*@JT_suppress(string_identity_comparison) <- Tells JT not to 
 +    complain about == comparison of strings for this specific case:
 +  */
 +  if (debugLevel == INFO) {
 +      ...
 +  }
 +</​Code>​
 +
 +See '​[[..:​..:​..:​..:​tutorial_old:​jt_analysis]]'​ for more information. (Supported since JTransformer 3.1)
 +
 +=== Attributes ===
 +== ==
 +**#id:** id\\
 +the ID of the marked program element.
 +
 +**#​comment:​** [[commentt|commentT]]\\ ​
 +the ID of the commentT that contains the annotation
 +
 +**'​kind'​** atom\\ ​
 +the annotation kind. This can be any atom.
 +
 +**['​args'​]** list of atoms\\ ​
 +arguments of the annotation
 +
 +See '​[[..:​..:​..:​..:​tutorial_old:​jt_analysis]]'​ for how to use the annotation kind and arguments.
 +
 +
 +=== Sample Java Source ===
 +==  ==
 +<Code lang-java>​
 +public void m() {
 +   /​*@JT_suppress(string_identity_comparison)*/​
 +   if (debugLevel == INFO) {
 +      ...
 +   }
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +==  ==
 +<Code lang-prolog>​
 +ifT(If,​Parent,​Encl,​Operation,​Block,​null).
 +  operationT(Operation,​If,​Encl,​[Lhs,​Rhs],​==,​0).
 +    getFieldT(Lhs,​Operation,​Encl,​null,​debugLevel,​Field1).
 +    getFieldT(Rhs,​Operation,​Encl,​null,'​INFO',​Field2).
 +markerT(If,​Comment,​suppress,​[string_identity_comparison]).
 +commentT(Comment,​If,​blockComment).
 +</​Code>​
 +
 +=== AST Specification===
 +== ==
 +<​Code>​
 +ast_relation_type_spec(markerT,​[
 + ast_arg(id,​ mult(1,1,no ),  id,   ​[id]),​
 + ast_arg(comment,​ mult(1,1,no ),  id,   ​[commentT]),​
 + ast_arg(kind,​ mult(1,1,no ),  attr, [atomic]),
 + ast_arg(args,​ mult(0,​*,​ord ), attr, [atomic])
 +]).
 +</​Code>​
research/jtransformer/api/java/pefs/3.0/markert.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019