jdt2famix 1.0.1

Over the last couple of weeks I worked on a new importer for Java code that can be used for Moose, and I am happy to announce that I released version 1.0.1.

jdt2famix is an open-source project, and the repository can be on Github. It is implemented in Java as a standalone project, and it is based on JDT Core (developed as part of the Eclipse project and available under the EPL2 license) and Fame for Java (originally developed by Adrian Kuhn and is available under the LGPL license).

The current implementation has an extensive coverage of entities that it can import, namely:

  • classes, parameterizable classes, parameterized types, enums, anonymous classes, inner classes
  • annotation types, annotation type attributes
  • annotation instances, annotation instance attributes
  • methods, constructors, class initializers
  • parameters, local variables
  • attributes, enum values
  • accesses
  • invocations, constructor invocations, class instantiations
  • thrown exceptions, caught exceptions, declared exceptions
  • comments associated with named entities
  • source anchors for named entities

The simplest way to use it is through the command line:

  1. Download and unzip the self contained binary 1.0.1 release.
  2. Go to the root folder where you have the sources and dependency libraries of a Java system (e.g., mysystem)
  3. Execute /path/to/jdt2famix.sh

The result will be an MSE file having the same name as the name of the folder from which you executed the command (e.g., mysystem.mse).

Let’s look at a concrete example. For this purpose, we pick the Maven project. We first download the 3.3.9 sources. These are only the plain sources, but to be able to import the complete model, we also need to have the dependencies available in the same folder.

As Maven is a Maven project (no pun intended), we can use the configuration to download the dependencies locally:

mvn dependency:copy-dependencies -DoutputDirectory=dependencies -DoverWriteSnapshots=true -DoverWriteReleases=false

(If you do not have a Maven project, you have to adapt this step and obtain the dependencies depending on the specifics of your project)

Then we simply execute:

/path/to/jdt2famix.sh

And we get a maven-3.3.9.mse file that we can load into Moose.

Maven-3.3.9.png

Posted by Tudor Girba at 3 August 2016, 4:08 pm with tags tooling, moose link
|