Hi,
I try to define a DSL that looks like:
processor P<T,R> {
in port input: T
out port output: R
}
I infer the JVM model based on the domain model and for each of the processor I create two classes:
class P1<T,R> {
public Port<T> input;
public Port<R> output;
}
class P2<T,R> {
public Port<T> input;
public Port<R> output;
}
Each class (JvmDeclaredType) associates the type parameters using the cloneWithProxies:
for (p: element.getTypeParameters()) {
clazz.getTypeParameters.add(builder.cloneWithProxies(p));
}
Now I'm wondering how to create correctly the fields. If I use:
for (port: element.getPorts()) {
JvmTypeReference jvmType = builder.newTypeRef(port, Port.class, port.getType())
clazz.getMembers().add(builder.toField(port, port.getName(), jvmType)
}
Xtext correctly associates the first one, but of the second class (that is generated after the first one) I get:
class P2<T,R> {
public Port<?> input;
public Port<?> output;
}
I have not figure our how can I re-associate the type parameters when generating the second class.
What is the right way for handling the type parameters across multiple classes?
Thanks a lot!
Filip