Top Inners Fields Constructors Methods
org.aspectj.weaver.bcel

public Class BcelShadow

extends Shadow
Class Inheritance
Imports
java.lang.reflect.Modifier, java.util.ArrayList, .Collections, .HashMap, .List, .Map, org.aspectj.apache.bcel.Constants, org.aspectj.apache.bcel.classfile.ConstantPool, .Field, org.aspectj.apache.bcel.generic.ArrayType, .BranchHandle, .FieldInstruction, .INVOKEINTERFACE, .Instruction, .InstructionBranch, .InstructionConstants, .InstructionFactory, .InstructionHandle, .InstructionLV, .InstructionList, .InstructionTargeter, .InvokeInstruction, .LineNumberTag, .LocalVariableTag, .MULTIANEWARRAY, .ObjectType, .TargetLostException, .Type, org.aspectj.bridge.ISourceLocation, org.aspectj.weaver.Advice, .AdviceKind, .AjcMemberMaker, .BCException, .ConcreteTypeMunger, .IntMap, .Member, .MemberImpl, .NameMangler, .NewConstructorTypeMunger, .NewFieldTypeMunger, .NewMethodTypeMunger, .ResolvedMember, .ResolvedMemberImpl, .ResolvedType, .Shadow, .ShadowMunger, .UnresolvedType, .WeaverMessages, .World, org.aspectj.weaver.ast.Var, org.aspectj.weaver.patterns.AbstractPatternNodeVisitor, .AndPointcut, .NotPointcut, .OrPointcut, .ThisOrTargetPointcut

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private String
private boolean
public static boolean
private BcelVar[]
pack-priv BcelVar
private List<BcelAdvice>
pack-priv boolean
private final LazyMethodGen
private boolean
private Map<ResolvedType, AnnotationAccessVar>
private int
private static final String[]
private ShadowRange
private int
private Map<ResolvedType, TypeAnnotationAccessVar>
private BcelVar
private Map<ResolvedType, TypeAnnotationAccessVar>
private BcelVar
private BcelVar
private BcelVar
private Map<ResolvedType, AnnotationAccessVar>
private Map<ResolvedType, AnnotationAccessVar>
private final BcelWorld
Inherited from org.aspectj.weaver.Shadow:
ADVICE_EXECUTIONAdviceExecutionAdviceExecutionBitALL_SHADOW_KINDS_BITSCONSTRUCTOR_CALLCONSTRUCTOR_EXECUTIONConstructorCallConstructorCallBitConstructorExecutionConstructorExecutionBitenclosingShadowEXCEPTION_HANDLERExceptionHandlerExceptionHandlerBitFIELD_GETFIELD_SETFieldGetFieldGetBitFieldSetFieldSetBitINITIALIZATIONInitializationInitializationBitMAX_SHADOW_KINDMETHOD_CALLMETHOD_EXECUTIONMethodCallMethodCallBitMethodExecutionMethodExecutionBitmungersneedAroundClosureStackingNO_SHADOW_KINDS_BITSPREINITIALIZATIONPreInitializationPreInitializationBitSHADOW_KINDSshadowIdSTATICINITIALIZATIONStaticInitializationStaticInitializationBitSYNCHRONIZATION_LOCKSYNCHRONIZATION_UNLOCKSynchronizationLockSynchronizationLockBitSynchronizationUnlockSynchronizationUnlockBit

Constructor Summary

AccessConstructor and Description
public
BcelShadow(BcelWorld world, Shadow.Kind kind, Member signature, LazyMethodGen enclosingMethod, BcelShadow enclosingShadow)

This generates an unassociated shadow, rooted in a particular method but not rooted to any particular point in the code.

Method Summary

Modifier and TypeMethod and Description
public void
private void
addPreInitializationReturnCode(LazyMethodGen extractedMethod, Type[] superConstructorTypes)

private Type[]
addTypeToEnd(Type type, Type[] types)

private Type[]
addTypeToFront(Type type, Type[] types)

public boolean
arg0HoldsThis()

Is arg0 occupied with the value of this

private boolean
private boolean
private boolean
public BcelShadow
copyInto(LazyMethodGen recipient, BcelShadow enclosing)

private LazyMethodGen
createShadowMethodGen(String newMethodName, int visibilityModifier, List<String> parameterNames, boolean beingPlacedInInterface)

The new method always static.

pack-priv InstructionList
private boolean

Returns:

true if managed to remove them
deleteNewAndDup
()

