Skip to main content



      Home
Home » Modeling » Papyrus » Unable to Java round-trip(Unable to reverse engineer Java code generated from UML Class Diagram)
Unable to Java round-trip [message #1775978] Wed, 08 November 2017 13:15 Go to next message
Eclipse UserFriend
I'm trying to do a round-trip with Papyrus and Java, generating Java code from UML Class Diagram model and back.
But the reverse Java code operation into existing model creates the objects in a different branch in the model tree, thus not updating the existing objects.

Basically operations are the following using default values:
1) create a new Papyrus project named Test with a Class Diagram
2) drop a new package in the diagram
3) drop a new class in the package
4) generate Java code
5) reverse engineer the just created Java class using Java Parser

The issue is that when reverse engineering the class gets back in the model with a different Qualified Name Test::Test::Package1::Class1 instead of Test::Package1::Class1.
So reverse is creating a copy of the class in the model and not updating the existing one.

Any help will be appreciated.

Thanks.
Re: Unable to Java round-trip [message #1776267 is a reply to message #1775978] Tue, 14 November 2017 11:11 Go to previous messageGo to next message
Eclipse UserFriend
This is well-known issue and we really should definitely define a common policy for namespaces during generation and reverse.

In the meantime, you can apply the <<Project>> stereotype from [1] on your root element (the model) so it is not generated. You would then have Package1.Class1 in the Java code, rather than Test.Package1.Class1

During reverse, since there is not Test package in the Java code, the reverse will give you Package1::Class1, which is what you want.

Hope this helps.

[1] https://wiki.eclipse.org/Java_Code_Generation#Common_code_generation_profile
Re: Unable to Java round-trip [message #1776409 is a reply to message #1776267] Thu, 16 November 2017 04:19 Go to previous message
Eclipse UserFriend
Thanks a lot, it worked.
Previous Topic:Q: How to change the reference of model element using hyperlink property in Papyrus
Next Topic:Imported C++ registered package
Goto Forum:
  


Current Time: Sat Jul 12 18:41:58 EDT 2025

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

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

Back to the top