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

pack-priv Class BcelAdvice

extends Advice
Class Inheritance
Imports
java.lang.reflect.Modifier, java.util.ArrayList, .Collection, .Collections, .Map, org.aspectj.apache.bcel.Constants, org.aspectj.apache.bcel.classfile.LocalVariable, .LocalVariableTable, org.aspectj.apache.bcel.generic.InstructionConstants, .InstructionFactory, .InstructionHandle, .InstructionList, .LineNumberTag, .LocalVariableTag, org.aspectj.bridge.ISourceLocation, .Message, org.aspectj.weaver.Advice, .AdviceKind, .AjAttribute, .BCException, .IEclipseSourceContext, .ISourceContext, .Lint, .Member, .ReferenceType, .ReferenceTypeDelegate, .ResolvedMember, .ResolvedMemberImpl, .ResolvedType, .Shadow, .ShadowMunger, .UnresolvedType, .WeaverMessages, .World, org.aspectj.weaver.ast.Literal, .Test, org.aspectj.weaver.patterns.ExactTypePattern, .ExposedState, .PerClause, .Pointcut

Advice implemented for BCEL
Authors
Erik Hilsdale, Jim Hugunin, Andy Clement

Field Summary

Modifier and TypeField and Description
private int
private ExposedState
private Test
runtimeTest

If a match is not entirely statically determinable, this captures the runtime test that must succeed in order for the advice to run.

private Collection<ResolvedType>
Inherited from org.aspectj.weaver.Advice:
attributebindingParameterTypesconcreteAspectConstantReferenceConstantValueexceptionTypeExtraArgumenthasMatchedAtLeastOnceinnerCflowEntrieskindlastReportedMonitorExitJoinpointLocationnFreeVarsParameterMasksignaturesuppressedLintKindsThisAspectInstanceThisEnclosingJoinPointStaticPartThisJoinPointThisJoinPointStaticPart

Constructor Summary

AccessConstructor and Description
public
BcelAdvice(AjAttribute.AdviceAttribute attribute, Pointcut pointcut, Member adviceSignature, ResolvedType concreteAspect)

public
BcelAdvice(AdviceKind kind, Pointcut pointcut, Member signature, int extraArgumentFlags, int start, int end, ISourceContext sourceContext, ResolvedType concreteAspect)

For testing only

Method Summary

Modifier and TypeMethod and Description
private boolean
public boolean
private boolean
protected void
private Collection<ResolvedType>
public int
public ShadowMunger
concretize(ResolvedType
is guaranteed to be a non-abstract aspect
fromType
,
World world, PerClause
has been concretized at a higher level
clause
)

Overrides org.aspectj.weaver.Advice.concretize.

public InstructionList
getAdviceArgSetup(BcelShadow shadow, BcelVar extraVar, InstructionList closureInstantiation)

pack-priv InstructionList
getAdviceInstructions(BcelShadow
The shadow around which these instructions will eventually live.
s
,
BcelVar
The var that will hold the return value or thrown exception for afterX advice
extraArgVar
,
InstructionHandle
The instructionHandle to jump to if the dynamic tests for this munger fails.
ifNoAdvice
)

get the instruction list for the really simple version of this advice.

public BcelVar[]
getExposedStateAsBcelVars(boolean isAround)

public InstructionList
public Member
public InstructionList
public Collection<ResolvedType>
public boolean
public boolean
implementOn(Shadow
the shadow where this munger should be applied
s
)

Implements abstract org.aspectj.weaver.ShadowMunger.implementOn.

Implement this munger at the specified shadow, returning a boolean to indicate success.
public boolean
match(Shadow shadow, World world)

Overrides org.aspectj.weaver.Advice.match.

All overriding methods should call super
public boolean
mustCheckExceptions()

Implements abstract org.aspectj.weaver.ShadowMunger.mustCheckExceptions.

The munger must not check for the advice exceptions to be declared by the shadow in the case of @AJ aspects so that around can throws Throwable
public ShadowMunger
private void
removeUnnecessaryProblems(BcelMethod method, int problemLineNumber)

private static Member
simplify(AdviceKind kind, Member adviceSignature)

A heavyweight BcelMethod object is only required for around advice that will be inlined.

public void
protected void
Inherited from org.aspectj.weaver.Advice:
countOnesequalsextraParametersToStringgetBaseParameterCountgetBaseParameterNamesgetBindingParameterTypesgetConcreteAspectgetDeclaringAspectgetExtraParameterCountgetExtraParameterFlagsgetExtraParameterTypegetKindgetPointcutgetSignaturehasExtraParameterhashCodehasMatchedSomethingisAnnotationStyleisAroundAdvicemakeCflowEntrymakePerCflowEntrymakePerObjectEntrymakePerTypeWithinEntrymakeSoftenersetBindingParameterTypessetHasMatchedSomethingsetLexicalPositiontoString

Field Detail

containsInvokedynamicback to summary
private int containsInvokedynamic
exposedStateback to summary
private ExposedState exposedState
runtimeTestback to summary
private Test runtimeTest

If a match is not entirely statically determinable, this captures the runtime test that must succeed in order for the advice to run.

thrownExceptionsback to summary
private Collection<ResolvedType> thrownExceptions

Constructor Detail

