KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > bytecode > AbstractListMethodCreator


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

5 package com.tc.object.bytecode;
6
7 import com.tc.asm.ClassVisitor;
8 import com.tc.asm.MethodVisitor;
9 import com.tc.asm.Opcodes;
10
11 public class AbstractListMethodCreator implements MethodCreator, Opcodes {
12
13   public void createMethods(ClassVisitor cv) {
14     MethodVisitor mv = cv.visitMethod(ACC_PROTECTED, ByteCodeUtil.fieldGetterMethod("modCount"), "()I", null, null);
15     mv.visitCode();
16     mv.visitVarInsn(ALOAD, 0);
17     mv.visitFieldInsn(GETFIELD, "java/util/AbstractList", "modCount", "I");
18     mv.visitInsn(IRETURN);
19     mv.visitMaxs(0, 0);
20     mv.visitEnd();
21
22     mv = cv.visitMethod(ACC_PROTECTED, ByteCodeUtil.fieldSetterMethod("modCount"), "(I)V", null, null);
23     mv.visitCode();
24     mv.visitVarInsn(ALOAD, 0);
25     mv.visitVarInsn(ILOAD, 1);
26     mv.visitFieldInsn(PUTFIELD, "java/util/AbstractList", "modCount", "I");
27     mv.visitInsn(RETURN);
28     mv.visitMaxs(0, 0);
29     mv.visitEnd();
30
31   }
32
33 }
34
Popular Tags