Design, java code generation and template parameters [message #1786192] |
Thu, 26 April 2018 12:46  |
Eclipse User |
|
|
|
Hello
a coworker tries to generate java code with classifier template
to test we have
- Class T
- Class T1 extends T
- Class List, classifier template parameter T
- method foo returns T
- Class MyList extends T with a binding T1 -> T
but at java code generation
- Class List<T> : OK but method foo returns packageName.T and not T
- Class MyList is not generated.
is it something managed
we use Eclipse v4.7 oxygen, Papyrus 3.3.0.2018, Designer 1.0.5
[Updated on: Thu, 26 April 2018 12:48] by Moderator
|
|
|
|
|
Re: Design, java code generation and template parameters [message #1787008 is a reply to message #1786921] |
Thu, 17 May 2018 05:16  |
Eclipse User |
|
|
|
I tried the code generation from my sample model (which might not correspond to yours). In this model, class List defines a template parameter (DataType) T in its signature, the operation foo returns this type. MyList has a template binding relationship with list in which T is bound to class MyListElem. Class ListUser declares an attribute list of type MyList.
The code generated for List and ListUser looks ok (see below). No code is generated for MyList itself, but I don't consider this as a bug: there is no Java means to declare such a binding, you just use the bound classes at different places, such as the attribute declaration in class ListUser.
public class List<T> {
/** ... */
public T foo() {
return null;
}
};
public class ListUser {
public List<MyListElem> list;
};
|
|
|
Powered by
FUDForum. Page generated in 0.42337 seconds