Is it possible to reuse EMF-based tools with Java source code ? Yes if you have your Java source code translated into an EMF model.
This is the aim of the Java component provided by MoDisco. This component is composed of a ECore definition of a java application and a discoverer which creates EMF models from an EClipse project containing Java source code.
The ECore definition declares all the concepts of the Java language : Package, ClassDeclaration, MethodDeclaration, Parameters, VariableDeclaration, IfStatement, Assignment, CastExpression, LineComment, ...
- You can extend the analysis to dependencies (the JAR used by the project).
- You can use an incremental mode if you need to optimize the memory usage
- You can limit the analysis to declaration members if you don't need a model of the instructions contained within the methods
- You can use a filter to exclude Java classes during the analysis
The result is an EMF model which can be opened with the EMF reflexive editor or with the MoDisco generic browser. This browser allows accessing directly to instances of a specific class (for example all the MethodDeclarations) and navigating through all the references (composed or not).