public class BcelShadow extends Shadow {
+ private static final String[] NoDeclaredExceptions = new String[0];
+
private ShadowRange range;
private final BcelWorld world;
private final LazyMethodGen enclosingMethod;
}
}
- public Member getRealEnclosingCodeSignature() {
- return enclosingMethod.getMemberView();
- }
+ public Member getRealEnclosingCodeSignature() {
+ return enclosingMethod.getMemberView();
+ }
// public Member getEnclosingCodeSignatureForModel() {
// if (getKind().isEnclosingKind()) {
if (rm.hasBackingGenericMember())
mungerSig = rm.getBackingGenericMember();
}
- ResolvedType declaringType = world.resolve(mungerSig.getDeclaringType(), true);
- if (declaringType.isMissing()) {
+ ResolvedType declaringAspectType = world.resolve(mungerSig.getDeclaringType(), true);
+ if (declaringAspectType.isMissing()) {
world.getLint().cantFindType.signal(new String[] { WeaverMessages.format(
- WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE, declaringType.getClassName()) }, getSourceLocation(),
+ WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE, declaringAspectType.getClassName()) }, getSourceLocation(),
new ISourceLocation[] { munger.getSourceLocation() });
// IMessage msg = new Message(
// WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_DURING_AROUND_WEAVE,declaringType.getClassName()),
// world.getMessageHandler().handleMessage(msg);
}
// ??? might want some checks here to give better errors
- ResolvedType rt = (declaringType.isParameterizedType() ? declaringType.getGenericType() : declaringType);
+ ResolvedType rt = (declaringAspectType.isParameterizedType() ? declaringAspectType.getGenericType() : declaringAspectType);
BcelObjectType ot = BcelWorld.getBcelObjectType(rt);
// if (ot==null) {
// world.getMessageHandler().handleMessage(
LazyMethodGen extractedMethod = extractMethod(NameMangler.aroundCallbackMethodName(getSignature(), new Integer(
getEnclosingClass().getNewGeneratedNameTag()).toString()), Modifier.PRIVATE, munger);
- // now extract the advice into its own method
- String adviceMethodName = NameMangler.aroundCallbackMethodName(getSignature(), new Integer(getEnclosingClass()
- .getNewGeneratedNameTag()).toString())
- + "$advice";
-
- List argVarList = new ArrayList();
+ List argsToCallLocalAdviceMethodWith = new ArrayList();
List proceedVarList = new ArrayList();
int extraParamOffset = 0;
// be rationalized in the future
if (thisVar != null) {
- argVarList.add(thisVar);
+ argsToCallLocalAdviceMethodWith.add(thisVar);
proceedVarList.add(new BcelVar(thisVar.getType(), extraParamOffset));
extraParamOffset += thisVar.getType().getSize();
}
if (targetVar != null && targetVar != thisVar) {
- argVarList.add(targetVar);
+ argsToCallLocalAdviceMethodWith.add(targetVar);
proceedVarList.add(new BcelVar(targetVar.getType(), extraParamOffset));
extraParamOffset += targetVar.getType().getSize();
}
for (int i = 0, len = getArgCount(); i < len; i++) {
- argVarList.add(argVars[i]);
+ argsToCallLocalAdviceMethodWith.add(argVars[i]);
proceedVarList.add(new BcelVar(argVars[i].getType(), extraParamOffset));
extraParamOffset += argVars[i].getType().getSize();
}
if (thisJoinPointVar != null) {
- argVarList.add(thisJoinPointVar);
+ argsToCallLocalAdviceMethodWith.add(thisJoinPointVar);
proceedVarList.add(new BcelVar(thisJoinPointVar.getType(), extraParamOffset));
extraParamOffset += thisJoinPointVar.getType().getSize();
}
System.arraycopy(adviceParameterTypes, 0, parameterTypes, parameterIndex, adviceParameterTypes.length);
// parameterTypes is [Bug, C, org.aspectj.lang.JoinPoint, X, org.aspectj.lang.ProceedingJoinPoint, java.lang.Object,
// java.lang.Object]
+
+ // now extract the advice into its own method
+ String localAdviceMethodName = NameMangler.aroundAdviceMethodName(getSignature(), new Integer(getEnclosingClass()
+ .getNewGeneratedNameTag()).toString());
LazyMethodGen localAdviceMethod = new LazyMethodGen(Modifier.PRIVATE | Modifier.FINAL | Modifier.STATIC, BcelWorld
- .makeBcelType(mungerSig.getReturnType()), adviceMethodName, parameterTypes, new String[0], getEnclosingClass());
+ .makeBcelType(mungerSig.getReturnType()), localAdviceMethodName, parameterTypes, new String[0], getEnclosingClass());
String donorFileName = adviceMethod.getEnclosingClass().getInternalFileName();
String recipientFileName = getEnclosingClass().getInternalFileName();
InstructionList advice = new InstructionList();
// InstructionHandle adviceMethodInvocation;
{
- for (Iterator i = argVarList.iterator(); i.hasNext();) {
+ for (Iterator i = argsToCallLocalAdviceMethodWith.iterator(); i.hasNext();) {
BcelVar var = (BcelVar) i.next();
var.appendLoad(advice, fact);
}
targetType = getThisType();
}
}
- parameterTypes = addType(BcelWorld.makeBcelType(targetType), parameterTypes);
+ parameterTypes = addTypeToFront(BcelWorld.makeBcelType(targetType), parameterTypes);
}
if (thisVar != null) {
UnresolvedType thisType = getThisType();
- parameterTypes = addType(BcelWorld.makeBcelType(thisType), parameterTypes);
+ parameterTypes = addTypeToFront(BcelWorld.makeBcelType(thisType), parameterTypes);
}
// We always want to pass down thisJoinPoint in case we have already woven
returnType = UnresolvedType.OBJECTARRAY;
} else {
- if (getKind() == ConstructorCall)
+ if (getKind() == ConstructorCall) {
returnType = getSignature().getDeclaringType();
- else if (getKind() == FieldSet)
+ } else if (getKind() == FieldSet) {
returnType = ResolvedType.VOID;
- else
+ } else {
returnType = getSignature().getReturnType().resolve(world);
- // returnType = getReturnType(); // for this and above lines, see pr137496
+ // returnType = getReturnType(); // for this and above lines, see pr137496
+ }
}
- return new LazyMethodGen(modifiers, BcelWorld.makeBcelType(returnType), newMethodName, parameterTypes, new String[0],
- // XXX again, we need to look up methods!
+ return new LazyMethodGen(modifiers, BcelWorld.makeBcelType(returnType), newMethodName, parameterTypes,
+ NoDeclaredExceptions,
+ // XXX again, we need to look up methods!
// UnresolvedType.getNames(getSignature().getExceptions(world)),
getEnclosingClass());
}
return p1.equals(p2);
}
- private Type[] addType(Type type, Type[] types) {
+ private Type[] addTypeToFront(Type type, Type[] types) {
int len = types.length;
Type[] ret = new Type[len + 1];
ret[0] = type;