|
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.decsrc.ClassFileParser
javafe.reader.ASTClassFileParser
Parses the contents of a class file into an AST for the purpose of type checking. Ignores components of the class file that have no relevance to type checking (e.g. method bodies).
| Field Summary | |
private Identifier |
classIdentifier
The identifier of the class being parsed. |
int |
classLocation
A dummy location representing the class being parsed. |
(package private) TypeDeclElemVec |
classMembers
The class members of the class being parsed. |
Name |
classPackage
The package name of the class being parsed. |
private java.lang.Object[] |
constants
The constant pool of the class being parsed. |
private static TypeNameVec |
emptyTypeNameVec
An empty type name vector. |
private FieldDecl[] |
fields
The fields of the class being parsed. |
protected boolean |
includeBodies
|
(package private) GenericFile |
inputFile
The input file being parsed. |
private TypeName[] |
interfaces
The type names of the interfaces implemented by the class being parsed. |
private int |
modifiers
The modifiers of the class being parsed. |
protected boolean |
omitPrivateFields
|
private java.lang.Object[] |
rawConstants
The constant pool of the class being parsed. |
private RoutineDecl[] |
routines
The methods and constructors of the class being parsed. |
private TypeName |
super_class
The type name of the superclass of the class being parsed. |
private boolean |
syntheticClass
Flag indicating whether the class being parsed has the synthetic attribute. |
private java.util.Vector |
synthetics
Vector of methods and fields with Synthetic attributes. |
private int |
this_class_index
The contant pool index of this class. |
TypeDecl |
typeDecl
The AST of the class parsed by this parser. |
| Fields inherited from class javafe.decsrc.ClassFileParser |
|
| Fields inherited from interface javafe.decsrc.ClassFileConstants |
ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ACC_SYNCHRONIZED, ACC_TRANSIENT, ACC_VOLATILE, CONSTANT_Class, CONSTANT_Double, CONSTANT_Float, CONSTANT_Fref, CONSTANT_IMref, CONSTANT_Integer, CONSTANT_Long, CONSTANT_Mref, CONSTANT_NameType, CONSTANT_String, CONSTANT_Unused, CONSTANT_Utf8, MAGIC, MAJOR, MINOR |
| Constructor Summary | |
(package private) |
ASTClassFileParser(GenericFile inputFile,
boolean includeBodies)
Parse a class into a new class parser. |
| Method Summary | |
protected void |
addNonSyntheticDecls(TypeDeclElemVec v,
TypeDeclElem[] elems)
Add only AST nodes that are not synthetic decls to v. |
private static Name |
getNameQualifier(Name name)
Return the package qualifier of a given name. |
private static Identifier |
getNameTerminal(Name name)
Return the terminal identifier of a given name. |
private FormalParaDecl[] |
makeFormals(MethodSignature signature)
Construct a vector of formal parameters from a method signature. |
protected void |
parse_file(java.io.DataInput stream)
Parse the file and set typeDecl. |
private TypeName[] |
parseTypeNames(java.io.DataInputStream stream)
Parse a sequence of type names from a given stream. |
void |
removeExtraArg()
Binary inner class constructors have an extra initial argument to their constructors (the enclosing class). |
protected void |
set_class_attribute(java.lang.String aname,
java.io.DataInput stream,
int n)
Call back from ClassFileParser. |
protected void |
set_const_ref(int i,
int ctype,
int class_index,
java.lang.String field_name,
java.lang.String type)
Call back from ClassFileParser. |
protected void |
set_const(int i,
int ctype,
java.lang.Object value)
Call back from ClassFileParser. |
protected void |
set_field_initializer(int i,
java.lang.Object value)
Call back from ClassFileParser. |
protected void |
set_field(int i,
java.lang.String fname,
java.lang.String type,
int mod)
Call back from ClassFileParser. |
protected void |
set_interface(int index,
int cindex)
Call back from ClassFileParser. |
protected void |
set_method_attribute(int i,
java.lang.String aname,
java.io.DataInput stream,
int n)
Call back from ClassFileParser. |
protected void |
set_method_body(int i,
int max_stack,
int max_local,
byte[] code,
int num_handlers)
Call back from ClassFileParser. |
protected void |
set_method_handler(int i,
int j,
int start_pc,
int end_pc,
int handler_pc,
int catch_index)
Call back from ClassFileParser. |
protected void |
set_method(int i,
java.lang.String mname,
java.lang.String sig,
int mod)
Call back from ClassFileParser. |
protected void |
set_modifiers(int modifiers)
Call back from ClassFileParser. |
protected void |
set_num_constants(int cnum)
Call back from ClassFileParser. |
protected void |
set_num_fields(int n)
Call back from ClassFileParser. |
protected void |
set_num_interfaces(int n)
Call back from ClassFileParser. |
protected void |
set_num_methods(int n)
Call back from ClassFileParser. |
protected void |
set_super_class(int cindex)
Call back from ClassFileParser. |
protected void |
set_this_class(int cindex)
Call back from ClassFileParser. |
protected void |
set_version(int major,
int minor)
Call back from ClassFileParser. |
| Methods inherited from class javafe.decsrc.ClassFileParser |
get_class, set_field_attribute, set_method_body_attribute |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public Name classPackage
public TypeDecl typeDecl
public int classLocation
private java.util.Vector synthetics
private boolean syntheticClass
protected boolean includeBodies
protected boolean omitPrivateFields
GenericFile inputFile
private java.lang.Object[] constants
private java.lang.Object[] rawConstants
private int modifiers
private int this_class_index
private TypeName super_class
private TypeName[] interfaces
TypeDeclElemVec classMembers
private FieldDecl[] fields
private RoutineDecl[] routines
private Identifier classIdentifier
private static final TypeNameVec emptyTypeNameVec
| Constructor Detail |
ASTClassFileParser(GenericFile inputFile,
boolean includeBodies)
throws java.io.IOException,
java.lang.ClassFormatError
typeDecl; this will be a "spec only"
declaration. Its package is stored in classPackage
and a location for it is stored in classLocation.
inputFile - the file to parse the class fromincludeBodies - if true, bodies are included, if not, only a spec is produced| Method Detail |
public void removeExtraArg()
protected void addNonSyntheticDecls(TypeDeclElemVec v,
TypeDeclElem[] elems)
protected void parse_file(java.io.DataInput stream)
throws java.lang.ClassFormatError,
java.io.IOException
typeDecl.
java.lang.ClassFormatError
java.io.IOException
protected void set_version(int major,
int minor)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_num_constants(int cnum)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_const(int i,
int ctype,
java.lang.Object value)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_const_ref(int i,
int ctype,
int class_index,
java.lang.String field_name,
java.lang.String type)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_class_attribute(java.lang.String aname,
java.io.DataInput stream,
int n)
throws java.io.IOException,
java.lang.ClassFormatError
java.io.IOException
java.lang.ClassFormatError
protected void set_modifiers(int modifiers)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_this_class(int cindex)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_super_class(int cindex)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_num_interfaces(int n)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_interface(int index,
int cindex)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_num_fields(int n)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_field(int i,
java.lang.String fname,
java.lang.String type,
int mod)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_field_initializer(int i,
java.lang.Object value)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_num_methods(int n)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_method(int i,
java.lang.String mname,
java.lang.String sig,
int mod)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_method_body(int i,
int max_stack,
int max_local,
byte[] code,
int num_handlers)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_method_handler(int i,
int j,
int start_pc,
int end_pc,
int handler_pc,
int catch_index)
throws java.lang.ClassFormatError
java.lang.ClassFormatError
protected void set_method_attribute(int i,
java.lang.String aname,
java.io.DataInput stream,
int n)
throws java.io.IOException,
java.lang.ClassFormatError
java.io.IOException
java.lang.ClassFormatError
private TypeName[] parseTypeNames(java.io.DataInputStream stream)
throws java.io.IOException,
java.lang.ClassFormatError
stream - the stream to parse the type names from
java.lang.ClassFormatError - if the type names are not class constants
java.io.IOExceptionprivate FormalParaDecl[] makeFormals(MethodSignature signature)
signature - the method signature to make the formal parameters from
private static Name getNameQualifier(Name name)
name - the name to return the package qualifier of
private static Identifier getNameTerminal(Name name)
name - the name to return the terminal identifier of
|
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 | ||||||||||