Login | Register
My pages Projects Community openCollabNet

Wiki: <<Subsystem>> Java - Code Generation and Reverse Engineering

2020-04-07: This site is going to be decommissioned and shut down on 2020-07-01. Please copy and archive any data you wish to keep before that date.

Edit this page | Links to this page | Page information | Attachments | Refresh page

to allow the model to be converted into java code and updated either in java or in the model; to allow some java code to be converted into a model.

org.argouml.language.java in the argouml-java project.


<<Layer>> Loadable subsystems

Design of the subsystem

Which sources are involved?

The package org.argouml.uml.reveng is supposed to hold those classes that are common to all reverse engineering (RE) packages. At the moment this is the Import class which is mainly responsible to recognize directories, get their content and parse every known source file in them. These are only Java files at the moment, but there might be other languages like C++ in the future. With this concept you could mix several languages within a project.

The package org.argouml.uml.reveng.java holds the Java specific parts of the current RE code. C++ RE might go to org.argouml.uml.reveng.cc, or so...

How is the grammar of the target language implemented?

It is an Antlr ( http://www.antlr.org) grammar, based on the Antlr Java parser example. The main difference is that the AST (Abstract Syntax Tree) generation and tree-parser have been removed. The ArgoUML code parses the source file and generates Model subsystem objects directly from the sources. This was done to avoid the memory usage of an AST and the frequent GC while parsing many source files. The disadvantage of this approach is that it requires multiple parser passes rather than being able to work from the pre-parsed AST.

Which model/diagram elements are generated?

The *context classes hold the current context for a package, class etc. When the required information for an object is available, the corresponding Model subsystem object is created. The collection of newly created model elements is returned to the common Import code where it can be used to add the elements to a diagram or diagrams if the user has so requested.


<<Subsystem>> Java - Code Generation and Reverse Engineering (last edited 2009-03-06 15:08:31 -0700 by linus)