Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Utilities for Jvm type analysis
Utilities for Jvm type analysis [message #727036] Tue, 20 September 2011 08:38
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm working on a DSL that refers to existing Java classes by means of
the JvmTypes. There are references to parameterized classes and their
methods, and I need to be able to find the resulting method types
(return value and parameters). E.g. suppose the following interface
definition exists:

interface I<T> {
public T m1();
public int m2(T t);
}

In my DSL there will be references to I with type arguments, e.g.
I<String> and references to m1 and m2. In a code generator I need to
infer that m1 now returns String and m2 takes a String argument. I see
two possible strategies:
1) Create a copy of the interface where type parameters are replaced by
the type arguments and use a scope provider that returns this structure,
so the method references are resolved to this structure.
2) Create a copy (as above) afterwards and use the mapping to link m1
and m2 to their copies with return and argument types now bound to
String instead of T.

Before trying this I would like to know which approach will work, and
whether the Jvm type system already has code that does similar things
(which I bet it has, it has to be doing similir analysis all the time).

Hallvard
Previous Topic:Where can I find the changes list from XTEXT version 2.0.0 to version 2.0.1
Next Topic:MWE/xtend - Clean output directory before compilation
Goto Forum:
  


Current Time: Tue Apr 23 11:39:45 GMT 2024

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

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

Back to the top