org.aspectj.compiler.base.ast
Class TypeDec

java.lang.Object
  extended byorg.aspectj.compiler.base.CompilerObject
      extended byorg.aspectj.compiler.base.ast.ASTObject
          extended byorg.aspectj.compiler.base.ast.Stmt
              extended byorg.aspectj.compiler.base.ast.Dec
                  extended byorg.aspectj.compiler.base.ast.TypeDec
Direct Known Subclasses:
ClassDec, InterfaceDec

public abstract class TypeDec
extends Dec

Represents declared classes, interfaces and aspects One per declaration in the source or in the bytecodes ??? Should bytecodes produce something else ???


Field Summary
protected  Decs body
           
protected  java.lang.String id
           
 FieldDec joinPointFactoryDec
           
 java.util.List joinPoints0
           
 java.util.List joinPoints1
           
 java.util.List joinPoints2
           
 java.util.Set memberTypeNames
           
protected  Modifiers modifiers
           
protected  TypeDs superInterfaces
           
protected  NameType type
           
 
Fields inherited from class org.aspectj.compiler.base.ast.Dec
forcePublic, owner, semanticObject
 
Fields inherited from class org.aspectj.compiler.base.ast.ASTObject
dummySource, parent, sourceLocation
 
Constructor Summary
protected TypeDec(SourceLocation source)
           
  TypeDec(SourceLocation location, Modifiers _modifiers, java.lang.String _id, TypeDs _superInterfaces, Decs _body)
           
 
Method Summary
 void addAssertionField()
           
protected  void addConstructorDec(ConstructorDec constructorDec)
           
protected  void addDec(Dec dec)
           
 void addDecs(NameType toThis)
           
 void addExtraWithinType(Type type)
           
protected  void addFieldDec(FieldDec fieldDec)
           
protected  void addInitializerDec(InitializerDec dec)
           
 void addInnerTypes()
           
 void addIntroducedDec(Dec dec)
           
 void addMember(TypeDec memberDec)
           
 void addMemberMethodDec(MethodDec memberDec)
           
 void addMemberTypeDec(TypeDec memberDec)
           
protected  void addMethodDec(MethodDec methodDec)
           
protected  void addPointcutDec(PointcutDec pointcutDec)
           
 void addSuperInterfaceType(Type newSuperType)
           
 void addToBody(Dec dec)
           
 void addToBodyAndType(Dec dec)
           
 void addToTypeGraph()
           
 void addToTypeGraph(ScopeWalker walker)
          1.
protected  void addTypeDec(TypeDec typeDec)
           
 int allocateLocalTypeIndex()
           
 void buildSignatures()
           
 void buildSignatures(ScopeWalker walker)
          1.
 boolean canOverride(Dec otherDec)
           
protected  void cgMember(org.aspectj.compiler.base.bcg.ClassfileBuilder maker)
          This method takes care of generating code for Member decs.
 void checkSpec()
           
 void collectInitializers(boolean collectSynthetics)
           
 void collectInitializers(boolean isStatic, boolean collectSynthetics)
           
 void fixAST(org.aspectj.compiler.base.ASTFixerPass fixer)
           
 void generateBytecode(java.io.File outputDir)
          should only be called from CompilationUnit and from ClassfileBuilder
 Field getAssertionsDisabledField()
          This field is actually added in postFixAST
 Decs getBody()
           
 TypeDec getBytecodeTypeDec()
          not part of the language's semantic model, but part of the compiler's generated code model.
 ASTObject getChildAt(int childIndex)
           
 int getChildCount()
           
 java.lang.String getChildNameAt(int childIndex)
           
 TypeDec getDeclaringTypeDec()
           
 java.lang.String getDefaultDisplayName()
           
 int getDepth()
           
 NameType getEnclosingInstanceType()
           
 TypeDec getEnclosingInstanceTypeDec()
           
