ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe
Class SrcTool

java.lang.Object
  extended byjavafe.Tool
      extended byjavafe.FrontEndTool
          extended byjavafe.SrcTool
All Implemented Interfaces:
Listener
Direct Known Subclasses:
Main, PrintSpec, TestTool

public abstract class SrcTool
extends FrontEndTool
implements Listener

SrcTool is an abstract class for tools that use our Java front end to process the CompilationUnits found in source files.

It adds to FrontEndTool code for processing a series of source files specified on the command line. If processRecursively is set, then files are processed recursively. (I.e., files loaded in the course of processing one file are also processed.)

The remaining processing, if any, is front-end-tool specific.


Field Summary
 java.util.Vector loaded
          A list of all the CompilationUnits we have loaded so far.
 
Fields inherited from class javafe.FrontEndTool
compositeClassPath, compositeSourcePath
 
Fields inherited from class javafe.Tool
badUsageExitCode, errorExitCode, okExitCode, options, outOfMemoryExitCode
 
Constructor Summary
SrcTool()
           
 
Method Summary
 void frontEndToolProcessing(java.util.ArrayList args)
          Main processing loop for SrcTool.
 void handleAllCUs()
          Iterates, calling handleCU for each loaded CU.
 void handleCU(CompilationUnit cu)
          This method is called on each CompilationUnit that this tool processes.
 void handleTD(TypeDecl td)
          This method is called on the TypeDecl of each outside type that SrcTool is to process.
 void loadAllFiles(java.util.ArrayList args)
          * SrcTool-instance specific processing: * *
 void loadInputEntry(InputEntry ie)
           
 Options makeOptions()
          * Main processing code: * *
 void notify(CompilationUnit justLoaded)
          Add a CompilationUnit to loaded.
private static SrcToolOptions options()
           
 void postload()
          Called for any work after loading files
 void postprocess()
          Hook for any work needed after handleCU has been called on each CompilationUnit to process them.
 void preload()
          Hook for any work needed before any files are loaded.
 void preprocess()
          Hook for any work needed after files are loaded but before handleCU is called on each CompilationUnit to process them.
 java.util.ArrayList resolveInputEntry(InputEntry iee)
           
 java.util.ArrayList resolveList(java.lang.String argumentFileName)
           
 
Methods inherited from class javafe.FrontEndTool
clear, handleOptions, main, makePragmaParser, makePrettyPrint, makeStandardTypeReader, makeTypeCheck, processOptions, run, setup, setupPaths
 
Methods inherited from class javafe.Tool
badOptionUsage, currentTime, name, spaceUsed, timeUsed, usage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loaded

public java.util.Vector loaded
A list of all the CompilationUnits we have loaded so far. This list is extended automatically at the end as new CompilationUnits are loaded using notification from OutsideEnv.

Constructor Detail

SrcTool

public SrcTool()
Method Detail

notify

public void notify(CompilationUnit justLoaded)
Add a CompilationUnit to loaded.

This should only be called by OutsideEnv using the Listener interface.

Specified by:
notify in interface Listener

makeOptions

public Options makeOptions()
* Main processing code: * *

Overrides:
makeOptions in class FrontEndTool

options

private static SrcToolOptions options()

frontEndToolProcessing

public void frontEndToolProcessing(java.util.ArrayList args)
Main processing loop for SrcTool.

The remaining arguments are args[offset], args[offset+1], ...

This method calls preload, loadAllFiles, postload, preprocess, handleAllCU, postprocess.

Specified by:
frontEndToolProcessing in class FrontEndTool

loadAllFiles

public void loadAllFiles(java.util.ArrayList args)
* SrcTool-instance specific processing: * *


resolveInputEntry

public java.util.ArrayList resolveInputEntry(InputEntry iee)

loadInputEntry

public void loadInputEntry(InputEntry ie)

resolveList

public java.util.ArrayList resolveList(java.lang.String argumentFileName)

handleAllCUs

public void handleAllCUs()
Iterates, calling handleCU for each loaded CU.


preload

public void preload()
Hook for any work needed before any files are loaded.


postload

public void postload()
Called for any work after loading files


preprocess

public void preprocess()
Hook for any work needed after files are loaded but before handleCU is called on each CompilationUnit to process them.


postprocess

public void postprocess()
Hook for any work needed after handleCU has been called on each CompilationUnit to process them.


handleCU

public void handleCU(CompilationUnit cu)
This method is called on each CompilationUnit that this tool processes.

The default implementation is simply to call handleTD on each TypeDecl present in cu. It is intended that subclassers override this method.


handleTD

public void handleTD(TypeDecl td)
This method is called on the TypeDecl of each outside type that SrcTool is to process.


ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage