IBM Support

The UML-to-Java reverse transform detects changes and prompts to merge even with no change to the code or model since running the forward transform

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:

  1. Create a new UML Modeling project

  2. Right click on the empty model and choose Import Model Library>Deployed Library>RoseJavaDatatypes



  3. Add to the Model a UML Package called package1

  4. Add to the package a UML class called Class1

  5. Add to the Class a UML Attribute called attribute1

  6. Set the Type of the attribute to java::util::Date by browsing inside the RoseJavaDataType library

  7. Drag and drop the class on the diagram.

  8. Open a diagram and choose from the toolbar menu: Diagram->Filters->Show Qualified Name and it will look like this:



  9. Select the menu Modeling->Transform->New Configuration from the toolbar

  10. 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

  11. 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
    }
    }


  12. Run the reverse transform. You will see the following dialog:



  13. Click OK.

  14. 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.

[{"Product":{"code":"SSYK2S","label":"Rational Software Architect Designer"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Java Development","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.0.4;7.0.0.5","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}},{"Product":{"code":"SSJP3D","label":"Rational Systems Developer"},"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Component":"Java Development","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.0.4;7.0.5","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS4JCV","label":"Rational Software Architect for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud \u0026 Data Platform"},"Component":"Java Development","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.1;7.5.2;7.5.3;7.5.4;7.5.5;7.5.5.1;7.5.5.2;7.5.5.3","Edition":"","Line of Business":{"code":"LOB15","label":"Integration"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
10 September 2020

UID

swg21286581