Package org.objectweb.asm

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


    ExecutionDataAccess.generateArgumentArray(1000, "Sample", 15, mv);
    mv.visitInsn(Opcodes.ARETURN);
    mv.visitMaxs(5, 1);
    mv.visitEnd();

    writer.visitEnd();
    final TargetLoader loader = new TargetLoader("Sample",
        writer.toByteArray());
    Callable<?> callable = (Callable<?>) loader.newTargetInstance();
    final Object[] args = (Object[]) callable.call();
    assertEquals(3, args.length, 0.0);
View Full Code Here


    mv.visitEnd();

    writer.visitField(Opcodes.ACC_PRIVATE, "access", "Ljava/lang/Object;",
        null, null);

    writer.visitEnd();
    final TargetLoader loader = new TargetLoader("Sample",
        writer.toByteArray());
    Callable<?> callable = (Callable<?>) loader.getTargetClass()
        .getConstructor(Object.class).newInstance(access);
    assertSame(data, callable.call());
View Full Code Here

          mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V");
          mv.visitInsn(ATHROW);
          mv.visitMaxs(0, 0);
          mv.visitEnd();
        }
        cw.visitEnd();
        byte[] data = cw.toByteArray();
        accessClass = loader.defineClass(accessClassName, data);
      }
    }
    try {
View Full Code Here

        insertGetPrimitive(cw, classNameInternal, fields, Type.FLOAT_TYPE);
        insertSetPrimitive(cw, classNameInternal, fields, Type.FLOAT_TYPE);
        insertGetPrimitive(cw, classNameInternal, fields, Type.CHAR_TYPE);
        insertSetPrimitive(cw, classNameInternal, fields, Type.CHAR_TYPE);
        insertGetString(cw, classNameInternal, fields);
        cw.visitEnd();
        accessClass = loader.defineClass(accessClassName, cw.toByteArray());
      }
    }
    try {
      FieldAccess access = (FieldAccess)accessClass.newInstance();
View Full Code Here

        insertConstructor(cw, superclassNameInternal);
        insertNewInstance(cw, classNameInternal);
        insertNewInstanceInner(cw, classNameInternal, enclosingClassNameInternal);

        cw.visitEnd();
        accessClass = loader.defineClass(accessClassName, cw.toByteArray());
      }
    }
    ConstructorAccess<T> access;
    try {
View Full Code Here

        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V");
        mv.visitInsn(ATHROW);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
      }
      cw.visitEnd();
      byte[] data = cw.toByteArray();
      accessClass = loader.defineClass(accessClassName, data);
    }
    try {
      FieldAccess access = (FieldAccess)accessClass.newInstance();
View Full Code Here

        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V");
        mv.visitInsn(ATHROW);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
      }
      cw.visitEnd();
      byte[] data = cw.toByteArray();
      accessClass = loader.defineClass(accessClassName, data);
    }
    try {
      MethodAccess access = (MethodAccess)accessClass.newInstance();
View Full Code Here

        method.start();
        method.aload(1);
        method.athrow();
        method.end();
       
        cw.visitEnd();
       
        byte[] bytecode = cw.toByteArray();
       
        try {
            FileOutputStream fos = new FileOutputStream(classpath);
View Full Code Here

        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V");
        mv.visitInsn(ATHROW);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
      }
      cw.visitEnd();
      byte[] data = cw.toByteArray();
      accessClass = loader.defineClass(accessClassName, data);
    }
    try {
      MethodAccess access = (MethodAccess)accessClass.newInstance();
View Full Code Here

        mg.invokeVirtual(Type.getType(PrintStream.class),
                Method.getMethod("void println (String)"));
        mg.returnValue();
        mg.endMethod();

        cw.visitEnd();

        code = cw.toByteArray();
        loader = new Helloworld();
        exampleClass = loader.defineClass("Example", code, 0, code.length);
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.