1 4 package com.tc.object.bytecode; 5 6 import com.tc.asm.ClassVisitor; 7 import com.tc.asm.MethodAdapter; 8 import com.tc.asm.MethodVisitor; 9 import com.tc.asm.Opcodes; 10 11 public class VectorAdapter { 12 13 public static class ElementsAdapter extends AbstractMethodAdapter { 14 public MethodVisitor adapt(ClassVisitor classVisitor) { 15 MethodVisitor mv = visitOriginal(classVisitor); 16 return new Adapter(mv); 17 } 18 19 public boolean doesOriginalNeedAdapting() { 20 return false; 21 } 22 23 private static class Adapter extends MethodAdapter implements Opcodes { 24 25 public Adapter(MethodVisitor mv) { 26 super(mv); 27 mv.visitTypeInsn(NEW, "com/tc/util/EnumerationWrapper"); 28 mv.visitInsn(DUP); 29 mv.visitVarInsn(ALOAD, 0); 30 } 31 32 public void visitInsn(int opcode) { 33 if (ARETURN == opcode) { 34 mv.visitMethodInsn(INVOKESPECIAL, "com/tc/util/EnumerationWrapper", "<init>", "(Ljava/util/Vector;Ljava/util/Enumeration;)V"); 35 } 36 super.visitInsn(opcode); 37 } 38 } 39 } 40 } 41 | Popular Tags |