abc.aspectj.ast
Class AdviceBody_c

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

public abstract class AdviceBody_c
extends AJMethodDecl_c
implements AdviceDecl, ContainsAspectInfo, MakesAspectMethods

An advice-body is similar to a normal method, but it can contain references to special variables like thisJoinPoint and, if it is around-advice, proceed().

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  boolean isAroundAdvice
           
protected  java.util.Set methodsInAdvice
           
protected  LocalInstance thisEnclosingJoinPointStaticPartInstance
           
protected  LocalInstance thisJoinPointInstance
           
protected  LocalInstance thisJoinPointStaticPartInstance
           
 
Constructor Summary
AdviceBody_c(Position pos, Flags flags, TypeNode return_type, java.lang.String name, java.util.List formals, java.util.List throwTypes, Block body, boolean isAroundAdvice)
           
 
Method Summary
protected  void addExtraFormals(AJNodeFactory nf, AJTypeSystem ts, java.util.List formals, java.util.List formalTypes)
           
protected abstract  java.lang.String adviceSignature()
           
 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)
           
protected  Expr dummyVal(AJNodeFactory nf, Type t)
           
 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
abstract  void prettyPrint(CodeWriter w, PrettyPrinter tr)
           
 MethodDecl proceedDecl(AJNodeFactory nf, AJTypeSystem ts)
          generate a dummy MethodDecl for the proceed.
 Node typeCheck(TypeChecker tc)
          Type check the advice: first the usual method checks, then whether the "throwing" result is actually throwable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface abc.aspectj.visit.ContainsAspectInfo
update
 

Field Detail

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

isAroundAdvice

protected boolean isAroundAdvice
Constructor Detail

AdviceBody_c

public AdviceBody_c(Position pos,
                    Flags flags,
                    TypeNode return_type,
                    java.lang.String name,
                    java.util.List formals,
                    java.util.List throwTypes,
                    Block body,
                    boolean isAroundAdvice)
Method Detail

disambiguateEnter

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

dummyVal

protected Expr dummyVal(AJNodeFactory nf,
                        Type t)

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();

addExtraFormals

protected void addExtraFormals(AJNodeFactory nf,
                               AJTypeSystem ts,
                               java.util.List formals,
                               java.util.List formalTypes)

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

adviceSignature

protected abstract java.lang.String adviceSignature()

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 abstract 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

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()