The new/dup (or new/dup_x1/swap) are removed and will be readded later (after the advice call) by the caller of this method.

public void
ensureInitializedArgVar(int argNumber)

public UnresolvedType
pack-priv LazyMethodGen
extractShadowInstructionsIntoNewMethod(String
name for the new method
extractedMethodName
,
int
visibility modifiers for the new method
extractedMethodVisibilityModifier
,
ISourceLocation
source location of the advice affecting the shadow
adviceSourceLocation
,
List<String> parameterNames, boolean
is this new method going into an interface
beingPlacedInInterface
)

Extract the instructions in the shadow to a new method.

private ResolvedMember
findField(ResolvedMember[] members, Member lookingFor)

private static String
private ResolvedMember
findMethod(ResolvedType aspectType, ResolvedMember ajcMethod)

private ResolvedMember
private List<InstructionHandle>

Returns:

a list of all the return instructions in the range of this shadow
findReturnInstructions
()

private BcelVar

Returns:

the variable holding the return value, if needed
generateReturnInstructions
(List<InstructionHandle>
list of all the return instructions in the shadow
returns
,
InstructionList
instruction list into which the return instructions should be generated
returnInstructions
)

Given a list containing all the return instruction handles for this shadow, finds the last return instruction and copies it, making this the ultimate return.

public BcelVar
public BcelVar
genTempVar(UnresolvedType typeX, String localName)

private int
genTempVarIndex(int size)

public String
private InstructionList
getAfterReturningAdviceDispatchInstructions(BcelAdvice munger, InstructionHandle firstInstructionInReturnSequence)

Get the list of instructions used to dispatch to the after advice

protected ResolvedType[]
getAnnotations(ResolvedMember foundMember, Member relevantMember, ResolvedType relevantType)

public Var
public Var
public LazyClassGen
public Member
public LazyMethodGen
public Shadow
public ResolvedType
public InstructionFactory
public World
public Var
public ShadowRange
public Member
private InstructionList
getRedoneProceedCall(InstructionFactory fact, LazyMethodGen callbackMethod, BcelAdvice munger, LazyMethodGen localAdviceMethod, List<BcelVar> argVarList)

private InstructionList
getRedoneProceedCallForAnnotationStyle(InstructionFactory fact, LazyMethodGen callbackMethod, BcelAdvice munger, LazyMethodGen localAdviceMethod, List<BcelVar> argVarList, boolean isProceedWithArgs)

Annotation style handling for inlining.

protected ResolvedMember
getRelevantMember(ResolvedMember foundMember, Member relevantMember, ResolvedType relevantType)

public int
public ISourceLocation
private Type[]
public Var
public Var
getTargetVar()

Implements abstract org.aspectj.weaver.Shadow.getTargetVar.

a var referencing the target
public Var
public BcelVar
public BcelVar
getThisEnclosingJoinPointStaticPartBcelVar()

Get the Var for the enclosingJpStaticPart

public final Var
public BcelVar
public BcelVar
getThisJoinPointStaticPartBcelVar(final boolean
true to have the enclosingJpStaticPart
isEnclosingJp
)

Get the Var for the xxxxJpStaticPart, xxx = this or enclosing

public final Var
public Var
public Var
getThisVar()

Implements abstract org.aspectj.weaver.Shadow.getThisVar.

a var referencing this
public Var
public Var
public BcelWorld
private boolean

Returns:

true, iff this shadow returns a value
hasANonVoidReturnType
()

public void
init()

public void
initializeArgVars()

Initialize all the available arguments at the shadow.

public void
public void
initializeKindedAnnotationVars()

By determining what "kind" of shadow we are, we can find out the annotations on the appropriate element (method, field, constructor, type).

public void
public void
public void
pack-priv void
private void
public void
public void
public void
private BcelVar
insertAdviceInstructionsForBindingReturningParameter(InstructionList advice)

If the after() returning(Foo f) form is used, bind the return value to the parameter.

private boolean
isAnnotationStylePassingProceedingJoinPointOutOfAdvice(BcelAdvice munger, boolean hasDynamicTest, LazyMethodGen adviceMethod)

Check if the advice method passes a pjp parameter out via an invoke instruction - if so we can't risk inlining.

public boolean
private boolean
pack-priv InstructionList
public static BcelShadow
private InstructionList
public static BcelShadow
makeArrayConstructorCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle arrayInstruction, BcelShadow enclosingShadow)

pack-priv InstructionList
private LazyMethodGen
makeClosureClassAndReturnConstructor(String closureClassName, LazyMethodGen
the method we will call back to when our run method gets called.
callbackMethod
,
IntMap
A map from state position to proceed argument position. May be non covering on state position.
proceedMap
)

private InstructionList
makeClosureInstantiation(Member constructor, BcelVar holder)

side-effect-free

public static BcelShadow
makeConstructorCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle callHandle, BcelShadow enclosingShadow)

public static BcelShadow
makeConstructorExecution(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle justBeforeStart)

public static BcelShadow
makeExceptionHandler(BcelWorld world, ExceptionRange exceptionRange, LazyMethodGen enclosingMethod, InstructionHandle startOfHandler, BcelShadow enclosingShadow)

Make the shadow for an exception handler.

public static BcelShadow
makeFieldGet(BcelWorld world, ResolvedMember field, LazyMethodGen enclosingMethod, InstructionHandle getHandle, BcelShadow enclosingShadow)

public static BcelShadow
makeFieldSet(BcelWorld world, ResolvedMember field, LazyMethodGen enclosingMethod, InstructionHandle setHandle, BcelShadow enclosingShadow)

public static BcelShadow
makeIfaceInitialization(BcelWorld world, LazyMethodGen constructor, Member interfaceConstructorSignature)

create an init join point associated w/ an interface in the body of a constructor

public static BcelShadow
makeMethodCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle callHandle, BcelShadow enclosingShadow)

public static BcelShadow
makeMethodExecution(BcelWorld world, LazyMethodGen enclosingMethod, boolean lazyInit)

public static BcelShadow
public static BcelShadow
makeMonitorEnter(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle monitorInstruction, BcelShadow enclosingShadow)

public static BcelShadow
makeMonitorExit(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle monitorInstruction, BcelShadow enclosingShadow)

private IntMap
private IntMap
makeRemap()

make a map from old frame location to new frame location.

public static BcelShadow
makeShadowForMethod(BcelWorld world, LazyMethodGen enclosingMethod, Shadow.Kind kind, Member sig)

public static BcelShadow
makeShadowForMethodCall(BcelWorld world, LazyMethodGen enclosingMethod, InstructionHandle callHandle, BcelShadow enclosingShadow, Shadow.Kind kind, ResolvedMember sig)

public static BcelShadow
public static BcelShadow
makeUnfinishedInitialization(BcelWorld world, LazyMethodGen
The constructor starting this initialization.
constructor
)

Create an initialization join point associated with a constructor, but not with any body of code yet.

public static BcelShadow
protected void
prepareForMungers()

Overrides org.aspectj.weaver.Shadow.prepareForMungers.

Prepare the shadow for implementation.
public void
requireThisJoinPoint(boolean hasGuardTest, boolean isAround)

public static void
private void
private void
retargetReturnInstruction(boolean hasReturningParameter, BcelVar returnValueVar, InstructionHandle gotoTarget, InstructionHandle returnHandle)

Helper method for weaveAfterReturning Each return instruction in the method body is retargeted by calling this method.

private boolean
public void
public void
public boolean
terminatesWithReturn()

If the end of my range has no real instructions following then my context needs a return at the end.

public void
public void
weaveAfterReturning(BcelAdvice munger)

The basic strategy here is to add a set of instructions at the end of the shadow range that dispatch the advice, and then return whatever the shadow was going to return anyway.

public void
public void
weaveAroundClosure(BcelAdvice munger, boolean hasDynamicTest)

public void
weaveAroundInline(BcelAdvice munger, boolean hasDynamicTest)

pack-priv void
public void
weaveCflowEntry(final BcelAdvice munger, final Member cflowField)

public void
weavePerObjectEntry(final BcelAdvice munger, final BcelVar onVar)

public void
weavePerTypeWithinAspectInitialization(final BcelAdvice munger, UnresolvedType t)

Causes the aspect instance to be *set* for later retrievable through localAspectof()/aspectOf()

public void
Inherited from org.aspectj.weaver.Shadow:
addMungercheckCanThrowcheckMungergetArgCountgetArgTypegetArgTypesgetArgumentTypesForArrayConstructionShadowgetGenericArgTypesgetKindgetMatchingSignaturegetMungersgetResolvedSignaturegetReturnTypegetSignaturegetTargetTypegetThisTypehasTargethasThishowManyimplementisShadowForArrayConstructionJoinpointisShadowForMonitorsetMatchingSignaturetoResolvedStringtoSettoString