JavaGI
JavaGI is a conservative extension of Java 1.5 that generalizes interfaces with concepts from Haskell type classes. In particular, JavaGI supports the following features:
- Interfaces can have retroactive implementations.
- Interfaces can specify binary methods.
- Interfaces can span multiple types.
- Interfaces can support multiple dispatch.
- Interfaces can have type-conditional implementations.
- Interfaces (and classes) can have type-conditional methods.
- Interfaces can have static methods.
- Interface implementations can be type-checked in a modular way.
- Interface implementations can be loaded dynamically.
As a result, JavaGI unifies formerly separate language extensions and renders many anticipatory uses of design patterns such as Adapter, Factory, and Visitor obsolete. Moreover, JavaGI allows several extension and integration problems to be solved more easily.
There exists a full-blown Implementation and an Eclipse Plugin for JavaGI.
We provide two implementations of JavaGI:
- a full implementation supporting all features of JavaGI and Java 1.5
- a protype implementation supporting JavaGI's core features but not the full Java 1.5 language
It is highly recommended to use the full implementation.
Full implementation
The full implementation of the JavaGI compiler is based on the Eclipse Java Compiler and made available under terms of the Eclipse Public License. We provide releases in source and binary form.
The binary release is self-contained, no external libraries are needed. To invoke the JavaGI compiler, simply execute the command
java -jar javagic-X.X.X.jar
, where X.X.X
is the correct version number. (An Ant plugin
will be available soon.)
The resulting bytecode runs on every Java 1.5 compliant JVM, just make sure that the file javagi-rt-X.X.X.jar
is in your classpath.
Starting with release 0.4.0, JavaGI provides a custom class loader which allows for less strict runtime checks.
To use the custom class loader, you must start your application through the command
java jvm-opts javagi.runtime.Main application-mainclass application-args
(make sure that the file javagi-rt-X.X.X.jar
is in your classpath).
Instructions for building from source are included in the README
file shipped with every source release.
Downloads
Version | Date | Source release | Binary release |
0.7.0 | 2009-12-07 | javagi-src-0.7.0.tar.gz | javagic-0.7.0.jar, javagi-rt-0.7.0.jar |
0.6.0 | 2009-07-27 | javagi-src-0.6.0.tar.gz | javagic-0.6.0.jar, javagi-rt-0.6.0.jar |
0.5.0 | 2009-06-19 | javagi-src-0.5.0.tar.gz | javagic-0.5.0.jar, javagi-rt-0.5.0.jar |
0.4.0 | 2009-04-04 | javagi-src-0.4.0.tar.gz | javagic-0.4.0.jar, javagi-rt-0.4.0.jar |
0.3.0 | 2009-03-25 | javagi-src-0.3.0.tar.gz | javagic-0.3.0.jar, javagi-rt-0.3.0.jar |
0.2.0 | 2009-03-04 | javagi-src-0.2.0.tar.gz | javagic-0.2.0.jar, javagi-rt-0.2.0.jar |
0.1.0 | 2009-02-09 | javagi-src-0.1.0.tar.gz | javagic-0.1.0.jar, javagi-rt-0.1.0.jar |
Prototype implementation
The prototype implementation is written in
Haskell and
released under the GPL.
Detailed installation instructions are provided in the
README
file distributed together with the program code.
Downloads
Version | Date | Source release |
0.1 | 2009-01-19 | core-javagi-0.1.tar.gz |
The JavaGI Eclise Plugin (JEP) is a way to use the familiar Eclipse IDE with the new language constructs proposed by JavaGI. The aim is to provide a drop-in replacement for the Eclipse Java Development Toolkit (JDT). The functionality is still a bit rough, but you can already perform most of the basic development tasks.
In its current version, JEP supports the following features:
- Transforming a Java project to a JavaGI project
- Compiling a JavaGI project
- Build-path setup, just as in JDT
- Running a JavaGI program
- A basic JavaGI-aware editor
- (Most of the) refactorings work
- Ctrl-Space content assist works (in most places)
(Some of) the features JEP still doesn't support:
- JavaGI debugging
Within JavaGI projects you can use classes from other Java Projects and from other jars, the build path works like in JDT. You can also have a normal Java project which can use classes from JavaGI.
Getting Started
- Install JEP through Eclipse's update mechanisms (
Help -> Software Updates...
). The update URL is http://www.informatik.uni-freiburg.de/~wehr/javagi/eclipse-plugin/. - Create a fresh Java project.
- Convert the Java project into a JavaGI project by right-clicking on the project
and selecting
Enable JavaGI
from theJavaGI
menu.
Warning: The current version of the JEP contains version 0.6.0 of the JavaGI compiler.
Development
The JavaGI Eclipse Plugin has been developed by Alina Swiderska
(Email: alina DOT swiderska AT gmail DOT com
-
Stefan Wehr and Peter Thiemann
On the Decidability of Subtyping with Bounded Existential Types
In Proceedings of the Seventh Asian Symposium on Programming Languages and Systems. Lecture Notes in Computer Science, vol. 5904, Seoul, South Korea. SPRINGER, 2009. -
Stefan Wehr and Peter Thiemann
JavaGI in the Battlefield: Practical Experience with Generalized Interfaces
In Proceedings of the 8th International Conference on Generative Programming and Component Engineering (GPCE 2009). Denver, Colorado, USA. ACM, 2009. -
Stefan Wehr and Peter Thiemann
Subtyping Existential Types
In 10th Workshop on Formal Techniques for Java-like Programs FTfJP 2008, informal proceedings. Paphos, Cyprus. 2008. -
Stefan Wehr, Ralf Lämmel, and Peter Thiemann
JavaGI: Generalized Interfaces for Java
In Erik Ernst, editor, Proceedings of the European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 4609, pp. 347-372, Berlin, Germany. Springer, 2007.
The file javagi-mode.el defines a very simple Emacs mode for JavaGI. I've tested the mode with GNU Emacs 22.3 and XEmacs 21.4.