Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [JET] Can JET read the binding information of a AST node?
[JET] Can JET read the binding information of a AST node? [message #664448] Fri, 08 April 2011 22:35 Go to next message
yongjiezheng is currently offline yongjiezhengFriend
Messages: 10
Registered: March 2011
Location: California
Junior Member
Hi,

JET can read .java, which is pretty cool. Now I need to read the super (parent) interface of a java interface (parsed as AST). Without access to its binding information, i can only get the name of this super interface (nodeType: SimpleType). Can JET read bindings as well?

Any advice would be highly appreciated.

William
Re: [JET] Can JET read the binding information of a AST node? [message #664946 is a reply to message #664448] Tue, 12 April 2011 14:55 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
William, you wrote:

Quote:
Can JET read bindings as well?


Short answer: no

Long answer:

A quick look at the code (I don't have more time than that today) indicates JET does not see bindings:
* Bindings implement IBinding and the AST inspector works on ASTNode (and subtypes).
* Second (although this can be overcome), the ASTs that JET creates do not request binding information.

Pragmatically, I'd suggest a simple 'tactical' solution:

1) make sure that AST's you care about are created with binding information. This would be a job for your custom JET tag.

2) Implement an XPath function that resolves the bindings on the ASTNodes you care about, and returns it in a useful form - perhaps fully-qualified names that you can pass to your custom tag?

If you wanted to be more general, you could implement full reflection of bindings (so that XPath expressions could traverse them). This would require a fair dive into understanding how bindings work and how JET's inspectors work.

You would also need to figure out how to resolve bindings from the AST. Again, in the ideal world, the ASTNode inspector would call the requisite 'resolveBinding' methods for you. But, that's not going to happen this release. A decent alternative is an XPath function.

Paul
Re: [JET] Can JET read the binding information of a AST node? [message #665206 is a reply to message #664448] Wed, 13 April 2011 16:29 Go to previous message
yongjiezheng is currently offline yongjiezhengFriend
Messages: 10
Registered: March 2011
Location: California
Junior Member
Hi Paul,

Thanks so much for your replies.

Can I just create another AST for this super interface (using the created custom tag that accepts qualified name of an interface)? What I want is method declarations of this super interface, and let's assume that somehow I can get its qualified name. The only thing I'm not sure is if I can use JET to traverse an AST that is created from binary (class) files, since the source code of this super interface may not be available.

I haven't tried this yet, but do you think it is possible?

Thank you,
William
Previous Topic:[Acceleo] How to create a generator for composed metamodels
Next Topic:Re: [Xtend / Check] using multiple check files
Goto Forum:
  


Current Time: Sun Oct 06 20:51:01 GMT 2024

Powered by FUDForum. Page generated in 0.03513 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top