Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Represents an annotation (expression). Java 5 Syntax Element - supported since JTransformer 2.3.
#id: id
the unique ID assigned to this fact.
#parent: id
the ID of the fact that represents the parent of this fact in the prolog AST.
Either the ID of the annotated element or membervaluet fact in case of a nested annotation.
e.g. @Ann2
in @Ann(value = 1, ann1 = @Ann2(id=1))
#encl: id
the enclosing annotated declaration, expression or statement. Here we extended the Java 5 annotation model.
annotationType: classT
the referenced annotation type.
[#keyValue_1,..] :AnnotationExpression, memberValueT
list of IDs of the member value pairs.
@ThisAnnotation("Member") //case 1 private int aField; @ThisAnnotation //case 2 : If the annotation is a marker annotation the expression is private int anotherField; // flagged by a markerAnnotationT(#id) fact.
%case 1 fieldT(#Field, _, #Fieldtype, 'aField', 'null'), annotationT(#Annotation, #Parent, #EnclosingElement, #AnnotationType, [#KeyValue]), literalT(#Literal, #KeyValue, #EnclosingElement, #Literaltype, 'Member'). %case 2 fieldT(#Field, _, #Fieldtype, 'anotherField', 'null'), annotationT(#Annotation, #Enclosing, #Enclosing, #AnnotationType, []), markerAnnotationT(#Annotation).
ast_node_def('Java',annotationT,[ ast_arg(id, mult(1,1,no ), id, [id]), ast_arg(parent, mult(1,1,no ), id, [id]), ast_arg(encl, mult(1,1,no ), id, [id]), ast_arg(annotationType, mult(1,1,no ), id, [classT]), ast_arg(values, mult(0,*,ord ), id, [annotationExpressionType, memberValueT]) ]).