protected  org.aspectj.compiler.base.cst.Scope getEnclosingScope(boolean justTypeGraph)
           
 TypeDec getEnclosingTypeDec()
           
 java.lang.String getExtendedId()
          Returns the name of this class minus the package name uses '$' as a separator for inners java.util.Map.Entry goes to Map$Entry
 java.util.Set getExtraWithinTypes()
           
 java.lang.String getFullName()
           
 java.lang.String getId()
           
 java.util.Set getInitializerExecutionJoinPoints()
           
 Modifiers getModifiers()
           
 NameType getNameType()
           
 Type getOutermostBytecodeType()
           
 Type getOutermostLexicalType()
           
 Type getOutermostType()
           
 TypeDec getOutermostTypeDec()
           
 java.io.File getPackageDir(java.io.File outputdir)
          Used to generate .class files in TypeDec.generateBytecode method Used to generate .java files in CodeGenerator.?
 java.lang.String getPackageName()
           
 java.lang.String getPrettyString()
           
 InitializerDec getSingleInitializerDec(boolean isStatic)
           
 ConstructorDec getSoleConstructorDec()
           
 java.lang.String getSourceExtendedId()
          Returns the name of this class minus the package name uses '.' as a separator for inners java.util.Map.Entry goes to Map.Entry
 Type getSuperClassType()
           
 TypeDs getSuperInterfaces()
           
 java.util.Collection getSuperInterfaceTypes()
           
 Type getType()
           
 boolean hasGlobalName()
          Does this typeDec not have an accessible typeName from the rest of the universe? That is, is it a local or anonymous class, or is one of its declaring typedecs local or anonymous?
abstract  boolean isAnonymous()
           
 boolean isConcrete()
           
 boolean isInner()
          Only classes can be inners, so this is overridden by ClassDec
 boolean isInnerType()
           
 boolean isInnerTypeOf(TypeDec parentType)
           
 boolean isLocal()
           
 boolean isLocallyDefined()
          Is this typeDec in local context? A local or anonymous class?
 boolean isPackageMember()
           
 boolean isRoot()
           
 SemanticObject makeCorrespondingSemanticObject()
           
protected  java.util.Collection makeInterfaceTypesFromTypeDs(TypeDs typeDs)
          Assume that this method is called at least once per type to check some rules about interfaces
 ASTObject postCopy(CopyWalker walker, ASTObject oldObject)
          We now explicitly can't copy local types from one type dec to another
 void postIntroductionFinish()
           
 ASTObject postLift(org.aspectj.compiler.base.LocalClassPass.LiftWalker walker)
           
 ASTObject postMove(MovingWalker walker)
           
 ASTObject postThreading(org.aspectj.compiler.base.LocalClassPass.ThreadingWalker walker)
           
 void preCopy(CopyWalker walker, ASTObject oldObject)
           
 void preLift(org.aspectj.compiler.base.LocalClassPass.LiftWalker walker)
           
 void preMove(MovingWalker walker)
           
 void preThreading(org.aspectj.compiler.base.LocalClassPass.ThreadingWalker walker)
           
 void setBody(Decs _body)
           
 void setChildAt(int childIndex, ASTObject child)
           
 void setEnclosingTypeDec(TypeDec dec)
           
 void setId(java.lang.String _id)
           
 void setInnerDiscoveries(boolean a, boolean b, boolean c)
          should only be called from ASTConnection (or here, I suppose)
 void setIsInner(boolean b)
           
 void setLocal()
           
 void setModifiers(Modifiers _modifiers)
           
 void setSoleConstructorDec(ConstructorDec d)
           
 void setSuperInterfaces(TypeDs _superInterfaces)
           
 void setType(NameType type)
           
 java.lang.String toShortString()
           
 java.lang.String toString()
           
 void walkAnalysis(org.aspectj.compiler.base.LocalClassPass.AnalysisWalker walker)
           
protected  void walkBody(ScopeWalker walker)
           
protected  void walkExtendsAndImplements(ScopeWalker walker)
           
 void walkFlow(org.aspectj.compiler.base.FlowCheckerPass ww)
           
 void walkForwardReference(org.aspectj.compiler.base.ForwardReferenceChecker w)
           
 void walkInnerInfo(org.aspectj.compiler.base.InnerInfoPass w)
           
 ASTObject walkMemberMunger(org.aspectj.compiler.base.MemberClassMunger w)
           
 void walkScope(ScopeWalker walker)
          This is the simplest scope pass of them all.
 
Methods inherited from class org.aspectj.compiler.base.ast.Dec
addIntroducedFromType, checkOverride, cleanup, conflictsWith, dominates, forcePublic, getBytecodeId, getCorrespondingSemanticObject, getDeclaringType, getDescriptor, getKind, getLexicalType, getName, getSignatureString, getStackDelta, inStaticContext, isAbstract, isAccessible, isAccessible, isAlmostApplicable, isApplicable, isDeprecated, isFinal, isInherited, isIntroduced, isLanguageVisible, isMoreAccessibleThan, isMoreSpecificThan, isPrivate, isProtected, isPublic, isStatic, isSynthetic, lookupDeclaringType, lookupLexicalType, makeBlockScope, requireStmt, samePackage, setAllEnclosingTypes, setBytecodeId, setDeclaringType, setDeprecated, setExplicitlyNonSynthetic, setFromLexicalScope, setLanguageVisible, setLexicalType, writeModifiers, writeNames
 
