Compilation

Please be aware:
  1. Any file which contains a parameterized class or interface, or which refers to a parameterized class or interface, must use the extension .pjava in place of the usual .java.
  2. Because of the extra implementation classes that the translator generates, your destination directory should be a part of your CLASSPATH.

The simple story

In order to compile a .pjava run the wrapper script pjavac. This script translates the parameterized code, stores the translated code in a temporary directory, and compiles the translated code into standard .class files.

For information on the pjavac wrapper, see the provided man page.

The whole story

Not all of the information contained in the .pjava files can be encapsulated in the .class files. Therefore, the translator generates a .pjaux file for each parameterized class. Theses files must (currently) be kept in the same directory as their corresponding .class files.

The wrapper begins by verifying that its temporary directory contains no .java files that it might overwrite Next, for every file listed on the command line, the wrapper calls the translator guavac with the following options:

guavac -P              # Parameterized code
       -F              # Source->source filter
       -t TMPDIR/pjtmp # Send translated .java files to TMPDIR/pjtmp
       -i TMPDIR/pjtmp # Send instantiation .java files to TMPDIR/pjtmp
       -d DESTINATION  # Send .pjaux files to DESTINATION
       source.pjava    # Source file
If the translation is successful, the translator calls javac on all generated .java files, targeting the proper directory. (Since at most one public class may be declared per file, the translator generates more .java files than it reads in) Unless the -X switch is used, all temporary .java files are removed.

Support classes

The container classes Vector, Stack, Dictionary, Hashtable, and Enumeration from java.util have been rewritten to use parameterized types. These classes now exist in the package pjava.util.

Also, the wrapper classes for primitive types are in the package pjava.lang. You don't need to use these directly, but the compiler does, so you should make sure that PolyJava/classes is in your CLASSPATH.

Source for these classes is under PolyJava/pjavaSrc. Note that these classes have not yet been fully tested. Bugs may exist.