[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-core-dev] Creating non-javadoc comments
|
Technical questions and discussions about using eclipse and eclipse-based
tools, and developing plug-in tools should be posted to the newsgroups.
Mailing lists at eclipse.org are intended for use by developers actually
working on or otherwise contributing to day-to-day development. The
development mailing lists are the way design and implementation issues are
discussed and decisions voted on by the committers.
Having said that, org.eclipse.jdt.core.dom.CompilationUnit comments list
is not modifiable (see java.util.Collections.unmodifiableList(List)),
so you can't use it to add any comment.
There are currently two ways to add these kind of comment in a compilation
unit:
1) insert the comment in the source as a string and parse again the
compilation unit
2) use current ASTRewrite API to insert a new BlockComment/LineComment.
For solution 2), go to in eclipse.tools.jdt newsgroup and have a look at
code snippet provided in my answer of Message "Adding a BlockComment to
AST"
posted on 10/06/2004.
HTH
Cordialement/Regards,
Frédéric
Arnout Engelen
<arnouten@xxxxxxx
t> To
Sent by: "Eclipse JDT Core developers list."
jdt-core-dev-boun <jdt-core-dev@xxxxxxxxxxx>
ces@xxxxxxxxxxx cc
Subject
04/19/2006 01:23 [jdt-core-dev] Creating non-javadoc
PM comments
Please respond to
"Eclipse JDT Core
developers list."
<jdt-core-dev@ecl
ipse.org>
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
_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-core-dev