Troubleshooting
Problem
Why are you prompted to merge the transformed model after running the UML to Java reverse transform in IBM Rational Software Architect even if no change was made to the code or the model since running the forward transform?
Symptom
Steps to reproduce:
- Create a new UML Modeling project
- Right click on the empty model and choose Import Model Library>Deployed Library>RoseJavaDatatypes

- Add to the Model a UML Package called package1
- Add to the package a UML class called Class1
- Add to the Class a UML Attribute called attribute1
- Set the Type of the attribute to java::util::Date by browsing inside the RoseJavaDataType library
- Drag and drop the class on the diagram.
- Open a diagram and choose from the toolbar menu: Diagram->Filters->Show Qualified Name and it will look like this:

- Select the menu Modeling->Transform->New Configuration from the toolbar
- Create a new configuration for the UML to Java transformation, and enable the reverse transformation. Create a new target container which needs to be a Java Project, called MyJavaProject
- Run the forward transform. This will generate the following code as expected:
Disclaimer All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
/**
*
*/
package package1;
import java.util.Date;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @author authorName
*
* @generated "UML to Java
(com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public class Class1 {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
private Date attribute1;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the attribute1
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public Date getAttribute1() {
// begin-user-code
return attribute1;
// end-user-code
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param theAttribute1 the attribute1 to set
* @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
*/
public void setAttribute1(Date theAttribute1) {
// begin-user-code
attribute1 = theAttribute1;
// end-user-code
}
}
- Run the reverse transform. You will see the following dialog:

- Click OK.
- Look at the class diagram. The attribute is now duplicated:

As you can see, the newly created attribute has a type that is defined in the Java project. The old attribute is still present.
Log InLog in to view more of this document
Was this topic helpful?
Document Information
Modified date:
10 September 2020
UID
swg21286581