Community
Participate
Working Groups
Build ID: Eclipse 3.4 I am doing several tricky things to get the source range of an IMethod's return type. I needed to retrieve the range source of the method, and create a tokenizer/parser to ignore comments until I found the return type of the method. This is not trivial, as c/c++ comments can appear anywhere and are tricky to match correctly. Short of creating an AST on top of the IMethod (which I don't want to do for performance reasons), I would like to get the offset/length of the return type for a method. Similar to: IMethod.getSourceRange() IMethod.getJavadocRange() IMethod.getNameRange() Proposed method name: IMethod.getReturnTypeRange()
Note that you can create a lightweight DOM AST (without statements), performance is not so bad then.
(In reply to comment #1) > Note that you can create a lightweight DOM AST (without statements), > performance is not so bad then. > Can this be done using public API?
DOM AST is public API.
Pls read this: http://help.eclipse.org/stable/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/dom/ASTParser.html#setFocalPosition(int)
Is this still required ?
(In reply to comment #5) > Is this still required ? The technique mentioned in comment 4 seem adequate. This bug can be closed.
Thanks. Can be done using existing APIs. See comment 4. Closing as INVALID.
verified for 3.6M5.
Verified.