com.google.gwt.core.ext
Class Linker

java.lang.Object
  extended by com.google.gwt.core.ext.Linker
Direct Known Subclasses:
AbstractLinker, SoycReportLinker

public abstract class Linker
extends java.lang.Object

Defines a linker for the GWT compiler. Each Linker must be annotated with a LinkerOrder annotation to determine the relative ordering of the Linkers. Exact order of Linker execution will be determined by the order of add-linker tags in the module configuration.

A new instance of a linker is created each time a module is compiled or during hosted mode when a module first loads (or is refreshed). During a compile, link(TreeLogger, LinkerContext, ArtifactSet) will be called exactly once, and the artifact set will contain any and all generated artifacts. . In hosted mode, link(TreeLogger, LinkerContext, ArtifactSet) is called initially, but with no generated artifacts. If any artifacts are subsequently generated during the course of running hosted mode, relink(TreeLogger, LinkerContext, ArtifactSet) will be called with the new artifacts.


Constructor Summary
Linker()
           
 
Method Summary
abstract  java.lang.String getDescription()
          Returns a human-readable String describing the Linker.
abstract  ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts)
          Invoke the Linker.
 ArtifactSet relink(TreeLogger logger, LinkerContext context, ArtifactSet newArtifacts)
          Re-invoke the Linker with newly generated artifacts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Linker

public Linker()
Method Detail

getDescription

public abstract java.lang.String getDescription()
Returns a human-readable String describing the Linker.


link

public abstract ArtifactSet link(TreeLogger logger,
                                 LinkerContext context,
                                 ArtifactSet artifacts)
                          throws UnableToCompleteException
Invoke the Linker.

Parameters:
logger - the TreeLogger to record to
context - provides access to the Linker's environment
artifacts - an unmodifiable view of the artifacts to link
Returns:
the artifacts that should be propagated through the linker chain
Throws:
UnableToCompleteException - if compilation violates assumptions made by the Linker or for errors encountered by the Linker

relink

public ArtifactSet relink(TreeLogger logger,
                          LinkerContext context,
                          ArtifactSet newArtifacts)
                   throws UnableToCompleteException
Re-invoke the Linker with newly generated artifacts. Linkers that need to reference the original artifact set passed into link(TreeLogger, LinkerContext, ArtifactSet) should retain a copy of the original artifact set in an instance variable.

Parameters:
logger - the TreeLogger to record to
context - provides access to the Linker's environment
newArtifacts - an unmodifiable view of the newly generated artifacts
Returns:
the new artifacts that should be propagated through the linker chain; it is not necessary to return any artifacts from the original link (or previous calls to relink) that have not been modified
Throws:
UnableToCompleteException - if compilation violates assumptions made by the Linker or for errors encountered by the Linker