Package org.objectweb.asm

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


            mv.visitInsn(ARETURN);
            mv.visitMaxs(0, 0);
            mv.visitEnd();

            // And then override: public Object createUsingDefault()
            mv = cw.visitMethod(ACC_PUBLIC, "createUsingDefault", "(" +
                Type.getDescriptor(DeserializationContext.class)+")Ljava/lang/Object;", null, null);
            mv.visitCode();
           
            if (ctor != null) {
                addCreator(mv, ctor);
View Full Code Here


                argsAndReturn.append(Type.getType(paramType));
            }
            argsAndReturn.append(")");
            argsAndReturn.append(Type.getType(returnType));

            cw.visitMethod(Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
                           method.getName(),
                           argsAndReturn.toString(),
                           null,
                           new String[] {"java/rmi/RemoteException"});
        }
View Full Code Here

        av0.visit("name", wrapperElement.getLocalPart());
        av0.visit("namespace", wrapperElement.getNamespaceURI());
        av0.visitEnd();

        // add constructor
        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitCode();
        Label lbegin = new Label();
        mv.visitLabel(lbegin);
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
View Full Code Here

        ClassWriter cw = new ClassWriter(0);
        cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, className, null, "java/lang/Object", new String[] { "org/apache/pig/builtin/InvokerFunction" });

        makeConstructor(cw);

        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "eval", "(Lorg/apache/pig/data/Tuple;)Ljava/lang/Object;", null, new String[] { "java/io/IOException" });
        mv.visitCode();

        int next = 2;
        //this will get the arguments from the Tuple, cast them, and astore them
        int begin = 0;
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", GeneratorConstants.PROBEDATA_TYPE);
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", GeneratorConstants.PROBEDATA_TYPE);
    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", GeneratorConstants.PROBEDATA_TYPE);
    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

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.