Bug 46126 - [DCR] IBinding should have a method to check @since javadoc tag
Summary: [DCR] IBinding should have a method to check @since javadoc tag
Status: RESOLVED DUPLICATE of bug 50683
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 50683 50697
Blocks:
  Show dependency tree
 
Reported: 2003-11-05 14:32 EST by Kelvin CLA
Modified: 2004-01-29 08:11 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kelvin CLA 2003-11-05 14:32:28 EST
Similar to IBinding.isDeprecated(), it will be helpful if IBinding also have 
another method to return JDK version from @since javadoc tag.

e.g @since JDK1.2

return JDK1.2
Comment 1 Philipe Mulet CLA 2004-01-08 06:56:50 EST
DOM AST will soon provide support for surfacing comments. In particular, you 
should be able to look for any given tag defined in a javadoc.
Comment 2 Philipe Mulet CLA 2004-01-29 08:02:16 EST
General purpose comment support got added to DOM AST API. 


*** This bug has been marked as a duplicate of 50683 ***
Comment 3 Frederic Fusier CLA 2004-01-29 08:04:52 EST
With new API, here a code sample which can match your requirement:

Javadoc docComment = methodDeclaration.getjavadoc();
Iterator tags = docComment.tags().listIterator();
String version = null;
while (tags.hasNext()) {
  TagElement tagElement = (TagElement) tags.next();
  if ("@since".equals(tagElement.getTagName())) { // tag name may be null!
  if (tagElement.fragments().size() > 0) {
    ASTNode fragment = (ASTNode) fragment.next();
    if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
      TextElement text = (TextElement) fragment;
      version = text.getText();
      break;
    }
  }
}
// Here you have version = "JDK1.2" :))
Comment 4 Frederic Fusier CLA 2004-01-29 08:11:34 EST
Sorry:
Javadoc docComment = methodDeclaration.getJavadoc();
...
assuming that methodDeclaration is kind of 
org.eclipse.jdt.core.dom.BodyDeclaration