Java4moose

Java4Moose is an importer of Java for Moose. It extends the list of already defined importer. Java4Moose features:

Parsing of Java 1.5 files (this includes generics, static imports, assertions, ...) Extracting class and interface hierarchy, class dependencies Java4Moose is being written by Alexandre Bergel.

Download

Connect to the Store at SCG (db.iam.unibe.ch:5432_scgStore, storeguest/storeguest). See the download section for more information. Simply load the package JavaSupport4Moose. You may run the unit test class Java4MOOSETest to ensure that Java4Moose has been loaded in a safe and sound manner. All test should be green.

How to use Java4Moose

A new entry should appear in the popup menu raised by the "..." button. The picture below illustrates this.

Screenshot

A file browser shows up after having clicked on importing a Java model.

Java and Famix

Classes and interfaces contained in a .java file is mapped into a FAMIXClass. Only methods signatures are imported. Class references are extracted from method bodies, but the whole structure of a method is discarded. Enum are discarded as well.

Using Mondrian

Mondrian is a great tool to visualize models. Open a mondrian easel on a Java model, and use scripts to render your model. A list of scripts may be found on Mondrianscripts.

Limitation

The parser contained in the Sun’s compiler is written by hand. It accepts some wrongly defined Java file that are not accepted by the parser contained in Java4Moose. After having loaded the Swing Java library, it results that trailing commas after the last entry of an enum data type are not accepted. While waiting for us to fix this issue, you may remove the character from the .java file directly. Sorry for the inconvenience

Performances

Thanks to the excellent parser generator SmaCC, importing the 378 classes and 4947 method of the whole Java GUI library AWT takes only 7.4 seconds on a MacBook with 1 Gb.

Related work

There has been a lot of work on bridging Moose with the Java world. The most two relevant project going in that direction are Moose Brewer and Penumbra. Moose Brewer is an Eclipse plugin to generate MSE file from an Eclipse project. Penumbra is a Visualworks application that makes the Eclipse application steerable within Smalltalk. Queries toward Eclipse may be directly formulated in Smalltalk. Java4Moose is a pure Smalltalk solution to directly import Java files.

License

The license of Java4Moose is rigorously the same than the one adopted by Moose.