Package org.objectweb.asm

Examples of org.objectweb.asm.ClassWriter.visitMethod()


    writer.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, "Sample", null,
        "java/lang/Object",
        new String[] { Type.getInternalName(Callable.class) });

    // Constructor
    MethodVisitor mv = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
        "(Ljava/lang/Object;)V", null, new String[0]);
    mv.visitCode();
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>",
        "()V");
View Full Code Here


    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    // call()
    mv = writer.visitMethod(Opcodes.ACC_PUBLIC, "call",
        "()Ljava/lang/Object;", null, new String[0]);
    mv.visitCode();
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, "Sample", "access",
        "Ljava/lang/Object;");
View Full Code Here

    writer.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_FINAL, "data",
        "[Z", null, null);

    // Constructor
    GeneratorAdapter gen = new GeneratorAdapter(writer.visitMethod(
        Opcodes.ACC_PUBLIC, "<init>", "()V", null, new String[0]),
        Opcodes.ACC_PUBLIC, "<init>", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.invokeConstructor(Type.getType(Object.class), new Method("<init>",
View Full Code Here

    gen.returnValue();
    gen.visitMaxs(size + 1, 0);
    gen.visitEnd();

    // get()
    gen = new GeneratorAdapter(writer.visitMethod(Opcodes.ACC_PUBLIC,
        "get", "()[Z", null, new String[0]), Opcodes.ACC_PUBLIC, "get",
        "()[Z");
    gen.visitCode();
    gen.loadThis();
    gen.getField(classType, "data", Type.getObjectType("[Z"));
View Full Code Here

    gen.returnValue();
    gen.visitMaxs(1, 0);
    gen.visitEnd();

    // a()
    gen = new GeneratorAdapter(writer.visitMethod(Opcodes.ACC_PUBLIC, "a",
        "()V", null, new String[0]), Opcodes.ACC_PUBLIC, "a", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.getField(classType, "data", Type.getObjectType("[Z"));
    gen.push(0);
View Full Code Here

    gen.returnValue();
    gen.visitMaxs(3, 0);
    gen.visitEnd();

    // b()
    gen = new GeneratorAdapter(writer.visitMethod(Opcodes.ACC_PUBLIC, "b",
        "()V", null, new String[0]), Opcodes.ACC_PUBLIC, "b", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.getField(classType, "data", Type.getObjectType("[Z"));
    gen.push(1);
View Full Code Here

    writer.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, "Sample", null,
        "java/lang/Object", new String[] { Type
            .getInternalName(Callable.class) });

    // Constructor
    MethodVisitor mv = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
        "()V", null, new String[0]);
    mv.visitCode();
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>",
        "()V");
View Full Code Here

    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();

    // call()
    mv = writer.visitMethod(Opcodes.ACC_PUBLIC, "call",
        "()Ljava/lang/Object;", null, new String[0]);
    mv.visitCode();
    ExecutionDataAccess.generateArgumentArray(1000, "Sample", 15, mv);
    mv.visitInsn(Opcodes.ARETURN);
    mv.visitMaxs(5, 1);
View Full Code Here

    writer.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, "Sample", null,
        "java/lang/Object", new String[] { Type
            .getInternalName(Callable.class) });

    // Constructor
    MethodVisitor mv = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>",
        "(Ljava/lang/Object;)V", null, new String[0]);
    mv.visitCode();
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>",
        "()V");
View Full Code Here

    mv.visitInsn(Opcodes.RETURN);
    mv.visitMaxs(2, 2);
    mv.visitEnd();

    // call()
    mv = writer.visitMethod(Opcodes.ACC_PUBLIC, "call",
        "()Ljava/lang/Object;", null, new String[0]);
    mv.visitCode();
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, "Sample", "access",
        "Ljava/lang/Object;");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.