Major changes to Polyglot for Version 2.5

See the file CHANGES for more information about the changes made to Polyglot for Version 2.5.

Support for Java 1.5 language features added, through the JL5 extension (polyglot.ext.jl5). This extension is based on the Polyglot for Java 5 project by Milan Stanojevic and Todd Millstein (), with additional input from Vincent Cavé. The extension currently supports all Java 5 langage features, except for annotations, for which only limited support is currently provided. Additional support will be added in later releases.

The source code of Polyglot has itself been updated to take advantage of the generics support introduced in Java 1.5. This may break older extensions that assume non-generic interfaces.

The way Polyglot handles intermediate source files and generated class files has been changed in version 2.5. In previous versions, the back end of the compiler was generating .java files which were stored to the file system and then handed off to javac , unless the -post option was given to specify a different post-compiler. The new standard behavior is to generate Java source code internally, and use the Java compiler support provided in the javax.tools package to invoke javac within the same JVM as Polyglot itself. This change improves performance and lessens dependency on the file system. The original functionality is still available in version 2.5 via the -post option.

The changes made to Polyglot are summarized below. Most Polyglot extensions should require few or no changes to work with version 2.5. If changes are required, the Porting Guide should be helpful.

Design Changes

The following changes to the design are also summarized in the UML diagram below.

Additions

NOTE: Instances of javax.tools.JavaFileManager.Location in polyglot.filemanager.ExtFileManager are set in start() method (of polyglot.main.Main ) by calling addLocationsToFileManager() method of polyglot.frontend.ExtensionInfo interface.


JL5 Extension

The package polyglot.ext.jl5 implements support for Java 1.5 language features. This requires significant changes to the type system to support Java generics. For information on how to write an extension that supports Java 1.5 language features, please see the Porting Guide.

Code can be compiled with the JL5 extension using the jl5c script in the bin directory. The script jl5c adds several new command-line arguments, described below.

FileManager implementation and associated SourceObject

The following UML diagrams show how the different parts of the new file manager implementation are composed.

UML Diagram