Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] Creating non-javadoc comments

Hello,

Is it really not possible to add non-javadoc comments to a org.eclipse.jdt.core.dom <http://jsourcery.com/output/eclipse/3.1/org/eclipse/jdt/core/dom/ASTNode.html> Java source file?

The JavaDoc for BlockComment and LineComment classes mention that:

Note that this node type is a comment placeholder, and is only useful for recording the source range where a comment was found in a source string. It is not useful for creating comments.

Is there no other way? I understand placing the comments in the AST is problematic, and putting them in a seperate list seems like a reasonable solution (https://bugs.eclipse.org/bugs/show_bug.cgi?id=50697 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=105940). But is it really not possible to add new comments to that list?

(Context: I'm looking for the best way for programmatically adding some JML specifications/non-null annotations to Java sources. Those are represented as special comments (things like "/*@non_null*/ Foo foo = new Foo();"))

Kind regards,

Arnout Engelen


Back to the top