Package org.objectweb.asm

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


        while (it.hasNext()) {
          MethodNode mn = (MethodNode) it.next();
          new RemoveGetFieldPutFieldTransformer(null).transform(mn);
        }
        cn.accept(cw);
        cw.toByteArray();
      }
      t = System.currentTimeMillis() - t;
      times[12] = Math.min(t, times[12]);
      System.out.println("Time to deserialize and reserialize "
          + classes.size()
View Full Code Here


    cv.visitField(ACC_PUBLIC + ACC_FINAL + ACC_STATIC, "GREATER", "I",
        null, new Integer(1)).visitEnd();
    cv.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, "compareTo",
        "(Ljava/lang/Object;)I", null, null).visitEnd();
    cv.visitEnd();
    byte[] b = cw.toByteArray();
    return b;
  }
}
View Full Code Here

      ga.mark(end);
      ga.returnValue();
      ga.endMethod();
    }
    cv.visitEnd();
    byte[] b = cw.toByteArray();
    return b;
  }
}
View Full Code Here

        "GREATER", "I", null, new Integer(1)));
    cn.methods.add(new MethodNode(ACC_PUBLIC + ACC_ABSTRACT,
        "compareTo", "(Ljava/lang/Object;)I", null, null));
    ClassWriter cw = new ClassWriter(0);
    cn.accept(cw);
    return cw.toByteArray();
  }
}
View Full Code Here

    ClassTransformer ct = null;
    ct = new RemoveAnnotationTransformer(ct, "Ljava/lang/Deprecated;");
    ct = new AddAnnotationTransformer(ct, "Ljava/lang/Deprecated;");
    ct.transform(cn);
    cn.accept(ca);
    checkClass(defineClass("C", cw.toByteArray()));
  }

  @Override
  protected ClassVisitor getClassAdapter(final ClassVisitor cv) {
    return new ClassNode() {
View Full Code Here

    il.add(new InsnNode(RETURN));
    mn.maxStack = 2;
    mn.maxLocals = 2;
    ClassWriter cw = new ClassWriter(0);
    cn.accept(cw);
    return cw.toByteArray();
  }
}
View Full Code Here

    CheckClassAdapter ca = new CheckClassAdapter(cw);
    ClassNode cn = generateBasicClass();
    new AddAnnotationTransformer(null, "Ljava/lang/Deprecated;")
        .transform(cn);
    cn.accept(ca);
    checkClass(defineClass("C", cw.toByteArray()));
  }

  @Override
  protected ClassVisitor getClassAdapter(final ClassVisitor cv) {
    return new ClassNode() {
View Full Code Here

      mv.visitInsn(RETURN);
      mv.visitMaxs(2, 2);
      mv.visitEnd();
    }
    cv.visitEnd();
    return cw.toByteArray();
  }
}
View Full Code Here

                                                   classLoader.archive.getBundleId(),
                                                   this);

      cr.accept(trans, 0);

      byte[] newBytes = cw.toByteArray();

      if(bDumpClasses) {
        dumpClassBytes(className, newBytes);
      }
      classBytes = newBytes;
View Full Code Here

        clazzInit.endMethod();

        // end class
        cw.visitEnd();

        byte[] data = cw.toByteArray();

        /*
         * try { FileOutputStream o = new
         * FileOutputStream(targetClassName.replace( '/', '.') + ".class");
         * o.write(data); o.close(); } catch (IOException ex) {
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.