Package org.objectweb.asm

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


                reader = new ClassReader(struct.data);
            } catch (Exception e) {
                return true; // TODO?
            }
            GetNameClassWriter w = new GetNameClassWriter(ClassWriter.COMPUTE_MAXS);
            reader.accept(transform(w), ClassReader.EXPAND_FRAMES);
            struct.data = w.toByteArray();
            struct.name = pathFromName(w.getClassName());
        }
        return true;
    }
View Full Code Here


  private ClassInfo parseClass(InputStream classBytes) {
    try {
      ClassReader classReader = new ClassReader(classBytes);
      ClassInfoBuilderVisitor visitor = new ClassInfoBuilderVisitor(this);
      classReader.accept(visitor, 0);
      return visitor.getClassInfo();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

                                  ClassWriter.COMPUTE_FRAMES |
                                  ClassWriter.COMPUTE_MAXS);

    SpecificationClassAdapter adapter =
        new SpecificationClassAdapter(writer, contracts);
    reader.accept(adapter, ClassReader.EXPAND_FRAMES);

    return writer.toByteArray();
  }

  /**
 
View Full Code Here

  @Requires("bytecode != null")
  @Ensures("result != null")
  private byte[] instrumentWithDebug(byte[] bytecode) {
    ClassReader reader = new ClassReader(bytecode);
    ClassWriter writer = new NonLoadingClassWriter(reader, 0);
    reader.accept(new HelperClassAdapter(writer), ClassReader.EXPAND_FRAMES);
    return writer.toByteArray();
  }
}
View Full Code Here

      try {
        InputStream stream = JavaUtils.getClassInputStream(loader, className);
        if (stream == null)
          throw new NullPointerException();
        ClassReader reader = new ClassReader(stream);
        reader.accept(this, 0);
      } catch (Exception e) {
        addDefaultAssignable(className);
      }
    }
View Full Code Here

    String resource = "/" + name.replace('.', '/') + ".class";
if (DEBUG) System.out.println("Reading class file: " + resource);
    InputStream classStream = class_.getResourceAsStream(resource);
    try {
      ClassReader r = new ClassReader(classStream);
      r.accept(this, ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG
          + ClassReader.SKIP_FRAMES);

    } catch (IOException e) {
      // Shouldn't generally happen
      throw new TypeNotPresentException(
View Full Code Here

  private void readClassStream(final String name, final ClassVisitor cv) {
    String resource = "/" + name.replace('.', '/') + ".class";
    InputStream classStream = class_.getResourceAsStream(resource);
    try {
      ClassReader r = new ClassReader(classStream);
      r.accept(cv, ClassReader.SKIP_CODE + ClassReader.SKIP_DEBUG
          + ClassReader.SKIP_FRAMES);

      Class parent = class_.getSuperclass();
      if (parent != null) {
        AIB parentAib = getAib(parent);
View Full Code Here

            } else {
              translator = new NameTranslatorClassVisitor(cw);
            }
            ClassWeaver classWeaver = new ClassWeaver(translator, lazy, target, listener);
            SignatureStripper sigStripper = new SignatureStripper(classWeaver);
            cr.accept(sigStripper, false);       

            if (COMPACT_CONSTANTS) {
              Set<Constant> constants = new TreeSet<Constant>(new ConstantComparator());
              constants.addAll(cp.values());
View Full Code Here

              cr = new ClassReader(cw.toByteArray());
                cw = new ClassWriter(false);
                for(Constant c: constants)
                  c.write(cw);
                cr.accept(cw, false);
            }

          bos.write(cw.toByteArray());
          return true;
        } catch (LazyException e) {
View Full Code Here

      throws IOException {

    failedClasses = new HashSet<String>();

        ClassReader cr = new ClassReader(sourceStream);
        cr.accept(this, false);
  }

  private void unknowClassWarning(String className, String msg) {
    String report = currentclassName + ": unknown class "
        + className;
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.