Compare Java Classes

This workflow performs a comparison of two sets of Java class files, and generates a report showing the comparison results.

Uploading Java Files

Before you begin, you will need to upload the appropriate Java files to the LiveCompare server.

Preparing the Workflow

To prepare the Compare Java Classes workflow, drag its workflow template from the Templates folder into your own workspace, and modify the workflow as follows:

To specify the source Java class files:

  1. Select the Source Java Classes parameter and choose ‘Edit String List’ from its context menu to display the String List Editor dialog.

  2. Click 'Lookup' in the String List dialog, select the source java class files to be compared, then click 'Save'.

  3. Click 'Save' to close the String List dialog.

To specify the target Java class files:

  1. Select the Target Java Classes parameter and choose ‘Edit String List’ from its context menu to display the String List Editor dialog.

  2. Click 'Lookup' in the String List dialog, select the source java class files to be compared, then click 'Save'.

  3. Click 'Save' to close the String List dialog.

Save the workflow using the 'Save' toolbar button.

Running the Workflow

To run the Compare Java Classes workflow, click the ‘Run’ toolbar button, choose ‘Run Now’ from the diagram’s context menu, or press F5. The currently running workflow action is marked with an animated display. When the workflow execution has completed, select the Report URL dataset and choose ‘View Details’ from the context menu access the generated report.

In the report:

  • Classes that exist in the source Java files only are marked as 'In1'.

  • Classes that exist in the target Java files only are marked as 'In2'.

  • If a class exists in both the source and target files, its methods are compared by comparing their signatures. If the signatures are the same, the class is marked 'Same'. If the signatures are different, the class from the source files is marked as 'In1', and the class from the target files is marked as 'In2'. Note that because Java supports overloading (two methods with the same name but with different arguments), it is not possible to mark a method as 'Different'.