KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > transform > inlining > weaver > LabelToLineNumberVisitor


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.transform.inlining.weaver;
5
6 import com.tc.asm.ClassAdapter;
7 import com.tc.asm.ClassVisitor;
8 import com.tc.asm.MethodVisitor;
9 import com.tc.asm.MethodAdapter;
10 import com.tc.asm.Label;
11
12 import com.tc.aspectwerkz.transform.InstrumentationContext;
13
14 /**
15  * @author <a HREF="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
16  */

17 public class LabelToLineNumberVisitor extends ClassAdapter {
18
19   private InstrumentationContext m_ctx;
20
21   public LabelToLineNumberVisitor(ClassVisitor cv, InstrumentationContext ctx) {
22     super(cv);
23     m_ctx = (InstrumentationContext) ctx;
24   }
25
26   public MethodVisitor visitMethod(int access, String JavaDoc name, String JavaDoc desc, String JavaDoc signature, String JavaDoc[] exceptions) {
27     return new MethodAdapter(super.visitMethod(access, name, desc, signature, exceptions)) {
28       public void visitLineNumber(int i, Label label) {
29         super.visitLineNumber(i, label);
30         m_ctx.addLineNumberInfo(label, i);
31       }
32     };
33   }
34 }
35
Popular Tags