Package org.objectweb.asm

Examples of org.objectweb.asm.ClassReader.accept()


    if (log.isLogging(LoggerLevelStandard.DEBUG)) {
      ClassReader cr = new ClassReader(bytecode);
      ASMifierClassVisitor asm = new ASMifierClassVisitor(
        new PrintWriter(log.getLoggingWriter(LoggerLevelStandard.DEBUG), true) // log.getLoggingWriter(LoggerLevelStandard.INFO), true)
      );
      cr.accept(asm, 0);
    }
   
    return loader.define(type.getName(), bytecode);
  }
View Full Code Here


  }
 
  private ParameterNameDiscoveringVisitor visitMethod(Method method) throws IOException {
    ClassReader classReader = getClassReader(method.getDeclaringClass());
    FindMethodParameterNamesClassVisitor classVisitor = new FindMethodParameterNamesClassVisitor(method);
    classReader.accept(classVisitor, false);
    return classVisitor;
  }
 
  private ParameterNameDiscoveringVisitor visitConstructor(Constructor ctor) throws IOException {
    ClassReader classReader = getClassReader(ctor.getDeclaringClass());
View Full Code Here

  }
 
  private ParameterNameDiscoveringVisitor visitConstructor(Constructor ctor) throws IOException {
    ClassReader classReader = getClassReader(ctor.getDeclaringClass());
    FindConstructorParameterNamesClassVisitor classVisitor = new FindConstructorParameterNamesClassVisitor(ctor);
    classReader.accept(classVisitor, false);
    return classVisitor;
  }
 
  private ClassReader getClassReader(Class clazz) throws IOException {
    synchronized (classReaderCache) {
View Full Code Here

        InputStream classStream = null;
        try {
            classStream = new BufferedInputStream(new FileInputStream(testClassFile));
            final ClassReader classReader = new ClassReader(classStream);
            classReader.accept(classVisitor, ClassReader.SKIP_DEBUG | ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES);
        } catch (Throwable e) {
            throw new GradleException("failed to read class file " + testClassFile.getAbsolutePath(), e);
        } finally {
            IOUtils.closeQuietly(classStream);
        }
View Full Code Here

        } else {
            cv = new CommentedClassVisitor(modes);
        }
        DecompilerClassVisitor dcv = new DecompilerClassVisitor(
            cv, field, method, modes);
        cr.accept(dcv, crFlags);
        return dcv.getResult(cl);
    }

    public DecompiledClass getResult(final ClassLoader cl) {
        List text = new ArrayList();
View Full Code Here

          ClassReader cr = new ClassReader(is);
          if (cr.readInt(4) != Opcodes.V1_6) {
            try {
              ClassWriter cw = new ClassWriter(
                  ClassWriter.COMPUTE_FRAMES);
              cr.accept(cw, 0);
              cr = new ClassReader(cw.toByteArray());
            } catch (Throwable ignored) {
              continue;
            }
          }
View Full Code Here

            }
          }
          ClassWriter cw = new ClassWriter(0);
          ClassVisitor cv = getClassAdapter(cw);
          try {
            cr.accept(cv, ClassReader.EXPAND_FRAMES);
          } catch (UnsatisfiedLinkError ignored) {
          } catch (NoClassDefFoundError ignored) {
          }
          byte[] b = cw.toByteArray();
          try {
View Full Code Here

      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);
        cr.accept(cw, 0);
        cw.toByteArray();
      }
      t = System.currentTimeMillis() - t;
      times[2] = Math.min(t, times[2]);
      System.out.println("Time to deserialize and reserialize "
View Full Code Here

      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 AddTimerAdapter(cw);
        cr.accept(cv, 0);
        cw.toByteArray();
      }
      t = System.currentTimeMillis() - t;
      times[4] = Math.min(t, times[4]);
      System.out
View Full Code Here

              String desc, String signature, String[] exceptions) {
            return new RemoveGetFieldPutFieldAdapter(cv.visitMethod(
                access, name, desc, signature, exceptions));
          }
        };
        cr.accept(cv, 0);
        cw.toByteArray();
      }
      t = System.currentTimeMillis() - t;
      times[6] = Math.min(t, times[6]);
      System.out
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.