Methods inherited from class org.aspectj.compiler.base.ast.Stmt
cgStmt, cgTop, completesNormally, isBreakable, isContinuable, isEmpty, mustBeLive, registerLocation, requireBlockStmt, setCompletesNormally
 
Methods inherited from class org.aspectj.compiler.base.ast.ASTObject
addComment, buildAccessMethod, checkNoSharing, clearComment, clearParent, contains, containsTypes, copy, copyWalk, display, fixAccessPost, fromSource, getAST, getBeginColumn, getBeginLine, getBytecodeType, getComment, getCompilationUnit, getEnclosingCodeDec, getEnclosingDec, getEndColumn, getEndLine, getEndPosition, getFormalComment, getParent, getSourceDirectoryName, getSourceFile, getSourceFileName, getSourceLocation, getStartPosition, hasLegalProtectedAccess, hasSource, hasSourceLocation, implementMixin, indexOf, isLeaf, makeChild, makeChild, postAssignmentCheck, postCleanup, postFixAST, postImplementMixin, postInnerAccess, postInnerInfo, postScope, preAssignmentCheck, preIntroduction, preScope, remove, remove, removeChildAt, replaceWith, setFormalComment, setParent, setParents, setSource, setSourceLocation, setSyntheticSource, showError, showMessage, showTypeError, showWarning, unparse, unparse, walk, walkAssignmentCheck, walkCleanup, walkFrameLoc
 
Methods inherited from class org.aspectj.compiler.base.CompilerObject
getCompiler, getOptions, getTypeManager, getWorld
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

memberTypeNames

public java.util.Set memberTypeNames

type

protected NameType type

joinPointFactoryDec

public FieldDec joinPointFactoryDec

joinPoints0

public java.util.List joinPoints0

joinPoints1

public java.util.List joinPoints1

joinPoints2

public java.util.List joinPoints2

modifiers

protected Modifiers modifiers

id

protected java.lang.String id

superInterfaces

protected TypeDs superInterfaces

body

protected Decs body
Constructor Detail

TypeDec

public TypeDec(SourceLocation location,
               Modifiers _modifiers,
               java.lang.String _id,
               TypeDs _superInterfaces,
               Decs _body)

TypeDec

protected TypeDec(SourceLocation source)
Method Detail

walkInnerInfo

public void walkInnerInfo(org.aspectj.compiler.base.InnerInfoPass w)
Overrides:
walkInnerInfo in class ASTObject

checkSpec

public void checkSpec()
Overrides:
checkSpec in class ASTObject

walkMemberMunger

public ASTObject walkMemberMunger(org.aspectj.compiler.base.MemberClassMunger w)
Overrides:
walkMemberMunger in class ASTObject

walkFlow

public void walkFlow(org.aspectj.compiler.base.FlowCheckerPass ww)
Overrides:
walkFlow in class ASTObject

getDepth

public int getDepth()

preMove

public void preMove(MovingWalker walker)
Overrides:
preMove in class Dec

preCopy

public void preCopy(CopyWalker walker,
                    ASTObject oldObject)
Overrides:
preCopy in class Dec

postCopy

public ASTObject postCopy(CopyWalker walker,
                          ASTObject oldObject)
We now explicitly can't copy local types from one type dec to another

Overrides:
postCopy in class Dec

postMove

public ASTObject postMove(MovingWalker walker)
Overrides:
postMove in class ASTObject

getType

public Type getType()

setType

public void setType(NameType type)

getNameType

public NameType getNameType()

getBytecodeTypeDec

public TypeDec getBytecodeTypeDec()
Description copied from class: ASTObject
not part of the language's semantic model, but part of the compiler's generated code model. This will return the type declaration that will actually be enclosing this point in the bytecodes produced by the compiler.

Overrides:
getBytecodeTypeDec in class ASTObject

makeCorrespondingSemanticObject

public SemanticObject makeCorrespondingSemanticObject()
Overrides:
makeCorrespondingSemanticObject in class Dec

getExtraWithinTypes

public java.util.Set getExtraWithinTypes()

addExtraWithinType

