This plugin aims at analysing Java source code compliant with J2SE 5.0 standard and providing a model describing the information found. As shown in next figure, this model can conform either to the J2SE5 metamodel or to the KDM metamodel.
The J2SE5 model contains the full abstract syntax tree of the Java program : each statement such as attribute definition, method invocation or loop is described. In addition, links between elements are resolved (by resolved link we mean for instance a link between a method invocation and the declaration of this method, or the usage of a variable and its declaration). The model can thus be seen as an abstract syntax graph (ASG).
In this version, the only data flow elements (below the method declaration) described in the KDM model are : • The creation of instances (Creates) • The method invocations (Calls) • The return statements returning a variable (UsesType)
To use the plug-in you need:
- JDK 1.5 or above
- a version of Eclipse 3.3 or above with the following set of plugins installed
Gabriel Barbier (Mia-Software)
Fabien Giquel (Mia-Software)
Frédéric Madiot (Mia-Software)
You will find a version of this plug-in in SVN repository.
Here are installation instructions :
- Import project in your workspace using a SVN client.
- Use "export" menu to export this project as a plug-in (Deployable plug-ins and fragments) in your Eclipse installation. Don't forget to choose "Package plug-ins as individual jar archives" option.
- Re-start your Eclipse to take this plug-in into account.
Connection parameters to SVN repository: MoDisco/SVN.
The plugin provides the user with a contextual menu to easily create models.
By right-clicking on a Java Project in the Eclipse Package Explorer view, you can quickly create the J2SE5 or KDM model of your application (see next Figure). Each of these models can then be used with any other tool compliant with the corresponding metamodel.
If you want to create a KDM model using an existing J2SE5 model, you can also right-click on a J2SE5 model file and select “Convert J2SE5 to KDM Model” in the contextual menu (see next Figure).
A progress bar will appear at the bottom of the window as soon as the operation begins. Depending on the size of your application, the reverse engineering and transformation might take some time to complete (see next Figure).
At the end of the process, the newly created model files are added at the root of your project and are automatically opened in the default editor (see next Figure).
.kdm files and .j2se5 files could be opened in the Sample Reflexive Ecore Model Editor (see next Figure).
They could also be opened in MoDisco model browser (see next Figure) which brings some graphical improvements.
Links to unresolved types (types whose declaration is available neither in source code nor in a library) are not created in the KDM model. This should be fixed in the next version.
The actual transformation to KDM creates only the elements describing the structure of the Java application. It means that the instructions contained within a method are not transformed into KDM elements (except instance creations, method invocations and return instructions).
Some particular cases are not yet managed by the transformation: • generic types • enumerations • anonymous classes and any class or interface which is not directly contained in a package.
Those limitations could be managed in future versions. As soon as this project will be available in SVN, a patch will be submitted to correct "generic types" and "anonymous classes" limitations.