Bug 257794 - An annotation type (@id) for class/interface, method, filed definitions
Summary: An annotation type (@id) for class/interface, method, filed definitions
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-06 00:50 EST by Satish C Gupta CLA
Modified: 2008-12-06 00:50 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Satish C Gupta CLA 2008-12-06 00:50:59 EST
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.