Java Reference
In-Depth Information
ClassDeclaring
name
modifiers
parentclass
Identifier
Identifier
type
type
fields
constructors
methods
attributeRef
attributeRef
name
name
List of
variableDeclaring
List of
methodDeclaring
List of
constructorDeclaring
Figure 8.27: Abstract Syntax Tree for a Class Declaration
ClassTypeDescriptor
MethodAttributes
parent => a class type reference
names => a symbol table
isFinal => a Boolean
signature => a signature descriptor
isAbstract => a Boolean
returnType => a type reference
locals => a symbol table
isDefinedIn => a class type reference
modifiers => a set of modifier values
ClassAttributes
classType => a type reference
Figure 8.28: Attributes and Type Descriptor for Class Declarations
table entry. The value of currentClass is set so that it references the Attributes
descriptor of this class.
Next, at Marker 52 , we check to see if a parent class name was supplied in
the declaration. If not, an AST node that refers to the class Object is attached to
this node. Otherwise, an instance of TypeVisitor is created to process the node
referenced by parentClass . If an error occurs during the visit to parentClass ,
or if parentClass . name is not a class name, then the TypeDescriptor for the
current class declaration will be replaced by errorType and the rest of the class
declaration is not processed. Amisnamed parent classwould likely causemore
errors to be reported if the field and method declarations were processed, so
we choose to skip over these components of the declaration in order to achieve
our goal of generating only one error message per error in the source code.
If parentClass . name does designate a class, then processing continues at
 
 
Search WWH ::




Custom Search