Examples of ClassAdapter


Examples of org.objectweb.asm.ClassAdapter

    assertEquals(mv, tmv);
  }

  @Override
  protected ClassVisitor getClassAdapter(final ClassVisitor cv) {
    return new ClassAdapter(cv) {
      private String owner;

      @Override
      public void visit(int version, int access, String name,
          String signature, String superName, String[] interfaces) {
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

    assertEquals(mv, tmv);
  }

  @Override
  protected ClassVisitor getClassAdapter(final ClassVisitor cv) {
    return new ClassAdapter(cv) {
      private String owner;

      @Override
      public void visit(int version, int access, String name,
          String signature, String superName, String[] interfaces) {
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

    for (int i = 0; i < 10; ++i) {
      long t = System.currentTimeMillis();
      for (int j = 0; j < classes.size(); ++j) {
        byte[] b = (byte[]) classes.get(j);
        ClassWriter cw = new ClassWriter(0);
        ClassVisitor cv = new ClassAdapter(cw) {
          public MethodVisitor visitMethod(int access, String name,
              String desc, String signature, String[] exceptions) {
            return new RemoveGetFieldPutFieldAdapter(cv.visitMethod(
                access, name, desc, signature, exceptions));
          }
        };
        new ClassReader(b).accept(cv, 0);
        cw.toByteArray();
      }
      t = System.currentTimeMillis() - t;
      times[5] = Math.min(t, times[5]);
      System.out.println("Time to deserialize and reserialize "
          + classes.size()
          + " classes with RemoveGetFieldPutFieldAdapter = " + t
          + " ms");
    }

    for (int i = 0; i < 10; ++i) {
      long t = System.currentTimeMillis();
      for (int j = 0; j < classes.size(); ++j) {
        byte[] b = (byte[]) classes.get(j);
        ClassReader cr = new ClassReader(b);
        ClassWriter cw = new ClassWriter(cr, 0);
        ClassVisitor cv = new ClassAdapter(cw) {
          public MethodVisitor visitMethod(int access, String name,
              String desc, String signature, String[] exceptions) {
            return new RemoveGetFieldPutFieldAdapter(cv.visitMethod(
                access, name, desc, signature, exceptions));
          }
        };
        cr.accept(cv, 0);
        cw.toByteArray();
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

    try {
      ClassReader  cr    = new ClassReader(classBytes);
      ClassWriter  cw    = new BundleClassWriter(ClassWriter.COMPUTE_MAXS,
                                                 classLoader);
      ClassAdapter trans = new ClassAdapterPatcher(cw,
                                                   className.replace('.', '/'),
                                                   classLoader,
                                                   classLoader.archive.getBundleId(),
                                                   this);
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

  byte[] nullAdaptClass (final InputStream is, final String name)
    throws Exception
  {
    ClassReader cr = new ClassReader(is);
    ClassWriter cw = new ClassWriter(compute);
    ClassAdapter ca = new ClassAdapter(cw);
    cr.accept(ca, skipDebug);
    return cw.toByteArray();
  }
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

  byte[] counterAdaptClass (final InputStream is, final String name)
    throws Exception
  {
    ClassReader cr = new ClassReader(is);
    ClassWriter cw = new ClassWriter(false);
    ClassAdapter ca = new CounterClassAdapter(cw);
    cr.accept(ca, false);
    return cw.toByteArray();
  }
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

  protected byte[] transform(final ClassReader reader,
      final ClassProcessingParticipant[] subjectOfInterest) {
    ClassWriter cv = new ClassWriter(ClassWriter.COMPUTE_FRAMES
        | ClassWriter.COMPUTE_MAXS);
    reader.accept(new ClassAdapter(cv) {

     
      public void visit(int version, int access, String name,
          String signature, String superName, String[] interfaces) {
        super.visit(version, access, name, signature, superName, interfaces);
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

                throw new ReaderException("could not retrieve the bytecode from the bytecode provider [" + AnnotationReader.BYTECODE_PROVIDER.getClass().getName() + "]", e);
            }
            ClassReader cr = new ClassReader(bytes);
            ClassWriter cw = new ClassWriter(false, true);
            cr.accept(
                    new ClassAdapter(cw) {
                        public MethodVisitor visitMethod(int access, final String name, String desc, String signature, String[] exceptions) {
                            return new MethodAdapter(super.visitMethod(access, name, desc, signature, exceptions)) {
                                public AnnotationVisitor visitAnnotationDefault() {
                                    return new DefaultAnnotationBuilderVisitor(newDefaults, name);
                                }
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

    public Object[] getClassAttributes() {
        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List classAttributes = new ArrayList();
        m_reader.accept(new ClassAdapter(m_writer) {
            public void visitAttribute(final Attribute attribute) {
                //TODO - waiting ASM feedback on that instead of several call to visitAtribute from ASM
                //Attribute current = attribute;
                //while (current != null) {
                if (attribute instanceof CustomAttribute) {
View Full Code Here

Examples of org.objectweb.asm.ClassAdapter

    public Object[] getMethodAttributes(final String methodName, final String[] methodParamTypes) {
        if (m_reader == null) {
            throw new IllegalStateException("attribute extractor is not initialized");
        }
        final List methodAttributes = new ArrayList();
        m_reader.accept(new ClassAdapter(m_writer) {
            public CodeVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
                final String[] exceptions,
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.