Graph Library in Java Generics

The library was developed and tested with preview release 1.3 of generics for Java available from

The source code for the graph library is in the gj subdirectory. It can be compiled using the command javac *.java. Several test programs are provided; these are the classes whose names end with _test.

The code is somewhat different from that presented in the paper. Many more type parameters are either not fully generic (i.e. an interface is passed as a method parameter rather than a type parameter) or have weaker constraints than they should. This is due to the fact that the type parameter deduction algorithm for Java generics (in this paper) does not derive type parameter values from constraints on other parameters. For example, the following code will not work:

public static <V, I extends Iterator<V>> void m(I i) {}
m(new ArrayList<Integer>().iterator());

Adding this feature to the Java generics implementation would allow associated types to be represented more directly in the graph library.