|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavafe.reader.Reader
javafe.reader.TypeReader
javafe.reader.StandardTypeReader
A StandardTypeReader is a TypeReader that uses SlowQuery to find type files, and user-supplied
Readers to read source and binary files.
| Field Summary | |
Reader |
binaryReader
Our (non-null) reader for use in reading in binary (.class) files. |
Query |
javaFileSpace
Our (non-null) Query engine for determining the GenericFiles for files that belong to Java packages. |
Query |
javaSrcFileSpace
|
Reader |
sourceReader
Our (non-null) reader for use in reading in source files. |
| Constructor Summary | |
protected |
StandardTypeReader(Query engine,
Query srcEngine,
CachedReader srcReader,
CachedReader binReader)
Create a StandardTypeReader from a query engine, a
source reader, and a binary reader. |
| Method Summary | |
boolean |
accessable(java.lang.String[] P)
Return true iff the package P is "accessible".
|
void |
clear()
|
boolean |
exists(java.lang.String[] P,
java.lang.String T)
Return true iff the fully-qualified outside type P.T
exists. |
java.io.FilenameFilter |
filter()
|
java.util.ArrayList |
findFiles(java.lang.String[] P)
Returns an enumeration of the GenericFile objects in the given package P. |
GenericFile |
findType(java.lang.String[] P,
java.lang.String T)
Returns a (source or binary) file for the given type. |
GenericFile |
locateBinary(java.lang.String[] P,
java.lang.String[] N)
If a binary exists for the exact fully-qualified type P.N (e.g., no inheritance required), then return a GenericFile
representing that file. |
GenericFile |
locateSource(java.lang.String[] P,
java.lang.String T,
boolean useSrcPtr)
If a source exists for the fully-qualified outside type P.T, then return a GenericFile representing
that file. |
static void |
main(java.lang.String[] args)
|
static StandardTypeReader |
make()
Create a StandardTypeReader using the default Java
classpath for our underlying Java file space and no pragma
parser.
|
static StandardTypeReader |
make(PragmaParser pragmaP)
Create a StandardTypeReader using a the default Java
classpath for our underlying Java file space and a given pragma
parser.
|
static StandardTypeReader |
make(Query Q,
Query sourceQ,
PragmaParser pragmaP)
Create a StandardTypeReader from a query engine and
a pragma parser. |
static StandardTypeReader |
make(Query engine,
Query srcEngine,
Reader srcReader,
Reader binReader)
Create a StandardTypeReader from a query engine, a
source reader, and a binary reader. |
static StandardTypeReader |
make(java.lang.String path,
java.lang.String sourcePath,
PragmaParser pragmaP)
Create a StandardTypeReader using a given Java
classpath for our underlying Java file space and a given pragma
parser. |
static Query |
queryFromClasspath(java.lang.String path)
Create a Query for use in creating a
StandardTypeReader from a Java classpath.
|
CompilationUnit |
read(GenericFile target,
boolean avoidSpec)
Attempt to read and parse a CompilationUnit from
|
CompilationUnit |
read(java.lang.String[] P,
java.lang.String T,
boolean avoidSpec)
Attempt to read and parse a CompilationUnit from either
the binaries for P.T if they are up to date, or from
the source for P.T. |
CompilationUnit |
readTypeBinaries(java.lang.String[] P,
java.lang.String T,
long after)
Attempt to read and parse a complete (i.e., no stubs) CompilationUnit from the binaries for the fully-qualified
outside type P.T.
|
CompilationUnit |
readTypeSrc(java.lang.String[] P,
java.lang.String T,
boolean avoidSpec)
Attempt to read and parse a CompilationUnit from the
source for the fully-qualified outside type P.T.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public Query javaFileSpace
Query engine for determining the GenericFiles for files that belong to Java packages.
public Query javaSrcFileSpace
public Reader sourceReader
public Reader binaryReader
| Constructor Detail |
protected StandardTypeReader(Query engine,
Query srcEngine,
CachedReader srcReader,
CachedReader binReader)
StandardTypeReader from a query engine, a
source reader, and a binary reader. All arguments must be
non-null.
| Method Detail |
public void clear()
public static StandardTypeReader make(Query engine,
Query srcEngine,
Reader srcReader,
Reader binReader)
StandardTypeReader from a query engine, a
source reader, and a binary reader. All arguments must be
non-null.
public static StandardTypeReader make(Query Q,
Query sourceQ,
PragmaParser pragmaP)
StandardTypeReader from a query engine and
a pragma parser. The pragma parser may be null.
public static Query queryFromClasspath(java.lang.String path)
Query for use in creating a
StandardTypeReader from a Java classpath.
A fatal error will be reported via ErrorSet if an I/O
error occurs while initially scanning the filesystem.
public static StandardTypeReader make(java.lang.String path,
java.lang.String sourcePath,
PragmaParser pragmaP)
StandardTypeReader using a given Java
classpath for our underlying Java file space and a given pragma
parser. If the given path is null, the default Java classpath is
used.
A fatal error will be reported via ErrorSet if an
I/O error occurs while initially scanning the filesystem.
public static StandardTypeReader make(PragmaParser pragmaP)
StandardTypeReader using a the default Java
classpath for our underlying Java file space and a given pragma
parser.
A fatal error will be reported via ErrorSet if
an I/O error occurs while initially scanning the filesystem.
public static StandardTypeReader make()
StandardTypeReader using the default Java
classpath for our underlying Java file space and no pragma
parser.
A fatal error will be reported via ErrorSet if an I/O
error occurs while initially scanning the filesystem.
public boolean accessable(java.lang.String[] P)
P is "accessible".
Warning: the definition of accessible is host system dependent and may in fact be defined as always true.
accessable in class TypeReader
public boolean exists(java.lang.String[] P,
java.lang.String T)
P.T
exists.
exists in class TypeReader
public GenericFile findType(java.lang.String[] P,
java.lang.String T)
TypeReader
findType in class TypeReader
public GenericFile locateBinary(java.lang.String[] P,
java.lang.String[] N)
GenericFile
representing that file. Otherwise, return null.
WARNING: if N is not a simple name, then a non-null return result does *not* imply that P.N actually exists. The binary may be left over from a previous compilation. Only if P.N can be reached from its containing clases, is it considered to exist.
public GenericFile locateSource(java.lang.String[] P,
java.lang.String T,
boolean useSrcPtr)
P.T, then return a GenericFile representing
that file. Otherwise, return null.
Exception: If P.T's source file is not called
T.java, and no T.class file exists for P.T, then
null will also be returned. If useSrcPtr is not set, then null
will be returned when P.T's source file is not
called T.java, regardless of whether or not there is a T.class
file for P.T.
Note: iff useSrcPtr is set, then
P.T's binary may be read in in order to obtain it's
source pointer.
public java.util.ArrayList findFiles(java.lang.String[] P)
TypeReader
findFiles in class TypeReaderpublic java.io.FilenameFilter filter()
filter in class TypeReader
public CompilationUnit read(GenericFile target,
boolean avoidSpec)
CompilationUnit from
ErrorSet. Null is returned iff an error
was encountered.
By default, we attempt to read only a spec (e.g.,
specOnly is set in the resulting CompilationUnit) to save time. If avoidSpec is
true, we return a non-spec, except in the case where we have
previously read in the same source file with
avoidSpec false. (See notes on caching below.)
There are 2 safe ways to ensure source files yield non-spec
files: (1) always use avoidSpec, or (2) read all
desired non-spec's at the beginning with avoidSpec
set. [these instructions apply to both versions of read.]
The result of this function is cached. Note that read(String[], String, boolean) may implicitly call this
function, resulting in caching of source files.
Only the value of avoidSpec used the first time
a given file is read is used (including implicit calls). This
may result in a spec being returned unnecessarily when
avoidSpec is true.
Target must be non-null.
read in class TypeReader
public CompilationUnit readTypeSrc(java.lang.String[] P,
java.lang.String T,
boolean avoidSpec)
CompilationUnit from the
source for the fully-qualified outside type P.T.
Null is returned if no source can be found for P.T
or if an error is encountered. Errors are reported via ErrorSet.
If P.T's source is not named T.java and
there is no T.class file for P.T., then no
source for P.T will be found.
(This is a convenience function.)
public CompilationUnit readTypeBinaries(java.lang.String[] P,
java.lang.String T,
long after)
CompilationUnit from the binaries for the fully-qualified
outside type P.T.
Null is returned if:
after and after
is not 0L, or Errors are reported via ErrorSet. An incomplete set
of binaries (one or more inner classes missing or not up-to-date
WRT after) is considered an error.
public CompilationUnit read(java.lang.String[] P,
java.lang.String T,
boolean avoidSpec)
CompilationUnit from either
the binaries for P.T if they are up to date, or from
the source for P.T. If both a source and an
up-to-date series of binaries are available for P.T,
preference is given to the source if srcPreferred is
set, and to the binaries otherwise.
Binaries are considered to exist for P.T iff a
T.class file exists in package P. The
last modified date for these binaries as a whole is considered to
be the T.class file's last modified date.
Null is returned if no source or binaries for
P.T exist or if an error occurs. Errors are
reported via ErrorSet. An incomplete series of binaries
(one or more inner classes missing or not up-to-date) generates
an error when read in.
If the resulting CompilationUnit is non-null, then it
is always complete, having no stubs.
read in class TypeReader
public static void main(java.lang.String[] args)
throws java.io.IOException
java.io.IOException
|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||