Project NextGen

Rice University Computer Science Department

JavaPLT Group

javaplt@cs.rice.edu

NextGen is an efficient and compatible extension of the Java programming language with support for generic types. Unlike other extensions of Java with genericity, such as GJ and JSR-14, NextGen does not restrict the programmer from using generic types in "type-dependent" contexts, such as casts, "instanceof" tests, and "new" operations. Nevertheless, NextGen maintains full compatibility with the JVM and existing compiled binaries.

For more information on the NextGen language design and implementation, see the list of papers below.

If you are a new developer on the NextGen project, please read the NextGen Developer's Guide.

The NextGen prototype compiler and classloader, available for download from this site, provide a preliminary implementation of NextGen that may be of use for exploration and experimentation.

NextGen was developed as an extension to the GJ compiler under special license from Sun Microsystems. This same compiler was extended independently by Sun Microsystems to form the JSR-14 prototype compiler, scheduled for inclusion in J2SE 1.5. Because NextGen is upward compatible with JSR-14, it is a potential candidate for inclusion in a future version of Java.

LICENSE

You are free to download the NextGen jar files, and to run the class files in them, but you may not decompile them, redistribute them, or extend their functionality in any way.

THIS SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RICE UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THIS SOFTWARE OR THE USE OF OR OTHER DEALINGS WITH THIS SOFTWARE.

Download

The latest version of NextGen is nextgen-20030322-1610.

This jar file is provided as a beta release of the NextGen compiler. Note that not all features of the complete language are supported yet. Most notably, type-dependent operations on type parameters bound in polymorphic methods are not yet supported. Also, per-instantiation static fields are not yet supported.

Download

Instructions for use

In order to run NextGen, you will need a Java SDK v1.3 or higher. Append the downloaded jar file to your classpath. Also, append all jars containing bootclasses for your SDK to your classpath, so that the compiler has object-level access to them. The location of bootclasses depends on your SDK, but all Sun SDKs place the bootclasses in jre/lib/rt.jar.

To compile a NextGen source file with fully qualified name C.java, type:

java edu.rice.cs.nextgen.compiler.main.Main C.java

To run the main method of a public compiled class with fully qualified name C (where C is accessible from your classpath), type:

java edu.rice.cs.nextgen.classloader.Runner C

A few notes:

  1. The main entry point of your program must be contained in a public class so that the class is accessible by the NextGen classloader. Trying to run the main method of a non-public class will cause an IllegalAccessException. If NextGen were incorporated into a future version of Java, this restriction could be eliminated by giving the NextGen classloader the same access priviledges enjoyed by the default classloader.
  2. The jar file contains a MANIFEST file that allows compilation to be executed with java -jar. However, this usage is not recommended because the only classes available to the compiler will be those inside the jar. In particular, your bootclasspath will not be accessible, making almost all programs uncompilable. Unfortunately, we are legally prohibited from distributing the bootclasses of the Sun JDK (or any other JDK). We recommend constructing shell scripts on your platform of choice to run these programs more conveniently.
  3. Papers on NextGen and Related Topics

    Cartwright, Steele. Compatible Genericity with Runtime Types for the Java programming language. ACM Symposium on Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), Vancouver, British Columbia (OOPSLA) 1998.CiteSeer

    Allen, Cartwright, Stoler. Efficient Implementation of Run-time Generic Types for Java. IFIP WG2.1 Working Conference on Generic Programming, July 2002.pdf

    Allen, Cartwright. The Case for Run-time Types in Generic Java. Principles and Practice of Programming in Java, June 2002. pdf

    Allen, Bannet, Cartwright. Mixins in Generic Java are Sound. Technical Report. December 2002. pdf


    PowerPoint Presentations

    Allen. Efficient Implementation of Run-time Generic Types for Java

    Online Articles

    Allen, December 2000. Behold the power of parametric polymorphism
    Adding generic types to Java could mean less coding and fewer bugs

    Allen, February 2003. Java generics without the pain
    A guide to generics in the Java Tiger version and the JSR-14 prototype compiler


    Send comments, questions, and bug reports to JavaPLT.