abc.aspectj.ast
Class AdviceDecl_c

java.lang.Object
  extended by MethodDecl_c
      extended by abc.aspectj.extension.AJMethodDecl_c
          extended by abc.aspectj.ast.AdviceDecl_c
All Implemented Interfaces:
AdviceDecl, MakesAspectMethods, ContainsAspectInfo, TransformsAspectReflection
Direct Known Subclasses:
EAJAdviceDecl_c

public class AdviceDecl_c
extends AJMethodDecl_c
implements AdviceDecl, ContainsAspectInfo, MakesAspectMethods

Declarations of advice, for example before(int x) // the "advice spec" : call(* fac(*)) && args(x) // pointcut { System.out.println(x);} // body

Author:
Oege de Moor, Aske Simon Christensen

Field Summary
protected  boolean canRewriteThisJoinPoint
           
protected  boolean hasEnclosingJoinPointStaticPart
          record whether thisEnclosingJoinPointStaticPart occurs in the advice body.
protected  boolean hasJoinPoint
          record whether thisJoinPoint occurs in the advice body.
protected  boolean hasJoinPointStaticPart
          record whether thisJoinPointStaticPart occurs in the advice body.
protected  java.util.Set methodsInAdvice
           
protected  Pointcut pc
          pointcut that specifies the joinpoints where this advice applies
protected  AdviceFormal retval
          the return formal, for afterreturning and afterthrowing advice