BcelAdviceback to summary
public BcelAdvice(AjAttribute.AdviceAttribute attribute, Pointcut pointcut, Member adviceSignature, ResolvedType concreteAspect)
BcelAdviceback to summary
public BcelAdvice(AdviceKind kind, Pointcut pointcut, Member signature, int extraArgumentFlags, int start, int end, ISourceContext sourceContext, ResolvedType concreteAspect)

For testing only

Method Detail

aspectIsBrokenback to summary
private boolean aspectIsBroken()
bindsProceedingJoinPointback to summary
public boolean bindsProceedingJoinPoint()

Overrides org.aspectj.weaver.ShadowMunger.bindsProceedingJoinPoint.

canInlineback to summary
private boolean canInline(Shadow s)
clearLintSuppressionsback to summary
protected void clearLintSuppressions(World inWorld, Collection<Lint.Kind> toClear)
collectCheckedExceptionsback to summary
private Collection<ResolvedType> collectCheckedExceptions(UnresolvedType[] excs)
compareToback to summary
public int compareTo(Object other)

Implements org.aspectj.util.PartialOrder.PartialComparable.compareTo.

Returns:int

Doc from org.aspectj.util.PartialOrder.PartialComparable.compareTo.

  • +1 if this is greater than other
  • -1 if this is less than other
  • 0 if this is not comparable to other

Note

returning 0 from this method doesn't mean the same thing as returning 0 from java.util.Comparable.compareTo()

concretizeback to summary
public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause)

Overrides org.aspectj.weaver.Advice.concretize.

Parameters
fromType:ResolvedType

Doc from org.aspectj.weaver.Advice.concretize.

is guaranteed to be a non-abstract aspect

clause:PerClause

Doc from org.aspectj.weaver.Advice.concretize.

has been concretized at a higher level

Annotations
@Override
getAdviceArgSetupback to summary
public InstructionList getAdviceArgSetup(BcelShadow shadow, BcelVar extraVar, InstructionList closureInstantiation)
getAdviceInstructionsback to summary
pack-priv InstructionList getAdviceInstructions(BcelShadow s, BcelVar extraArgVar, InstructionHandle ifNoAdvice)

get the instruction list for the really simple version of this advice. Is broken apart for other advice, but if you want it in one block, this is the method to call.

Parameters
s:BcelShadow

The shadow around which these instructions will eventually live.

extraArgVar:BcelVar

The var that will hold the return value or thrown exception for afterX advice

ifNoAdvice:InstructionHandle

The instructionHandle to jump to if the dynamic tests for this munger fails.

getExposedStateAsBcelVarsback to summary
public BcelVar[] getExposedStateAsBcelVars(boolean isAround)
getNonTestAdviceInstructionsback to summary
public InstructionList getNonTestAdviceInstructions(BcelShadow shadow)
getOriginalSignatureback to summary
public Member getOriginalSignature()

Overrides org.aspectj.weaver.Advice.getOriginalSignature.

Annotations
@Override
getTestInstructionsback to summary
public InstructionList getTestInstructions(BcelShadow shadow, InstructionHandle sk, InstructionHandle fk, InstructionHandle next)
getThrownExceptionsback to summary
public Collection<ResolvedType> getThrownExceptions()

Implements abstract org.aspectj.weaver.ShadowMunger.getThrownExceptions.

Returns:Collection<ResolvedType>

Doc from org.aspectj.weaver.ShadowMunger.getThrownExceptions.

a Collection of ResolvedTypes for all checked exceptions that might be thrown by this munger

Annotations
@Override
hasDynamicTestsback to summary
public boolean hasDynamicTests()

Implements abstract org.aspectj.weaver.Advice.hasDynamicTests.

Annotations
@Override
implementOnback to summary
public boolean implementOn(Shadow s)

Implements abstract org.aspectj.weaver.ShadowMunger.implementOn.

Doc from org.aspectj.weaver.ShadowMunger.implementOn.

Implement this munger at the specified shadow, returning a boolean to indicate success.

Parameters
s:Shadow

the shadow where this munger should be applied

Returns:boolean

true if the implement was successful

Annotations
@Override
matchback to summary
public boolean match(Shadow shadow, World world)

Overrides org.aspectj.weaver.Advice.match.

Doc from org.aspectj.weaver.ShadowMunger.match.

All overriding methods should call super

Annotations
@Override
mustCheckExceptionsback to summary
public boolean mustCheckExceptions()

Implements abstract org.aspectj.weaver.ShadowMunger.mustCheckExceptions.

The munger must not check for the advice exceptions to be declared by the shadow in the case of @AJ aspects so that around can throws Throwable

Annotations
@Override
parameterizeWithback to summary
public ShadowMunger parameterizeWith(ResolvedType declaringType, Map<String, UnresolvedType> typeVariableMap)

Implements abstract org.aspectj.weaver.ShadowMunger.parameterizeWith.

Annotations
@Override
removeUnnecessaryProblemsback to summary
private void removeUnnecessaryProblems(BcelMethod method, int problemLineNumber)
simplifyback to summary
private static Member simplify(AdviceKind kind, Member adviceSignature)

A heavyweight BcelMethod object is only required for around advice that will be inlined. For other kinds of advice it is possible to save some space.

specializeOnback to summary
public void specializeOn(Shadow shadow)

Implements abstract org.aspectj.weaver.ShadowMunger.specializeOn.

Annotations
@Override
suppressLintWarningsback to summary
protected void suppressLintWarnings(World inWorld)