Download inCode.Rules Language - LOOSE Research Group

Transcript
3.2. ECLIPSE AS A CODE ANALYSIS PLATFORM
21
application: presentation, persistence, etc.
EMF itself supports three ways of defining a model : (i) Annotated Java code (ii) XML
files (iii) UML schemas build with various UML plugins for Eclipse like Rational Rose
or EclipseUML.
UML
EMF
Model
Java
Annotations
XML
Figure 3.4: EMF unifies UML, Java and XML [BBM03]
Having the written the EMF model in one of the three ways, the developer generates
the following features with the aid of the EMF: (i) A set of java classes, also known as
the Meta-model to be used when building the model, (ii) a set of adapter classes used
when viewing and programatically editing the model, (iii) a basic editor of the model.
3.2.3
Java Development Tools
The Java Development Tools project provides the most features needed for sourcecode quality assurance tools. It has three main components: the Java Model, the
Search Engine and the Abstract Syntax Tree.
The Java Model is a light-weight representation of the Java Projects. It it implemented
in such a way to allow easy navigation, type hierarchies, basic modifying operations,
code completion, resolving etc. even for large scale projects (e.g: 10.000 types). The
Java elements in the Java Model are wrapped by the inCode 3.2.5 plugin. Each entity
in the meta-model of inCode wrapps a different element from the Java Model1 .
The Search Engine in the JDT allows the user to search for java elements by using
regulated expressions. It has a very configurable and powerful user interface in the
Eclipse IDE, but more importantly (to this work) it has an API that allows other plugins to programmatically search for java elements. This feature is heavily used by the
inCode.Rules plugin in order to retrieve java elements.
The Abstract Syntax Tree component provides the features required by refactoring
tools, by Quick Fix and Quick Assist. The Abstract Syntax Tree creates a tree out of
plain java code and thus allows for a more convenient and reliable way to inspect and
change the source-code than a plain text based approach.
1 Except for local variables, method parameters and other entities that are declared inside the method
body: these entities wrap AST nodes.