public void addExtraWithinType(Type type)

getSuperClassType

public Type getSuperClassType()

getSuperInterfaceTypes

public java.util.Collection getSuperInterfaceTypes()

addSuperInterfaceType

public void addSuperInterfaceType(Type newSuperType)

setEnclosingTypeDec

public void setEnclosingTypeDec(TypeDec dec)

getEnclosingTypeDec

public TypeDec getEnclosingTypeDec()

getDeclaringTypeDec

public TypeDec getDeclaringTypeDec()

getOutermostTypeDec

public TypeDec getOutermostTypeDec()

getOutermostType

public Type getOutermostType()

isInnerType

public boolean isInnerType()

isInnerTypeOf

public boolean isInnerTypeOf(TypeDec parentType)

hasGlobalName

public boolean hasGlobalName()
Does this typeDec not have an accessible typeName from the rest of the universe? That is, is it a local or anonymous class, or is one of its declaring typedecs local or anonymous?


isLocallyDefined

public boolean isLocallyDefined()
Is this typeDec in local context? A local or anonymous class?


isAnonymous

public abstract boolean isAnonymous()

canOverride

public boolean canOverride(Dec otherDec)

isRoot

public boolean isRoot()

isConcrete

public boolean isConcrete()

allocateLocalTypeIndex

public int allocateLocalTypeIndex()

getExtendedId

public java.lang.String getExtendedId()
Returns the name of this class minus the package name uses '$' as a separator for inners java.util.Map.Entry goes to Map$Entry


getSourceExtendedId

public java.lang.String getSourceExtendedId()
Returns the name of this class minus the package name uses '.' as a separator for inners java.util.Map.Entry goes to Map.Entry


makeInterfaceTypesFromTypeDs

protected java.util.Collection makeInterfaceTypesFromTypeDs(TypeDs typeDs)
Assume that this method is called at least once per type to check some rules about interfaces


addPointcutDec

protected void addPointcutDec(PointcutDec pointcutDec)

addFieldDec

protected void addFieldDec(FieldDec fieldDec)

addMethodDec

protected void addMethodDec(MethodDec methodDec)

addConstructorDec

protected void addConstructorDec(ConstructorDec constructorDec)

addTypeDec

protected void addTypeDec(TypeDec typeDec)

addMemberTypeDec

public void addMemberTypeDec(TypeDec memberDec)

addMember

public void addMember(TypeDec memberDec)

addMemberMethodDec

public void addMemberMethodDec(MethodDec memberDec)

addIntroducedDec

public void addIntroducedDec(Dec dec)

addInitializerDec

protected void addInitializerDec(InitializerDec dec)

addDec

protected void addDec(Dec dec)

getPackageName

public final java.lang.String getPackageName()

setSoleConstructorDec

public void setSoleConstructorDec(ConstructorDec d)

getSoleConstructorDec

public ConstructorDec getSoleConstructorDec()

addInnerTypes

public void addInnerTypes()

addDecs

public void addDecs(NameType toThis)

postIntroductionFinish

public void postIntroductionFinish()

addToBody

public void addToBody(Dec dec)

addToBodyAndType

public void addToBodyAndType(Dec dec)

getPrettyString

public java.lang.String getPrettyString()

toString

public java.lang.String toString()
Overrides:
toString in class ASTObject

toShortString

public java.lang.String toShortString()
Specified by:
toShortString in class Dec

fixAST

public void fixAST(org.aspectj.compiler.base.ASTFixerPass fixer)
Overrides:
fixAST in class ASTObject

walkExtendsAndImplements

protected void walkExtendsAndImplements(ScopeWalker walker)

walkBody

protected void walkBody(ScopeWalker walker)

getEnclosingScope

protected org.aspectj.compiler.base.cst.Scope getEnclosingScope(boolean justTypeGraph)

addToTypeGraph

public void addToTypeGraph()

buildSignatures

public void buildSignatures()

addToTypeGraph

public void addToTypeGraph(ScopeWalker walker)
1. Bind names in extends/implements clauses 2. Insert this type into type graph 3. Build maps of inner types including inherited inner types


buildSignatures

public void buildSignatures(ScopeWalker walker)
1. Bind names in member signatures 2. Build maps of members of this type and of inherited members This step also handles introduced members 3. Add a default constructor if required 4. Do a spec check for no abstract decs in a concrete type ??? can we move this to checkSpec() method ???


walkScope