protected  AdviceSpec spec
          advice specification (e.g.
protected  int spec_retval_pos
           
protected  LocalInstance thisEnclosingJoinPointStaticPartInstance
           
protected  LocalInstance thisJoinPointInstance
           
protected  LocalInstance thisJoinPointStaticPartInstance
           
 
Constructor Summary
AdviceDecl_c(Position pos, Flags flags, AdviceSpec spec, java.util.List throwTypes, Pointcut pc, Block body)
           
 
Method Summary
 java.util.List acceptCFG(CFGBuilder v, java.util.List succs)
          Visit this term in evaluation order.
 void aspectMethodsEnter(AspectMethods visitor)
           
 Node aspectMethodsLeave(AspectMethods visitor, AJNodeFactory nf, AJTypeSystem ts)
           
 Node buildTypes(TypeBuilder tb)
          build the type; the spec is included in the advice instance to give intelligible error messages - see adviceInstance overrides
 NodeVisitor disambiguateEnter(AmbiguityRemover ar)
           
 void enterAspectReflectionInspect(AspectReflectionInspect v, Node parent)
           
 void enterAspectReflectionRewrite(AspectReflectionRewrite v, AJTypeSystem ts)
           
 Context enterScope(Context c)
           
 Context enterScope(Node child, Context c)
           
 Term entry()
           
 boolean hasEnclosingJoinPointStaticPart()
           
 boolean hasJoinPoint()
          does "thisJoinPoint" occur in the advice body?
 boolean hasJoinPointStaticPart()
          does "thisJoinPointStaticPart" occur in the advice body?
 void joinpointFormals(Local n)
          register the use of "thisJoinPoint" etc.
 void leaveAspectReflectionInspect(AspectReflectionInspect v)
           
 Node leaveAspectReflectionRewrite(AspectReflectionRewrite v, AJNodeFactory nf)
           
 void localMethod(CodeInstance ci)
          register methods or constructors that are local to the advice, for later use in weaver
protected  MethodInstance makeMethodInstance(ClassType ct, TypeSystem ts)
           
 MethodDecl methodDecl(AJNodeFactory nf, AJTypeSystem ts)
          generate a MethodDecl for the advice body
 void prettyPrint(CodeWriter w, PrettyPrinter tr)
           
 MethodDecl proceedDecl(AJNodeFactory nf, AJTypeSystem ts)
          generate a dummy MethodDecl for the proceed.
protected  AdviceDecl_c reconstruct(TypeNode returnType, java.util.List formals, java.util.List throwTypes, Block body, AdviceSpec spec, AdviceFormal retval, Pointcut pc)
           
 Node typeCheck(TypeChecker tc)
          Type check the advice: first the usual method checks, then whether the "throwing" result is actually throwable
 void update(GlobalAspectInfo gai, Aspect current_aspect)
          Called by the AspectInfoHarvester to tell the node to put all relevant information into the GlobalAspectInfo.
 Node visitChildren(NodeVisitor v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spec

protected AdviceSpec spec
advice specification (e.g. before(formals), around(..), after returning(..) )


pc

protected Pointcut pc
pointcut that specifies the joinpoints where this advice applies


retval

protected AdviceFormal retval
the return formal, for afterreturning and afterthrowing advice


hasJoinPoint

protected boolean hasJoinPoint
record whether thisJoinPoint occurs in the advice body. set by joinPointFormals(Local)


hasJoinPointStaticPart

protected boolean hasJoinPointStaticPart
record whether thisJoinPointStaticPart occurs in the advice body. set by joinPointFormals(Local)


hasEnclosingJoinPointStaticPart

protected boolean hasEnclosingJoinPointStaticPart
record whether thisEnclosingJoinPointStaticPart occurs in the advice body. set by joinPointFormals(Local)


thisJoinPointInstance

protected LocalInstance thisJoinPointInstance

thisJoinPointStaticPartInstance

protected LocalInstance thisJoinPointStaticPartInstance

thisEnclosingJoinPointStaticPartInstance

protected LocalInstance thisEnclosingJoinPointStaticPartInstance

canRewriteThisJoinPoint

protected boolean canRewriteThisJoinPoint

methodsInAdvice

protected java.util.Set methodsInAdvice

spec_retval_pos

protected int spec_retval_pos
Constructor Detail

AdviceDecl_c

public AdviceDecl_c(Position pos,
                    Flags flags,
                    AdviceSpec spec,
                    java.util.List throwTypes,
                    Pointcut pc,
                    Block body)
Method Detail

reconstruct

protected AdviceDecl_c reconstruct(TypeNode returnType,
                                   java.util.List formals,
                                   java.util.List throwTypes,
                                   Block body,
                                   AdviceSpec spec,
                                   AdviceFormal retval,
                                   Pointcut pc)

visitChildren

public Node visitChildren(NodeVisitor v)

disambiguateEnter

public NodeVisitor disambiguateEnter(AmbiguityRemover ar)
                              throws SemanticException
Overrides:
disambiguateEnter in class AJMethodDecl_c
Throws:
SemanticException

proceedDecl

public MethodDecl proceedDecl(AJNodeFactory nf,
                              AJTypeSystem ts)
Description copied from interface: AdviceDecl
generate a dummy MethodDecl for the proceed. Only applies to around advice.

Specified by:
proceedDecl in interface AdviceDecl

hasJoinPointStaticPart

public boolean hasJoinPointStaticPart()
Description copied from interface: AdviceDecl
does "thisJoinPointStaticPart" occur in the advice body?

Specified by:
hasJoinPointStaticPart in interface AdviceDecl

hasJoinPoint

public boolean hasJoinPoint()
Description copied from interface: AdviceDecl
does "thisJoinPoint" occur in the advice body?

Specified by:
hasJoinPoint in interface AdviceDecl

hasEnclosingJoinPointStaticPart

public boolean hasEnclosingJoinPointStaticPart()

joinpointFormals

public void joinpointFormals(Local n)
Description copied from interface: AdviceDecl
register the use of "thisJoinPoint" etc.

Specified by:
joinpointFormals in interface AdviceDecl
Parameters:
n - test whether this local is "thisJoinPoint" etc();

methodDecl

public MethodDecl methodDecl(AJNodeFactory nf,
                             AJTypeSystem ts)
Description copied from interface: AdviceDecl
generate a MethodDecl for the advice body

Specified by:
methodDecl in interface AdviceDecl

enterScope

public Context enterScope(Context c)

enterScope

public Context enterScope(Node child,
                          Context c)

typeCheck

public Node typeCheck(TypeChecker tc)
               throws SemanticException
Type check the advice: first the usual method checks, then whether the "throwing" result is actually throwable

Throws:
SemanticException

buildTypes

public Node buildTypes(TypeBuilder tb)
                throws SemanticException
build the type; the spec is included in the advice instance to give intelligible error messages - see adviceInstance overrides

Throws:
SemanticException

makeMethodInstance

protected MethodInstance makeMethodInstance(ClassType ct,
                                            TypeSystem ts)
                                     throws SemanticException
Throws:
SemanticException

prettyPrint

public void prettyPrint(CodeWriter w,
                        PrettyPrinter tr)

localMethod

public void localMethod(CodeInstance ci)
Description copied from interface: AdviceDecl
register methods or constructors that are local to the advice, for later use in weaver

Specified by:
localMethod in interface AdviceDecl
Parameters:
ci - code instance to register

update

public void update(GlobalAspectInfo gai,
                   Aspect current_aspect)
Description copied from interface: ContainsAspectInfo
Called by the AspectInfoHarvester to tell the node to put all relevant information into the GlobalAspectInfo.

Specified by:
update in interface ContainsAspectInfo
Parameters:
gai - the target of the information.
current_aspect - the aspect currently being traversed.

aspectMethodsEnter

public void aspectMethodsEnter(AspectMethods visitor)
Specified by:
aspectMethodsEnter in interface MakesAspectMethods

aspectMethodsLeave

public Node aspectMethodsLeave(AspectMethods visitor,
                               AJNodeFactory nf,
                               AJTypeSystem ts)
Specified by:
aspectMethodsLeave in interface MakesAspectMethods

enterAspectReflectionInspect

public void enterAspectReflectionInspect(AspectReflectionInspect v,
                                         Node parent)
Specified by:
enterAspectReflectionInspect in interface TransformsAspectReflection

leaveAspectReflectionInspect

public void leaveAspectReflectionInspect(AspectReflectionInspect v)
Specified by:
leaveAspectReflectionInspect in interface TransformsAspectReflection

enterAspectReflectionRewrite

public void enterAspectReflectionRewrite(AspectReflectionRewrite v,
                                         AJTypeSystem ts)
Specified by:
enterAspectReflectionRewrite in interface TransformsAspectReflection

leaveAspectReflectionRewrite

public Node leaveAspectReflectionRewrite(AspectReflectionRewrite v,
                                         AJNodeFactory nf)
Specified by:
leaveAspectReflectionRewrite in interface TransformsAspectReflection

entry

public Term entry()

acceptCFG

public java.util.List acceptCFG(CFGBuilder v,
                                java.util.List succs)
Visit this term in evaluation order.