Bug 255275 - API request: Need an efficient way to get the ISourceRange of IMethod's return type
Summary: API request: Need an efficient way to get the ISourceRange of IMethod's retur...
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-13 15:43 EST by Min Idzelis CLA
Modified: 2010-01-25 05:58 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Min Idzelis CLA 2008-11-13 15:43:02 EST
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()
Comment 1 Philipe Mulet CLA 2008-11-14 05:42:06 EST
Note that you can create a lightweight DOM AST (without statements), performance is not so bad then.
Comment 2 Min Idzelis CLA 2008-11-14 09:40:43 EST
(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?
Comment 3 Philipe Mulet CLA 2008-11-14 11:55:13 EST
DOM AST is public API.
Comment 5 Olivier Thomann CLA 2010-01-22 13:07:29 EST
Is this still required ?
Comment 6 Min Idzelis CLA 2010-01-22 13:42:24 EST
(In reply to comment #5)
> Is this still required ?

The technique mentioned in comment 4 seem adequate. This bug can be closed.
Comment 7 Olivier Thomann CLA 2010-01-22 13:45:12 EST
Thanks.
Can be done using existing APIs.
See comment 4.

Closing as INVALID.
Comment 8 Ayushman Jain CLA 2010-01-25 05:46:09 EST
verified for 3.6M5.
Comment 9 Srikanth Sankaran CLA 2010-01-25 05:58:57 EST
Verified.