Package org.objectweb.asm.commons

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


      Type bean = Type.getType("Lpkg/Bean;");
      Method m = Method.getMethod("void setF(int)");
      GeneratorAdapter ga = new GeneratorAdapter(ACC_PUBLIC, m, mv);
      ga.visitCode();
      ga.loadThis();
      ga.loadArg(0);
      ga.putField(bean, "f", Type.INT_TYPE);
      ga.returnValue();
      ga.endMethod();
    }
    mv = cv.visitMethod(ACC_PUBLIC, "checkAndSetF", "(I)V", null, null);
View Full Code Here


    if (mv != null) {
      Type bean = Type.getType("Lpkg/Bean;");
      Method m = Method.getMethod("void checkAndSetF(int)");
      GeneratorAdapter ga = new GeneratorAdapter(ACC_PUBLIC, m, mv);
      ga.visitCode();
      ga.loadArg(0);
      Label label = new Label();
      ga.ifZCmp(GeneratorAdapter.LT, label);
      ga.loadThis();
      ga.loadArg(0);
      ga.putField(bean, "f", Type.INT_TYPE);
View Full Code Here

      ga.visitCode();
      ga.loadArg(0);
      Label label = new Label();
      ga.ifZCmp(GeneratorAdapter.LT, label);
      ga.loadThis();
      ga.loadArg(0);
      ga.putField(bean, "f", Type.INT_TYPE);
      Label end = new Label();
      ga.goTo(end);
      ga.mark(label);
      ga.throwException(Type.getType(IllegalArgumentException.class),
View Full Code Here

        .getDescriptor(), null, null);
    if (mv != null) {
      GeneratorAdapter init = new GeneratorAdapter(ACC_PUBLIC, INIT, mv);
      init.visitCode();
      init.loadThis();
      init.loadArg(0);
      init.invokeConstructor(PROXY, INIT);
      init.returnValue();
      init.endMethod();
    }
View Full Code Here

        ga.loadArgs(0, superConstructorParameterTypes.length);
        ga.invokeConstructor(Type.getType(constructor.getDeclaringClass()),
                super_m);

        ga.loadThis();
        ga.loadArg(superConstructorParameterTypes.length);
        ga.putField(selfType, INVOCATION_HANDLER_FIELD_NAME,
                INVOCATION_HANDLER_TYPE);

        // do a void return
        ga.returnValue();
View Full Code Here

        else
          throw new RuntimeException(new UnableToProxyException(typeBeingWoven.getClassName(),
              NLS.MESSAGES.getMessage("type.lacking.no.arg.constructor", typeBeingWoven.getClassName(), superType.getClassName())));
      }
      methodAdapter.loadThis();
      methodAdapter.loadArg(0);
      methodAdapter.putField(typeBeingWoven, DISPATCHER_FIELD, DISPATCHER_TYPE);
     
      methodAdapter.loadThis();
      methodAdapter.loadArg(1);
      methodAdapter.putField(typeBeingWoven, LISTENER_FIELD, LISTENER_TYPE);
View Full Code Here

      methodAdapter.loadThis();
      methodAdapter.loadArg(0);
      methodAdapter.putField(typeBeingWoven, DISPATCHER_FIELD, DISPATCHER_TYPE);
     
      methodAdapter.loadThis();
      methodAdapter.loadArg(1);
      methodAdapter.putField(typeBeingWoven, LISTENER_FIELD, LISTENER_TYPE);
    } else {
      //We just invoke the super with args
      methodAdapter.loadThis();
      methodAdapter.loadArgs();
View Full Code Here

      methodAdapter.loadArgs();
      methodAdapter.invokeConstructor(superType, ARGS_CONSTRUCTOR);
    }
   
    //Throw an NPE if the dispatcher is null, return otherwise
    methodAdapter.loadArg(0);
    Label returnValue = methodAdapter.newLabel();
    methodAdapter.ifNonNull(returnValue);
    methodAdapter.newInstance(NPE_TYPE);
    methodAdapter.dup();
    methodAdapter.push("The dispatcher must never be null!");
View Full Code Here

      {
        org.objectweb.asm.commons.Method constructor = org.objectweb.asm.commons.Method.getMethod(
                "void <init> (com.github.mustachejava.reflect.ReflectionWrapper)");
        GeneratorAdapter ga = new GeneratorAdapter(ACC_PUBLIC, constructor, null, null, cw);
        ga.loadThis();
        ga.loadArg(0);
        ga.invokeConstructor(Type.getType(IndyWrapper.class), constructor);
        ga.returnValue();
        ga.endMethod();
      }
      {
View Full Code Here

        else
          throw new RuntimeException(new UnableToProxyException(typeBeingWoven.getClassName(),
              NLS.MESSAGES.getMessage("type.lacking.no.arg.constructor", typeBeingWoven.getClassName(), superType.getClassName())));
      }
      methodAdapter.loadThis();
      methodAdapter.loadArg(0);
      methodAdapter.putField(typeBeingWoven, DISPATCHER_FIELD, DISPATCHER_TYPE);
     
      methodAdapter.loadThis();
      methodAdapter.loadArg(1);
      methodAdapter.putField(typeBeingWoven, LISTENER_FIELD, LISTENER_TYPE);
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.