Package org.objectweb.asm.commons

Examples of org.objectweb.asm.commons.GeneratorAdapter.invokeVirtual()


        gm.loadArg(1);
        // code.execute(
        if (fieldClass.isInterface()) {
          gm.invokeInterface(fieldType, EXECUTE_METHOD);
        } else {
          gm.invokeVirtual(fieldType, EXECUTE_METHOD);
        }
        // writer =
        gm.storeLocal(writerLocal);

        fieldNum++;
View Full Code Here


        mgen.visitCode();
        mgen.loadArgs();
        if (implIsStatic) {
            mgen.invokeStatic(owner.target, impl);
        } else {
            mgen.invokeVirtual(owner.target, impl);
        }
        mgen.returnValue();
        mgen.endMethod();
    }
View Full Code Here

    // load this
    methodAdapter.loadThis();
    // load the supplied invocation handler arg
    methodAdapter.loadArgs();
    // invoke the setter method
    methodAdapter.invokeVirtual(newClassType, setter);
    methodAdapter.returnValue();
    methodAdapter.endMethod();

    // add a method for getting the invocation handler
    m = new Method("getInvocationHandler", IH_TYPE, NO_ARGS);
View Full Code Here

    // load this
    methodAdapter.loadThis();
    // load the supplied invocation handler arg
    methodAdapter.loadArgs();
    // invoke the setter method
    methodAdapter.invokeVirtual(newClassType, setter);
    methodAdapter.returnValue();
    methodAdapter.endMethod();

    // add a method for getting the invocation handler
    m = new Method("getInvocationHandler", IH_TYPE, NO_ARGS);
View Full Code Here

        mg = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC, m, null, null, cw);
        mg.getStatic(Type.getType(System.class),
                "out",
                Type.getType(PrintStream.class));
        mg.push("Hello world!");
        mg.invokeVirtual(Type.getType(PrintStream.class),
                Method.getMethod("void println (String)"));
        mg.returnValue();
        mg.endMethod();

        cw.visitEnd();
View Full Code Here

    mg.visitTryCatchBlock(beginTry, endTry, catchHandle, Type.getInternalName(IllegalAccessException.class));
    mg.mark(beginTry);
    mg.loadThis();
    mg.getField(Type.getObjectType(className), "field", Type.getType(Field.class));
    mg.loadArgs();
    mg.invokeVirtual(Type.getType(Field.class), method);
    mg.mark(endTry);
    mg.returnValue();
    mg.mark(catchHandle);
    int exception = mg.newLocal(Type.getType(IllegalAccessException.class));
    mg.storeLocal(exception);
View Full Code Here

                                               null, new Type[0], classWriter);
    if (isPrivate) {
      // get the value using the generic Object get(Object) method and unbox the value
      mg.loadThis();
      mg.loadArg(0);
      mg.invokeVirtual(Type.getObjectType(className), getMethod(Object.class, "get", Object.class));
      mg.unbox(Type.getType(field.getType()));
    } else {
      // Simply access the field.
      mg.loadArg(0);
      mg.checkCast(Type.getType(field.getDeclaringClass()));
View Full Code Here

    if (isPrivate) {
      // set the value using the generic void get(Object, Object) method with boxing the value.
      mg.loadThis();
      mg.loadArgs();
      mg.valueOf(Type.getType(field.getType()));
      mg.invokeVirtual(Type.getObjectType(className), getMethod(void.class, "set", Object.class, Object.class));
    } else {
      // Simply access the field.
      mg.loadArg(0);
      mg.checkCast(Type.getType(field.getDeclaringClass()));
      mg.loadArg(1);
View Full Code Here

    mg.invokeConstructor(Type.getType(Object.class), getMethod(void.class, "<init>"));

    // if (!SCHEMA_HASH.equals(schema.getSchemaHash().toString())) { throw IllegalArgumentException }
    mg.getStatic(classType, "SCHEMA_HASH", Type.getType(String.class));
    mg.loadArg(0);
    mg.invokeVirtual(Type.getType(Schema.class), getMethod(SchemaHash.class, "getSchemaHash"));
    mg.invokeVirtual(Type.getType(SchemaHash.class), getMethod(String.class, "toString"));
    mg.invokeVirtual(Type.getType(String.class), getMethod(boolean.class, "equals", Object.class));
    Label hashEquals = mg.newLabel();
    mg.ifZCmp(GeneratorAdapter.NE, hashEquals);
    mg.throwException(Type.getType(IllegalArgumentException.class), "Schema not match.");
View Full Code Here

    // if (!SCHEMA_HASH.equals(schema.getSchemaHash().toString())) { throw IllegalArgumentException }
    mg.getStatic(classType, "SCHEMA_HASH", Type.getType(String.class));
    mg.loadArg(0);
    mg.invokeVirtual(Type.getType(Schema.class), getMethod(SchemaHash.class, "getSchemaHash"));
    mg.invokeVirtual(Type.getType(SchemaHash.class), getMethod(String.class, "toString"));
    mg.invokeVirtual(Type.getType(String.class), getMethod(boolean.class, "equals", Object.class));
    Label hashEquals = mg.newLabel();
    mg.ifZCmp(GeneratorAdapter.NE, hashEquals);
    mg.throwException(Type.getType(IllegalArgumentException.class), "Schema not match.");
    mg.mark(hashEquals);
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.