01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.transform.inlining.compiler;
05:
06: import com.tc.asm.MethodVisitor;
07: import com.tc.asm.Type;
08:
09: import com.tc.aspectwerkz.transform.inlining.AsmHelper;
10:
11: /**
12: * Redefines the existing join point class and turns it into a delegation class delegating to the newly created
13: * replacement join point class.
14: *
15: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
16: */
17: public class ConstructorExecutionJoinPointRedefiner extends
18: ConstructorExecutionJoinPointCompiler {
19: /**
20: * The redefined model.
21: */
22: private final CompilationInfo.Model m_redefinedModel;
23:
24: /**
25: * Creates a new join point compiler instance.
26: *
27: * @param model
28: */
29: ConstructorExecutionJoinPointRedefiner(final CompilationInfo model) {
30: super (model.getInitialModel());
31: m_redefinedModel = model.getRedefinedModel();
32: }
33:
34: /**
35: * Creates the 'invoke' method.
36: */
37: protected void createInvokeMethod() {
38: String invokeDesc = buildInvokeMethodSignature();
39: MethodVisitor cv = m_cw.visitMethod(ACC_PUBLIC + ACC_FINAL
40: + ACC_STATIC, INVOKE_METHOD_NAME, invokeDesc, null,
41: new String[] { THROWABLE_CLASS_NAME });
42: AsmHelper.loadArgumentTypes(cv, Type
43: .getArgumentTypes(invokeDesc), true);
44: cv.visitMethodInsn(INVOKESTATIC, m_redefinedModel
45: .getJoinPointClassName(), INVOKE_METHOD_NAME,
46: invokeDesc);
47: AsmHelper
48: .addReturnStatement(cv, Type.getReturnType(invokeDesc));
49: cv.visitMaxs(0, 0);
50: }
51:
52: /**
53: * Creates the 'invoke' method.
54: */
55: protected void createInlinedInvokeMethod() {
56: createInvokeMethod();
57: }
58:
59: }
|