return;
}
}
// Time to construct the method itself:
LazyMethodGen advice = new LazyMethodGen(Modifier.PUBLIC, returnType, adviceName, paramTypes.toArray(new Type[paramTypes
.size()]), EMPTY_STRINGS, cg);
InstructionList adviceBody = advice.getBody();
// Generate code to load the parameters
int pos = 1; // first slot after 'this'
for (int i = 0; i < paramTypes.size(); i++) {
adviceBody.append(InstructionFactory.createLoad(paramTypes.get(i), pos));
pos += paramTypes.get(i).getSize();
}
// Generate the delegate call
adviceBody.append(cg.getFactory().createInvoke(paa.adviceClass, methodName, signature + returnType.getSignature(),
Constants.INVOKESTATIC));
// Generate the right return
if (returnType == Type.VOID) {
adviceBody.append(InstructionConstants.RETURN);
} else {
if (returnType.getSignature().length() < 2) {
String sig = returnType.getSignature();
if (sig.equals("F")) {
adviceBody.append(InstructionConstants.FRETURN);
} else if (sig.equals("D")) {
adviceBody.append(InstructionConstants.DRETURN);
} else if (sig.equals("J")) {
adviceBody.append(InstructionConstants.LRETURN);
} else {
adviceBody.append(InstructionConstants.IRETURN);
}
} else {
adviceBody.append(InstructionConstants.ARETURN);
}
}
// Add the annotation
advice.addAnnotation(aaj);
InstructionHandle start = adviceBody.getStart();
// Setup the local variable targeters so that the binding will work
String sig = concreteAspect.name.replace('.', '/');
start.addTargeter(new LocalVariableTag("L" + sig + ";", "this", 0, start.getPosition()));