boolean fastSJP = false;
// avoid fast SJP if it is for an enclosing joinpoint
boolean isFastSJPAvailable = shadow.getWorld().isTargettingRuntime1_6_10()
&& !enclosingStaticTjpType.equals(field.getType());
Member sig = shadow.getSignature();
// load the factory
list.append(InstructionFactory.createLoad(factoryType, 0));
// load the kind
list.append(InstructionFactory.PUSH(getConstantPool(), shadow.getKind().getName()));
// create the signature
if (world.isTargettingAspectJRuntime12() || !isFastSJPAvailable || !sig.getKind().equals(Member.METHOD)) {
list.append(InstructionFactory.createLoad(factoryType, 0));
}
String signatureMakerName = SignatureUtils.getSignatureMakerName(sig);
ObjectType signatureType = new ObjectType(SignatureUtils.getSignatureType(sig));
UnresolvedType[] exceptionTypes = null;
if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We
// didn't have optimized
// factory methods in 1.2
list.append(InstructionFactory.PUSH(cp, SignatureUtils.getSignatureString(sig, shadow.getWorld())));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1,
Constants.INVOKEVIRTUAL));
} else if (sig.getKind().equals(Member.METHOD)) {
BcelWorld w = shadow.getWorld();
// For methods, push the parts of the signature on.
list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w))));
list.append(InstructionFactory.PUSH(cp, sig.getName()));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w))));
exceptionTypes = sig.getExceptions(w);
if (isFastSJPAvailable && exceptionTypes.length == 0) {
fastSJP = true;
} else {
list.append(InstructionFactory.PUSH(cp, makeString(exceptionTypes)));
}
list.append(InstructionFactory.PUSH(cp, makeString(sig.getReturnType())));
// And generate a call to the variant of makeMethodSig() that takes the strings
if (isFastSJPAvailable) {
fastSJP = true;
} else {
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY7,
Constants.INVOKEVIRTUAL));
}
} else if (sig.getKind().equals(Member.MONITORENTER)) {
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1,
Constants.INVOKEVIRTUAL));
} else if (sig.getKind().equals(Member.MONITOREXIT)) {
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1,
Constants.INVOKEVIRTUAL));
} else if (sig.getKind().equals(Member.HANDLER)) {
BcelWorld w = shadow.getWorld();
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w))));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY3,
Constants.INVOKEVIRTUAL));
} else if (sig.getKind().equals(Member.CONSTRUCTOR)) {
BcelWorld w = shadow.getWorld();
if (w.isJoinpointArrayConstructionEnabled() && sig.getDeclaringType().isArray()) {
// its the magical new jp
list.append(InstructionFactory.PUSH(cp, makeString(Modifier.PUBLIC)));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes())));
list.append(InstructionFactory.PUSH(cp, "")); // sig.getParameterNames?
list.append(InstructionFactory.PUSH(cp, ""));// sig.getExceptions?
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY5,
Constants.INVOKEVIRTUAL));
} else {
list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w))));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w))));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getExceptions(w))));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY5,
Constants.INVOKEVIRTUAL));
}
} else if (sig.getKind().equals(Member.FIELD)) {
BcelWorld w = shadow.getWorld();
list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w))));
list.append(InstructionFactory.PUSH(cp, sig.getName()));
// see pr227401
UnresolvedType dType = sig.getDeclaringType();
if (dType.getTypekind() == TypeKind.PARAMETERIZED || dType.getTypekind() == TypeKind.GENERIC) {
dType = sig.getDeclaringType().resolve(world).getGenericType();
}
list.append(InstructionFactory.PUSH(cp, makeString(dType)));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getReturnType())));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY4,
Constants.INVOKEVIRTUAL));
} else if (sig.getKind().equals(Member.ADVICE)) {
BcelWorld w = shadow.getWorld();
list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w))));
list.append(InstructionFactory.PUSH(cp, sig.getName()));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes())));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w))));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getExceptions(w))));
list.append(InstructionFactory.PUSH(cp, makeString((sig.getReturnType()))));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, new Type[] { Type.STRING,
Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING }, Constants.INVOKEVIRTUAL));
} else if (sig.getKind().equals(Member.STATIC_INITIALIZATION)) {
BcelWorld w = shadow.getWorld();
list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w))));
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType())));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY2,
Constants.INVOKEVIRTUAL));
} else {
list.append(InstructionFactory.PUSH(cp, SignatureUtils.getSignatureString(sig, shadow.getWorld())));
list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1,