|
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 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.tc.PrepTypeDeclaration
Does type name resolution and type checking at signature level of a type declaration, and infers the members of the declaration. Also resolves type names at the signature level. Assumes the TypeSig was previously in the "supertype links resolved" state.
Field Summary | |
protected TypeSig |
_rootCache
|
protected StackVector |
constructorSeq
|
protected StackVector |
fieldSeq
|
protected StackVector |
hiddenfieldSeq
|
static PrepTypeDeclaration |
inst
A (possibly extended) instance of PrepTypeDeclaration. |
protected StackVector |
methodSeq
|
private int |
numFields
|
private java.util.LinkedList |
numList
|
private static ASTDecoration |
overridesDecoration
|
Constructor Summary | |
PrepTypeDeclaration()
|
Method Summary | |
protected void |
addInheritedMembers(TypeSig type,
TypeSig superType)
Find all members of a supertype inherited by a type. |
private void |
addOverride(MethodDecl md,
MethodDecl overrides)
Decorates MethodDecl of prepped TypeDecls with a Set of methods that decl overrides or hides. |
void |
checkModifiers(int modifiers,
int allowed,
int loc,
java.lang.String decl)
|
protected void |
checkSuperInterfaces(TypeSig sig,
TypeNameVec superInterfaces)
Check superinterfaces and add their members to fieldSeq and methodSeq. |
void |
checkSuperTypeAccessible(TypeSig currentSig,
TypeSig supertype,
int loc)
Check to make sure a supertype is accessible; reports an error to ErrorSet if not. |
void |
checkTypeModifiers(TypeDecl decl,
TypeSig currentSig,
boolean isClass)
Check that the modifiers of a type are ok. |
protected boolean |
declaresFieldJava(TypeSig sig,
Identifier id)
Check if a type declares a field. |
private MethodDecl |
declaresMethod(TypeSig sig,
Identifier id,
Type[] argTypes)
Check if a type declares a method. |
protected EnvForTypeSig |
getEnvForCurrentSig(TypeSig sig,
boolean isStatic)
|
Set |
getOverrides(MethodDecl md)
Returns the set of all methods that md overrides,
where md is considered to appear in those prepped
subtypes of md.parent that inherit md .
|
Set |
getOverrides(TypeDecl td,
MethodDecl md)
Returns the set of methods that md overrides, with
md considered to appear in a particular type
td . |
TypeSig |
getRootInterface()
This routine constructs and returns the interface that all interfaces are de-facto subinterfaces of. |
protected void |
prepDo(TypeSig sig,
TypeDecl decl)
|
protected void |
prepEnd(TypeSig sig,
TypeDecl decl)
|
protected void |
prepStart(TypeSig sig,
TypeDecl decl)
|
void |
prepTypeSignature(TypeSig sig)
Does type name resolution and type checking at signature level of a type declaration, and infers the members of the declaration. |
TypeSig |
processTypeNameAnnotations(TypeName tn,
TypeSig sig,
Env env)
|
protected void |
startSupers()
|
protected boolean |
superMemberAccessible(TypeSig type,
TypeSig superType,
int modifiers,
ModifierPragmaVec pmodifiers)
Check if a member is accessible from a direct subclass. |
protected void |
visitClassDecl(ClassDecl decl,
TypeSig currentSig)
Does signature-level checking and adds type members to fieldSeq and methodSeq. |
protected void |
visitConstructorDecl(ConstructorDecl x,
TypeSig currentSig,
boolean abstractMethodsOK,
boolean inFinalClass,
boolean inInterface)
Visit ConstructorDecl, check it, and add it to constructorSeq. |
protected void |
visitFieldDecl(FieldDecl x,
TypeSig currentSig,
boolean abstractMethodsOK,
boolean inFinalClass,
boolean inInterface)
Visit a FieldDecl, check it and add it to fieldSeq. |
protected void |
visitInterfaceDecl(InterfaceDecl decl,
TypeSig currentSig)
Does signature-level checking and adds type members to fieldSeq and methodSeq. |
protected void |
visitMethodDecl(MethodDecl x,
TypeSig currentSig,
boolean abstractMethodsOK,
boolean inFinalClass,
boolean inInterface)
Visit a MethodDecl, check it and add it to methodSeq. |
protected void |
visitTypeDeclElem(TypeDeclElem e,
TypeSig currentSig,
boolean abstractMethodsOK,
boolean inFinalClass,
boolean inInterface)
Visit a TypeDeclElem, check it and add it to fieldSeq or methodSeq, if appropriate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static PrepTypeDeclaration inst
private static ASTDecoration overridesDecoration
protected StackVector fieldSeq
protected StackVector hiddenfieldSeq
protected StackVector methodSeq
protected StackVector constructorSeq
private int numFields
private java.util.LinkedList numList
protected TypeSig _rootCache
Constructor Detail |
public PrepTypeDeclaration()
Method Detail |
public void prepTypeSignature(TypeSig sig)
protected void prepStart(TypeSig sig, TypeDecl decl)
protected void prepDo(TypeSig sig, TypeDecl decl)
protected void prepEnd(TypeSig sig, TypeDecl decl)
private void addOverride(MethodDecl md, MethodDecl overrides)
public Set getOverrides(MethodDecl md)
md
overrides,
where md
is considered to appear in those prepped
subtypes of md.parent
that inherit md
.
Warning: This set may expand as additional subtypes of
md.parent
are prepped.
Warning: If you want the set of methods that md
overrides, with md
considered to appear in a
particular type td
, use getOverrides(TypeDecl,
MethodDecl) instead!
public Set getOverrides(TypeDecl td, MethodDecl md)
md
overrides, with
md
considered to appear in a particular type
td
.
This routine may result in td
being prepped.
protected void visitClassDecl(ClassDecl decl, TypeSig currentSig)
public void checkTypeModifiers(TypeDecl decl, TypeSig currentSig, boolean isClass)
decl is the TypeDecl for the type, and currentSig its TypeSig.
isClass should be true iff the TypeDecl is a ClassDecl.
protected void visitInterfaceDecl(InterfaceDecl decl, TypeSig currentSig)
protected void startSupers()
protected void checkSuperInterfaces(TypeSig sig, TypeNameVec superInterfaces)
protected void visitTypeDeclElem(TypeDeclElem e, TypeSig currentSig, boolean abstractMethodsOK, boolean inFinalClass, boolean inInterface)
protected void visitFieldDecl(FieldDecl x, TypeSig currentSig, boolean abstractMethodsOK, boolean inFinalClass, boolean inInterface)
protected void visitMethodDecl(MethodDecl x, TypeSig currentSig, boolean abstractMethodsOK, boolean inFinalClass, boolean inInterface)
protected void visitConstructorDecl(ConstructorDecl x, TypeSig currentSig, boolean abstractMethodsOK, boolean inFinalClass, boolean inInterface)
protected void addInheritedMembers(TypeSig type, TypeSig superType)
protected boolean superMemberAccessible(TypeSig type, TypeSig superType, int modifiers, ModifierPragmaVec pmodifiers)
protected boolean declaresFieldJava(TypeSig sig, Identifier id)
private MethodDecl declaresMethod(TypeSig sig, Identifier id, Type[] argTypes)
public void checkModifiers(int modifiers, int allowed, int loc, java.lang.String decl)
public void checkSuperTypeAccessible(TypeSig currentSig, TypeSig supertype, int loc)
Here, supertype is a supertype of currentSig; this fact is declared at loc. E.g., loc is the location of the supertype name in the extends or implements clause of currentSig.
public TypeSig getRootInterface()
This interface is not an actual Java interface, but rather a made up one. Its locations will be valid, but misleading.
The root interface is composed of all the public methods of java.lang.Object turned into abstract methods.
public TypeSig processTypeNameAnnotations(TypeName tn, TypeSig sig, Env env)
protected EnvForTypeSig getEnvForCurrentSig(TypeSig sig, boolean isStatic)
|
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 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |