Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.ClassNode


   *
   * @param classReader {@link ClassReader} related to the working class. It
   *    shouldn't be null.
   */
  private ClassResource (final ClassReader classReader) {
    super(new ClassNode());

    this.reader = classReader;

    /* Initializes the caches. */
    cache.put(CacheType.ANNOTATIONS, new HashMap<String, Object>());
View Full Code Here


  /**
   * Returns the methods which has this class.
   */
  public Method[] getMethods() {
    ClassNode node = getNode();

    if (node.methods == null) {
      return new Method[0];
    }

View Full Code Here

   *   annotation, or <code>null</code> if it's not found.
   */
  private AnnotationNode findAnnotation(final String name) {
    Validate.notEmpty(name, "The annotation name cannot be null or empty.");

    ClassNode node = getNode();

    if (node.visibleAnnotations != null) {
      for (int i = 0, j = node.visibleAnnotations.size(); i < j; i++) {
        AnnotationNode ann = (AnnotationNode)node.visibleAnnotations.get(i);
        String descriptor = "L" + name.replace(".", "/") + ";";
View Full Code Here

*/
public class Analysis implements Opcodes {

    public static void main(final String[] args) throws Exception {
        ClassReader cr = new ClassReader("Analysis");
        ClassNode cn = new ClassNode();
        cr.accept(cn, ClassReader.SKIP_DEBUG);

        List methods = cn.methods;
        for (int i = 0; i < methods.size(); ++i) {
            MethodNode method = (MethodNode) methods.get(i);
View Full Code Here

    public static void verify(
        final ClassReader cr,
        final boolean dump,
        final PrintWriter pw)
    {
        ClassNode cn = new ClassNode();
        cr.accept(new CheckClassAdapter(cn), ClassReader.SKIP_DEBUG);

        Type syperType = cn.superName == null
                ? null
                : Type.getObjectType(cn.superName);
View Full Code Here

      return bean;
    }

    for (final Class<?> type : typeList) {

      final ClassNode node = UtilAsm.classNode(type);

      applyServiceInferred(bean, type);

      applyPropertyEmbedded(bean, type, node);
View Full Code Here

    final InputStream stream = loader.getResourceAsStream(path);

    final ClassReader reader = new ClassReader(stream);

    final ClassNode node = new ClassNode();

    reader.accept(node, SKIP_MODE);

    return node;
  }
View Full Code Here

   * Check component annotation on a class.
   */
  public static boolean hasComponentAnno(final Class<?> klaz)
      throws Exception {

    final ClassNode node = classNode(klaz);

    final AnnotationNode anno = componentAnno(node);

    return anno != null;

View Full Code Here

    public static void verify(
        final ClassReader cr,
        final boolean dump,
        final PrintWriter pw)
    {
        ClassNode cn = new ClassNode();
        cr.accept(new CheckClassAdapter(cn), ClassReader.SKIP_DEBUG);

        List methods = cn.methods;
        for (int i = 0; i < methods.size(); ++i) {
            MethodNode method = (MethodNode) methods.get(i);
View Full Code Here

        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);
                new ClassReader(b).accept(new ClassNode(), 0);
            }
            t = System.currentTimeMillis() - t;
            System.out.println("Time to deserialize " + classes.size()
                    + " classes with tree package = " + 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);
                ClassWriter cw = new ClassWriter(0);
                ClassNode cn = new ClassNode();
                new ClassReader(b).accept(cn, 0);
                cn.accept(cw);
                cw.toByteArray();
            }
            t = System.currentTimeMillis() - t;
            System.out.println("Time to deserialize and reserialize "
                    + classes.size() + " classes with tree package = " + t
                    + " ms");
        }

        for (int i = 0; i < 10; ++i) {
            int errors = 0;
            long t = System.currentTimeMillis();
            for (int j = 0; j < classes.size() / 10; ++j) {
                byte[] b = (byte[]) classes.get(j);
                ClassReader cr = new ClassReader(b);
                ClassNode cn = new ClassNode();
                cr.accept(cn, ClassReader.SKIP_DEBUG);
                List methods = cn.methods;
                for (int k = 0; k < methods.size(); ++k) {
                    MethodNode method = (MethodNode) methods.get(k);
                    Analyzer a = new Analyzer(new SimpleVerifier());
View Full Code Here

TOP

Related Classes of org.objectweb.asm.tree.ClassNode

Copyright © 2018 www.massapicom. 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.