Clone wiki

semdiff / FAQs

Frequently Asked Questions

I can't connect to the repository

If you are connecting to a SVN repository, remember that your connection string is based on the URL you use to navigate to the repository. You can even browse around the SVN directory structure to find the right URL. It often just takes some trial and error to get the strings right.

I am working with a non-Java repository. Is there anything to be aware of?

To get SemDiff to download all files from a repository, make sure you

  • Window -> Preferences -> SemDiff -> check "Download All Files"

I am processing older Java code. Is there anything to be aware of?

When processing older Java code (e.g., pre Java 5), you might run into compatibility issues when running one of SemDiff's detectors (e.g., CallDiff). For example, if the old code you're scanning contains variables named 'enum' (which was ok before Java 5 but not for Java 5+), then this can cause problems for PPA during SemDiff's type resolution. To keep things running smoothly, you can try changing the settings for each of the PPA_PROJECTs used during PPA so that they use Java 1.4. To do this:

  • right click on a given PPA_PROJECT
  • select Properties
  • select Java Compiler
  • change the compliance level to 1.4

Make sure you switch back to the appropriate version of Java once you're scanning newer Java code.

SemDiff is really slow or not responding

A number of factors can influence SemDiff's performance.

  • Do you maintain a separate profile/DB for each repository?
  • Do you avoid scanning very large files with PPA?
  • Is the repository connection itself very slow? For some connections (e.g., Hibernate), SemDiff might seem unresponsive, but this might be due to large file transfers when fetching source files. For example, some transactions can involve hundreds of source files.

Hibernate complains when I try to persist my detector's results

I have run into this problem several times. In the past, answering the following questions solved my problems:

  • Does your hibernateClass extend SemDiff's 'Result' class?
  • Have you annotated your hibernateClass with @Entity and @DiscriminatoryValue?
  • Have you properly annotated getters to fields in your hibernateClass? In the case of transient fields, use @Administrator. Otherwise use @Embeddable. Getters include all methods starting with 'get' or 'is'.
  • Have you added 'Eclipse-RegisterBuddy: ca.mcgill.cs.swevo.semdiff.core, org.hibernate.semdiff, org.apache.log4j' to your MANIFEST file?
  • Are any other plug-ins in your workspace using Hibernate? If so, this can lead to complications. If you only require those plug-ins to compile your code, you can try editing your plug-in dependencies by moving the dependency on the problem plug-in from the 'Plugin Dependencies' to the 'Imported Packages' section.

SemDiff can no longer load one of my profiles. What do I do?

This has happened to me a few times when developing my own detector. When this happens, I go through the following steps to create a new DB, which always resolves the issue:

  • Go to the SemDiff Repositories View
  • Select 'Manage Profiles' and delete the offending profile
  • In your file system, navigate to the directory containing your DB.
  • Delete all the hsql-based files
  • Do SemDiff -> Initialize Database, etc., to recreate your DB, profile, and repository.

NOTE: It is recommended that you develop and test your detector using a sandbox DB. It is also recommended that you use a separate DB per repository, so that the impact of a corrupted DB is minimized. Recreating your DB means you have to re-run all your detectors.

How do I reuse existing detectors for my own detector?

For each detector you require

  • Select the extension that declares your detector (in the Manifest file).
  • Right click on the extension and select 'New -> dependency'.
  • Enter the id of the detector you depend on, e.g., ca.mcgill.cs.swevo.semdiff.detector.structdiff
  • To retrieve the results of this detector, use the following code snippet
public DetectorResults detect(Repository repository, Transaction transaction, DetectorInput input) {
    List<Result> results = input.getRequiredResults("ca.mcgill.cs.swevo.semdiff.detector.structdiff");


How does SemDiff implement its 'needsPPA' option?

SemDiff uses the following line of code to run PPA on the left and right files of each change set:

 PPAUtil.getCUs(files, new PPAOptions(true, false, true, true, MAX_METHOD_INVOCATIONS));


where MAX METHOD INVOCATIONS corresponds to the value set in PPA's preference page.