01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.bytecode;
06:
07: import com.tc.asm.ClassAdapter;
08: import com.tc.asm.ClassVisitor;
09: import com.tc.asm.MethodAdapter;
10: import com.tc.asm.MethodVisitor;
11: import com.tc.asm.Opcodes;
12:
13: public class LogManagerAdapter extends ClassAdapter {
14:
15: public LogManagerAdapter(ClassVisitor cv) {
16: super (cv);
17: }
18:
19: public MethodVisitor visitMethod(int access, String name,
20: String desc, String signature, String[] exceptions) {
21: MethodVisitor mv = super .visitMethod(access, name, desc,
22: signature, exceptions);
23:
24: if ("<clinit>".equals(name)) {
25: mv = new StaticInitAdapter(mv);
26: }
27:
28: return mv;
29: }
30:
31: private static class StaticInitAdapter extends MethodAdapter
32: implements Opcodes {
33:
34: public StaticInitAdapter(MethodVisitor mv) {
35: super (mv);
36: }
37:
38: public void visitInsn(int opcode) {
39: if (RETURN == opcode) {
40: super
41: .visitMethodInsn(
42: INVOKESTATIC,
43: "com/tc/object/bytecode/hook/impl/ClassProcessorHelper",
44: "loggingInitialized", "()V");
45: }
46:
47: super.visitInsn(opcode);
48: }
49: }
50:
51: }
|