Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330416

Summary: Enhancement request for the Java AST/DOM package. A helper method to get a new Type ast node that corresponds to a given ITypeBinding.
Product: [Eclipse Project] JDT Reporter: Jochen Huck <jochen.huck>
Component: CoreAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: amj87.iitr, deepakazad, markus.kell.r, Olivier_Thomann
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
This is the code I currently use to deal with the mentioned problem none

Description Jochen Huck CLA 2010-11-16 19:57:16 EST
Build Identifier: I20090611-1540

I had the problem that I needed to get a new org.eclipse.jdt.core.dom.Type ast node that corresponds to a given org.eclipse.jdt.core.dom.ITypeBinding. Currently you have to code all of that stuff yourself. So it would be nice to have a helper method that aleady allows to get the corresponding Type ast node.

I'll attach the code I am currently using later on via "Add an Attachment".

Reproducible: Always
Comment 1 Jochen Huck CLA 2010-11-17 09:58:17 EST
Created attachment 183304 [details]
This is the code I currently use to deal with the mentioned problem
Comment 2 Ayushman Jain CLA 2010-11-18 01:51:10 EST
Satyam, please follow up. Thanks!
Comment 3 Olivier Thomann CLA 2010-11-18 08:28:52 EST
I think we should think of what helper methods we could provide as API.
For DOM/AST usage, users need to do the same thing over and over again. It would be good if we could come up with a list of utility methods that could be reused by all users of DOM API.

Markus, would you have any suggestions ?
Comment 4 Markus Keller CLA 2013-01-29 10:39:50 EST
In general, the mapping from ITypeBinding to a Type node can only be done correctly when imports are taken into account.

For this, there's already API, e.g.:
org.eclipse.jdt.core.dom.rewrite.ImportRewrite#addImport(ITypeBinding, AST)