abc.aspectj.ast
Class IntertypeConstructorDecl_c

java.lang.Object
  extended by ConstructorDecl_c
      extended by abc.aspectj.ast.IntertypeConstructorDecl_c
All Implemented Interfaces:
IntertypeConstructorDecl, IntertypeDecl, MakesAspectMethods, ContainsAspectInfo

public class IntertypeConstructorDecl_c
extends ConstructorDecl_c
implements IntertypeConstructorDecl, ContainsAspectInfo, MakesAspectMethods

Author:
Oege de Moor, Aske Simon Christensen

Field Summary
protected  TypeNode host
           
protected  java.lang.String identifier
           
protected  InterTypeConstructorInstance_c itConstructorInstance
           
protected  Flags originalFlags
           
protected  LocalInstance thisParamInstance
           
 
Constructor Summary
IntertypeConstructorDecl_c(Position pos, Flags flags, TypeNode host, java.lang.String name, java.util.List formals, java.util.List throwTypes, Block body)
           
 
Method Summary
 IntertypeConstructorDecl accessChange(AJNodeFactory nf, AJTypeSystem ts)
           
 NodeVisitor addMembersEnter(AddMemberVisitor am)
           
 void aspectMethodsEnter(AspectMethods visitor)
           
 Node aspectMethodsLeave(AspectMethods visitor, AJNodeFactory nf, AJTypeSystem ts)
           
 Context enterScope(Context c)
           
 TypeNode host()
          the target class of the intertype decl
 IntertypeConstructorDecl liftMethods(AJNodeFactory nf, AJTypeSystem ts, java.util.List methodDecls)
          given an intertype constructor declaration of the form A.new(formal1, ...
static void overrideITDconstructor(ClassType pht, ConstructorInstance mi)
           
 void prettyPrint(CodeWriter w, PrettyPrinter tr)
           
protected  IntertypeConstructorDecl_c reconstruct(java.util.List formals, java.util.List throwTypes, Block body, TypeNode host)
           
 Expr thisReference(AJNodeFactory nf, AJTypeSystem ts)
          create a reference to the "this" parameter
 Node typeCheck(TypeChecker tc)
          Duplicate most of the things for ConstructorDecl here to avoid comparing the name against the contaning class.
 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

host

protected TypeNode host

thisParamInstance

protected LocalInstance thisParamInstance

identifier

protected java.lang.String identifier

originalFlags

protected Flags originalFlags

itConstructorInstance

protected InterTypeConstructorInstance_c itConstructorInstance
Constructor Detail

IntertypeConstructorDecl_c

public IntertypeConstructorDecl_c(Position pos,
                                  Flags flags,
                                  TypeNode host,
                                  java.lang.String name,
                                  java.util.List formals,
                                  java.util.List throwTypes,
                                  Block body)
Method Detail

host

public TypeNode host()
Description copied from interface: IntertypeDecl
the target class of the intertype decl

Specified by:
host in interface IntertypeDecl

reconstruct

protected IntertypeConstructorDecl_c reconstruct(java.util.List formals,
                                                 java.util.List throwTypes,
                                                 Block body,
                                                 TypeNode host)

visitChildren

public Node visitChildren(NodeVisitor v)

addMembersEnter

public NodeVisitor addMembersEnter(AddMemberVisitor am)

overrideITDconstructor

public static void overrideITDconstructor(ClassType pht,
                                          ConstructorInstance mi)

accessChange

public IntertypeConstructorDecl accessChange(AJNodeFactory nf,
                                             AJTypeSystem ts)

thisReference

public Expr thisReference(AJNodeFactory nf,
                          AJTypeSystem ts)
create a reference to the "this" parameter

Specified by:
thisReference in interface IntertypeDecl

liftMethods

public IntertypeConstructorDecl liftMethods(AJNodeFactory nf,
                                            AJTypeSystem ts,
                                            java.util.List methodDecls)
given an intertype constructor declaration of the form A.new(formal1, ...,formaln) { ccall(E1,E2,...,Ek); // optional call to super or this init; } we want to transform it into the following shape A.new(formal1, ..., formaln) { receiver.ccall(e1(formal1,...,formaln), ..., ek(formal1,...,formaln)); // no longer optional body(this,formal1,...,formaln); } where e1,...,ek and body are newly generated methods in the originating aspect. We detect the special case that one of the original Ei is just a reference to a formal; in that case no method is lifted out. The generated methods are appended onto the list that is the last parameter. Because we aim not to override the Jimplifier behaviour, it is not possible to Jimplify the generated constructor: references to this and super would refer to the originating aspect, not the target. For that reason we record the following information, which is later stored in the AspectInfo structure: - formal types: List aiFormalTypes - qualifier of the ccall ReferenceType aiQualifier // may be null - kind of the ccall ConstructorCall.Kind aiKind - list of ei method instances or parameter positions List aiEis - body method instance MethodInstance aiBody Using this information, the weaver (more precisely, the IntertypeAdjuster) will generate code for the constructor in the target class.


typeCheck

public Node typeCheck(TypeChecker tc)
               throws SemanticException
Duplicate most of the things for ConstructorDecl here to avoid comparing the name against the contaning class.

Throws:
SemanticException

prettyPrint

public void prettyPrint(CodeWriter w,
                        PrettyPrinter tr)

enterScope

public Context enterScope(Context c)

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