Community
Participate
Working Groups
As requested by Jerome in bug 257528 to file a separate request. In situations where a model (such as UML) is used to define structural elements (such as classes, interfaces, methods, fields), but method-bodies are defined by embedding Java code snippets into the model, it is required while code generation to map references to structural elements in a Java code snippets to the definitions of the structural elements in the model. When an embedded Java code snippet is parsed and bindings are resolved, references to type/method/field are resolved to an ASTNode corresponding to a structural definition in the model. Currently, the mapping from an ASTNode for a type/method/field to corresponding structural element in the model can be achieved by creating a comment for each structural element while code generation, and embedding a unique ID in the comment. While translation, the comment can be extracted, parsed and ID retrieved. However, if there can be a new annotation type (say @id("string")) for type/method/field definitions, then it will easier/cleaner to extract the id because the semantics of @id will be more explicit than parsing and interpreting a comment.