Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Design, java code generation and template parameters
Design, java code generation and template parameters [message #1786192] Thu, 26 April 2018 16:46 Go to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 426
Registered: July 2009
Senior Member
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 16:48]

Report message to a moderator

Re: Design, java code generation and template parameters [message #1786898 is a reply to message #1786192] Tue, 15 May 2018 07:26 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 426
Registered: July 2009
Senior Member
somebody already tested it ? I've found in the code some elements dealing with it so I don't understand it is not working :(



Re: Design, java code generation and template parameters [message #1786921 is a reply to message #1786898] Tue, 15 May 2018 15:32 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 169
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Tristan,

sorry for the late reply. I have some trouble to understand the example: Why does MyList extend T and why is T1 is bound to T? I would rather expect that MyList has a template binding relationship with List in which T (the formal parameter) is bound to some other type (T -> otherType), but no inheritance from T. It seems that you are binding T1 which is not a parametered element of the signature (if I understand the setup right). Can you eventually post your example model?

Ansgar
Re: Design, java code generation and template parameters [message #1787008 is a reply to message #1786921] Thu, 17 May 2018 09:16 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 169
Registered: March 2011
Location: Paris Saclay, France
Senior Member
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;
};
Previous Topic:create a new sysml project/diagram
Next Topic:How can I integrate papyrus plugin in my rcp application? I want to access papyrus editor in my rcp
Goto Forum:
  


Current Time: Fri Nov 16 11:57:07 GMT 2018

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

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

Back to the top