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

research:jtransformer:api:java:pefs:4.2:jtannotationt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
  
 +----
 +
 +=== jtAnnotationT(#​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 **jtAnnotationT** 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, _, _, _, _,null),
 +commentT(Comment,​ If, blockComment),​
 +jtAnnotationT(If,​ Comment, suppress, [string_identity_comparison]).
 +</​Code>​
 +
 +=== AST Specification===
 +== ==
 +<​Code>​
 +ast_relation_type_spec(jtAnnotationT,​[
 + ast_arg(id,​ mult(1,1,no ),  id,   ​[jtAnnotationT]),​
 + 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/4.2/jtannotationt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019