final AspectInfo aspectInfo,
final String joinPointClassName) {
String aspectClassSignature = aspectInfo.getAspectClassSignature();
String aspectClassName = aspectInfo.getAspectClassName();
// retrieve the aspect set it to the field
DeploymentModel deploymentModel = aspectInfo.getDeploymentModel();
if (CflowCompiler.isCflowClass(aspectClassName)) {
// handle Cflow native aspectOf
cv.visitMethodInsn(
INVOKESTATIC,
aspectClassName,
CflowCompiler.CFLOW_ASPECTOF_METHOD_NAME,
"()"+aspectClassSignature
);
cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);
} else if (deploymentModel.equals(DeploymentModel.PER_JVM)) {
// AW-355, AW-415 we need a ClassLoader here
cv.visitFieldInsn(GETSTATIC, joinPointClassName, THIS_CLASS_FIELD_NAME, CLASS_CLASS_SIGNATURE);
cv.visitMethodInsn(
INVOKEVIRTUAL, CLASS_CLASS, GETCLASSLOADER_METHOD_NAME,
CLASS_CLASS_GETCLASSLOADER_METHOD_SIGNATURE
);
cv.visitLdcInsn(aspectInfo.getAspectQualifiedName());
cv.visitLdcInsn(aspectInfo.getAspectDefinition().getContainerClassName());
cv.visitMethodInsn(
INVOKESTATIC,
ASPECTS_CLASS_NAME,
ASPECT_OF_METHOD_NAME,
ASPECT_OF_PER_JVM_METHOD_SIGNATURE
);
cv.visitTypeInsn(CHECKCAST, aspectClassName);
cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);
} else if (deploymentModel.equals(DeploymentModel.PER_CLASS)) {
cv.visitLdcInsn(aspectInfo.getAspectQualifiedName());
cv.visitLdcInsn(aspectInfo.getAspectDefinition().getContainerClassName());
cv.visitFieldInsn(GETSTATIC, joinPointClassName, THIS_CLASS_FIELD_NAME, CLASS_CLASS_SIGNATURE);
cv.visitMethodInsn(
INVOKESTATIC,
ASPECTS_CLASS_NAME,
ASPECT_OF_METHOD_NAME,
ASPECT_OF_PER_CLASS_METHOD_SIGNATURE
);
cv.visitTypeInsn(CHECKCAST, aspectClassName);
cv.visitFieldInsn(PUTSTATIC, joinPointClassName, aspectInfo.getAspectFieldName(), aspectClassSignature);
} else if (deploymentModel.equals(DeploymentModel.PER_INSTANCE)) {
} else {
throw new UnsupportedOperationException(
"unsupported deployment model - " +
aspectInfo.getAspectClassName() + " " +
deploymentModel