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.object.bytecode;
05:
06: import com.tc.asm.ClassVisitor;
07: import com.tc.asm.MethodAdapter;
08: import com.tc.asm.MethodVisitor;
09: 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
24: Opcodes {
25:
26: public Adapter(MethodVisitor mv) {
27: super (mv);
28: mv.visitTypeInsn(NEW, "com/tc/util/EnumerationWrapper");
29: mv.visitInsn(DUP);
30: mv.visitVarInsn(ALOAD, 0);
31: }
32:
33: public void visitInsn(int opcode) {
34: if (ARETURN == opcode) {
35: mv
36: .visitMethodInsn(INVOKESPECIAL,
37: "com/tc/util/EnumerationWrapper",
38: "<init>",
39: "(Ljava/util/Vector;Ljava/util/Enumeration;)V");
40: }
41: super.visitInsn(opcode);
42: }
43: }
44: }
45: }
|