Logical Structural Diff

LSDiff first extracts structural facts from each of the two program versions, then use set differencing to construct a list of changes, or deltas. Structural facts include subtyping facts about the class 
hierarchy as well as declarations of field and method class members. LSDiff also captures calls and field accesses relationships betwe a method and its target method or field.

LSDiff infer rules using both the deltas as well as the structural facts. Structural facts which were unchanged between the two versions are included to provide contextual information. Rules follow a Datalog rule syntax---a horn clause where a conjunction of logic literals in the antecedant implies a single literal in the consequent. LSDiff also identifies exceptions, where there is no match for the consequent with constants that satisfy the antecedant.



The old version of Eclipse plug-ins are available here. We are no longer actively maintaining binary releases. Please write to me if you would like to have an access to source code. 

User Guide
1. Using the LSDiff plugin

The LSDiff plugin is implemented as a view. It can be found in Show View -> Other -> LSDiff -> LSDiff Rules
To start, click on the Open Project button.


This will launch the File Selection dialog. This dialog selects the program versions and files to be parsed by LSDiff. There are two ways to select files:

a. Select by Workspace Diff

This feature examines two projects in the current workspace and finds differences between them. It requires the old and new version to be opened as projects in the current workspace.

To find changes by workspace diff, do the following:

i. Create one project in Eclipse for each version of the program and open them. Make sure they are named differently.
ii. Select the earlier version as the base project.
iii. Switch to the 'Workspace Diff' tab and select the later version as the changed project.
iv. Click on 'Get Files' to find changed files.

a. Select by SVN Log

This feature finds differences based on an SVN log. It requires the old version to be opened as a project in the current workspace. The old version must correspond to a particular revision in the SVN repository.

To find changes by SVN log:

i. Make sure the base version is opened as an Eclipse project.
ii. Select the base project.
iii. Enter the SVN URL. This URL must point to the project root (ie not the repository root or to a subfolder in the project).
iv. Enter the base and new revision numbers. The base revision must be identical to the currently selected base project.
v. Click on 'Get Files' to find changed files based on the SVN log.

After selecting versions to compare, start LSDiff by click the OK button. This process may take several minutes. When analysis is done, the rules found by LSDiff will appear in the rules view.

Accuracy refers to how often the consequent of the rule is matched out of the total number of time the antecedent of the rule is matched. Clicking on the Explain button will show the Matches and Exceptions to the rule. Double-clicking will open the location of the selected example in the editor. Right-clicking will open a compare dialog for the old and new versions of the file associated with this example.

2. Interpreting LSDiff results

The result of running LSDiff is a set of ungrounded logic rules and the set of structural facts that support or do not support them.


In this screenshot the selected rule is:

before_accesses("org.xbill/DNS%.TXTRecord#strings",?x0) => deleted_method(?x0,?x1,?x2)There are six facts that support this rule and one exception where the antecedant is found but not the consequent. Facts are structural differences between the program versions. For example, the selected structural changed is the method org.xbill.DNS%.TXTRecord#rrFromWire was deleted in the new version.

LSdiff: A Program Differencing Tool to Identify Systematic Structural Differences, Alex Loh and Miryung Kim, ICSE '10: Proceedings of the 2010 ACM and IEEE 32nd International Conference on Software Engineering, Pages: Volume 2, 263-266, Publisher: ACM DOI Formal Research Demonstrations

Miryung Kim and David Notkin. Discovering and representing systematic code changes. In ICSE '09: Proceedings of the 2009 IEEE 31st International Conference on Software Engineering, pages 309-319, Washington, DC, USA, 2009. IEEE Computer Society.