Screwing around with GJ/VGJ.

C. Scott Ananian


I've been playing with the various prototype compilers that Sun has been releasing as part of its "Extending the Java Programming Language with Generic Types" project (JSR-14). I've been programming with JSR-14 for about two years now, since the early 1.0 prototypes. In May Sun released version 2.0 of the prototype compiler, with support for variance and JSR-201 (enumerations, autoboxing, for loop enhancements, and import of static members). This page has been updated accordingly.

This page is a place to collect my various work on GJ-related things, including a more-readable syntax for variance and foreach, SinjP, a javap tool that works on v2.0 JSR-14 class files, SinjDoc, a javadoc tool that works on JSR-14 source files, a LALR(1) grammar for JSR-14 (see also Eric Blake's work), and a a list of bugs I've found in the 2.0 prototype. The current prototypes are *almost* but still-not-quite able to compile FLEX; I'll probably keep hacking on things until the GJ compiler is bug-free and usable enough to let me get Real Work Done on FLEX.

It's worth noting that, in addition to JSR-14 and JSR-201, also proposed for Java 1.5 are JSR-133 (revisions to the java memory model and threads) and JSR-181 (a metadata facility). There is also an official page for VGJ, the variance-enabled compiler.

I (and others) have also written a package of parameterized collections classes which greatly extend the power of the standard java.util library. This library was originally developed for the FLEX project.


When will the next GJ prototype be released?

Neal Gafter at Sun implies that it may be before August. J2SE 1.5 Beta 1, with JSR-14 and JSR-201, may be in November.

SinjDoc: a Javadoc-like tool for JSR-14

This is still in active development. You can download the current version 0.3 sources; caveat emptor. API documentation (no frames version) generated by the tool is also available, as is a list of changes made since the last release. Version 0.3 of SinjDoc is not able to parse variance declarations or JSR-201 syntax (introduced in prototype 2.0 of the JSR-14 compiler).

Sign up on the SinjDoc-Announce mailing list to be notified of new releases of SinjDoc.

For a good example of what this tool can do, look at the generated documentation for the FLEX compiler infrastructure, which is generated using it.


SinjP: a Javap-like tool for JSR-14

I've written a no-frills javap-like tool that a) doesn't choke on bytecode emitted by the JSR-14 compiler, as does the standard Sun javap, and b) actually parses the JSR-14 Signature attribute to emit the correct parameterized signature for the methods in the class. This was invaluable to be in looking through the jar files supplied with the prototype compilers to look for what had changed. Maybe it will be helpful to you, too. I've updated it to support the new signature format of the 2.0 prototype.

To use:


Updated javadoc for standard libraries

Not yet updated for prototype 2.0.

The 1.2 prototype compiler updated the "generic"-ified Collections (and other?) APIs, but did not come with updated javadoc. As a result, your existing code which extends Collections tends to mysteriously fail because your type signatures no longer match properly. (It didn't help that the prototype compiler used to crash hard for some of these mismatches.) So --- to ease your pain, I've gone through the javadoc with the help of my javap-like tool below and manually tried to fixup the javadoc to be accurate. Note that this is accurate to what's shipping now with the 1.3 prototype; note my list below for details on what I think may be "broken" in this release and thus slated for change in future releases.

So, without further ado, here are some links to the goodies:


Bug list for 2.0 prototype compiler

Old bug list for 1.3 prototype compiler.

Old bug list for 1.2 prototype compiler.

Here are the bugs I know about or suspect are in the 2.0 prototype compiler. Note that these may or may not have been confirmed by the good folk at Sun, so some of these might actually be "features" in disguise.

Items in red are those I consider "showstoppers". There are seven of them so far; I've been very conservative marking things showstoppers, not marking them if there seems to be a manageable workaround, the bug might be construed as simply a "missing feature", or (as in the -novariance bugs) there is any doubt as to whether the bug will be relevant for the "final" JSR-14 spec. Your opinions as to seriousness may well vary from mine.


C. Scott Ananian
cscott cscott.net

Valid XHTML 1.0!