public void walkScope(ScopeWalker walker)
This is the simplest scope pass of them all. It just walks the body and binds all names (after ensuring that prvious name binding has been done).

Overrides:
walkScope in class ASTObject

getFullName

public java.lang.String getFullName()

setInnerDiscoveries

public void setInnerDiscoveries(boolean a,
                                boolean b,
                                boolean c)
should only be called from ASTConnection (or here, I suppose)


setIsInner

public void setIsInner(boolean b)

getOutermostBytecodeType

public Type getOutermostBytecodeType()
Overrides:
getOutermostBytecodeType in class ASTObject

getOutermostLexicalType

public Type getOutermostLexicalType()
Overrides:
getOutermostLexicalType in class Dec

isInner

public boolean isInner()
Only classes can be inners, so this is overridden by ClassDec


setLocal

public void setLocal()

isLocal

public boolean isLocal()

isPackageMember

public boolean isPackageMember()

getEnclosingInstanceType

public NameType getEnclosingInstanceType()

getEnclosingInstanceTypeDec

public TypeDec getEnclosingInstanceTypeDec()

getInitializerExecutionJoinPoints

public java.util.Set getInitializerExecutionJoinPoints()

walkForwardReference

public void walkForwardReference(org.aspectj.compiler.base.ForwardReferenceChecker w)
Overrides:
walkForwardReference in class Dec

walkAnalysis

public void walkAnalysis(org.aspectj.compiler.base.LocalClassPass.AnalysisWalker walker)
Overrides:
walkAnalysis in class ASTObject

preLift

public void preLift(org.aspectj.compiler.base.LocalClassPass.LiftWalker walker)
Overrides:
preLift in class ASTObject

postLift

public ASTObject postLift(org.aspectj.compiler.base.LocalClassPass.LiftWalker walker)
Overrides:
postLift in class ASTObject

collectInitializers

public void collectInitializers(boolean collectSynthetics)

getAssertionsDisabledField

public Field getAssertionsDisabledField()
This field is actually added in postFixAST


addAssertionField

public void addAssertionField()

collectInitializers

public void collectInitializers(boolean isStatic,
                                boolean collectSynthetics)

getSingleInitializerDec

public InitializerDec getSingleInitializerDec(boolean isStatic)

preThreading

public void preThreading(org.aspectj.compiler.base.LocalClassPass.ThreadingWalker walker)
Overrides:
preThreading in class ASTObject

postThreading

public ASTObject postThreading(org.aspectj.compiler.base.LocalClassPass.ThreadingWalker walker)
Overrides:
postThreading in class ASTObject

cgMember

protected void cgMember(org.aspectj.compiler.base.bcg.ClassfileBuilder maker)
Description copied from class: Dec
This method takes care of generating code for Member decs. At this point in the compilation, we should only have two kinds of Member decs, FieldDec and CodeDec. Moreover, FieldDecs should not have initializers unless they're constants. This method throws an error if it is ever invoked: FieldDec and CodeDec override it.

Overrides:
cgMember in class Dec

getPackageDir

public java.io.File getPackageDir(java.io.File outputdir)
Used to generate .class files in TypeDec.generateBytecode method Used to generate .java files in CodeGenerator.?


generateBytecode

public final void generateBytecode(java.io.File outputDir)
                            throws java.io.IOException
should only be called from CompilationUnit and from ClassfileBuilder

Throws:
java.io.IOException

getModifiers

public Modifiers getModifiers()
Specified by:
getModifiers in class Dec

setModifiers

public void setModifiers(Modifiers _modifiers)

getId

public java.lang.String getId()
Specified by:
getId in class Dec

setId

public void setId(java.lang.String _id)
Overrides:
setId in class Dec

getSuperInterfaces

public TypeDs getSuperInterfaces()

setSuperInterfaces

public void setSuperInterfaces(TypeDs _superInterfaces)

getBody

public Decs getBody()

setBody

public void setBody(Decs _body)

getChildAt

public ASTObject getChildAt(int childIndex)
Overrides:
getChildAt in class ASTObject

getChildNameAt

public java.lang.String getChildNameAt(int childIndex)
Overrides:
getChildNameAt in class ASTObject

setChildAt

public void setChildAt(int childIndex,
                       ASTObject child)
Overrides:
setChildAt in class ASTObject

getChildCount

public int getChildCount()
Overrides:
getChildCount in class ASTObject

getDefaultDisplayName

public java.lang.String getDefaultDisplayName()
Overrides:
getDefaultDisplayName in class Dec