Package org.objectweb.asm

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


      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


    while (true) {
      ClassReader reader = getClassReader(javaClassName);
      FindFieldOrMethodClassVisitor visitor = new FindFieldOrMethodClassVisitor(false, name, c);
   
      try {
        reader.accept(visitor, false);
      } catch (Success s) {
        return true;
      }
      String[] is = visitor.classInterfaces;
      for (String i : is)
View Full Code Here

    String javaClassName = owner;
    while (true) {
      ClassReader reader = getClassReader(javaClassName);
      FindFieldOrMethodClassVisitor visitor = new FindFieldOrMethodClassVisitor(true, name, desc);
      try {
        reader.accept(visitor, false);
      } catch (Success s) {
        return true;
      }

      if (visitor.isInterface || visitor.isAbstract) {
View Full Code Here

                interfaces);
          }
        };
        //call accept on the reader to start the visits
        //using the writer we created as the visitor
        reader.accept(writer, 0);
      } finally {
        //close the InputStream if it is hanging around
        if (classInStream != null) classInStream.close();
      }
      FileOutputStream classOutStream = null;
View Full Code Here

    className = className.substring(className.lastIndexOf('.') + 1) + ".class";
       
    //Load the class bytes and copy methods across
    ClassReader cReader = new ClassReader(c.getResourceAsStream(className));

    cReader.accept(adapter, ClassReader.SKIP_CODE |
        ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
  }

  /**
   * Generate an instance field that should be "invisible" to normal code
View Full Code Here

    //Wrap our outer layer to add the original SerialVersionUID if it was previously being defaulted
    ClassVisitor weavingAdapter = new SyntheticSerialVerUIDAdder(
                               new WovenProxyAdapter(cWriter, className, loader));
   
    // If we are Java 1.6 + then we need to skip frames as they will be recomputed
    cReader.accept(weavingAdapter, AbstractWovenProxyAdapter.IS_AT_LEAST_JAVA_6 ? ClassReader.SKIP_FRAMES : 0);
   
    return cWriter.toByteArray();
  }
}
View Full Code Here

    * annotation class.
    */
   private static boolean isAnnotationClass(byte[] bytes) {
       IsAnnotationVisitor isAnnotationVisitor = new IsAnnotationVisitor();
       ClassReader classReader = new ClassReader(bytes);
       classReader.accept(isAnnotationVisitor, ClassReader.SKIP_DEBUG);
       return isAnnotationVisitor.isAnnotation;
   }

   public static class IsAnnotationVisitor extends EmptyVisitor {
       public boolean isAnnotation = false;
View Full Code Here

    * annotation class.
    */
   private static boolean isAnnotationClass(byte[] bytes) {
       IsAnnotationVisitor isAnnotationVisitor = new IsAnnotationVisitor();
       ClassReader classReader = new ClassReader(bytes);
       classReader.accept(isAnnotationVisitor, true);
       return isAnnotationVisitor.isAnnotation;
   }

   public static class IsAnnotationVisitor extends EmptyVisitor {
       public boolean isAnnotation = false;
View Full Code Here

    byte[] bytes = wovenClass.getBytes();

    ClassReader cr = new ClassReader(bytes);
    ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS
        | ClassWriter.COMPUTE_FRAMES);
    cr.accept(cw, 0);

    Method md = Method
        .getMethod("org.eclipse.swt.graphics.Color getForeground ()");
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, md.getName(),
        md.getDescriptor(), null, null);
View Full Code Here

   
    public WovenClassImpl(Class clazz) {
      try {
        ClassReader cr = new ClassReader(clazz.getName());
        ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        cr.accept(cw, 0);
        bytes = cw.toByteArray();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
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.