Package org.objectweb.asm.tree

Examples of org.objectweb.asm.tree.FieldNode


        isPresent = true;
        break;
      }
    }
    if (!isPresent) {
      cn.fields.add(new FieldNode(fieldAccess, fieldName, fieldDesc,
          null, null));
    }
    super.transform(cn);
  }
View Full Code Here


        insns.insert(il);

        mn.maxStack += 4;
      }
      int acc = ACC_PUBLIC + ACC_STATIC;
      cn.fields.add(new FieldNode(acc, "timer", "J", null, null));
    }
    super.transform(cn);
  }
View Full Code Here

    cn.access = ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE;
    cn.name = "pkg/Comparable";
    cn.superName = "java/lang/Object";
    cn.interfaces.add("pkg/Mesurable");
    cn.sourceFile = "Comparable.java";
    cn.fields.add(new FieldNode(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
        "LESS", "I", null, new Integer(-1)));
    cn.fields.add(new FieldNode(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
        "EQUAL", "I", null, new Integer(0)));
    cn.fields.add(new FieldNode(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
        "GREATER", "I", null, new Integer(1)));
    cn.methods.add(new MethodNode(ACC_PUBLIC + ACC_ABSTRACT,
        "compareTo", "(Ljava/lang/Object;)I", null, null));
    ClassWriter cw = new ClassWriter(0);
    cn.accept(cw);
View Full Code Here

  }

  public void transform(ClassNode cn) {
    Iterator i = cn.fields.iterator();
    while (i.hasNext()) {
      FieldNode fn = (FieldNode) i.next();
      if (fieldName.equals(fn.name)) {
        i.remove();
      }
    }
    super.transform(cn);
View Full Code Here

    cn.version = V1_6;
    cn.access = ACC_PUBLIC;
    cn.name = "pkg/Bean";
    cn.superName = "java/lang/Object";
    cn.sourceDebug = "Bean.java";
    cn.fields.add(new FieldNode(ACC_PRIVATE, "f", "I", null, null));
    {
      MethodNode mn = new MethodNode(ACC_PUBLIC, "<init>", "()V", null,
          null);
      cn.methods.add(mn);
      InsnList il = mn.instructions;
View Full Code Here

            initialValue = new Double(((IReal)((IConstructor)v).get(4)).doubleValue());
          } else if (desc.equals("Ljava/lang/String;")) {
            initialValue = ((IString)((IConstructor)v).get(4)).getValue();
          }
        }
        al.add(new FieldNode(((IInteger)((IConstructor)v).get(0)).intValue(),
                   ((IString)((IConstructor)v).get(1)).getValue(),
                   ((IString)((IConstructor)v).get(2)).getValue(),
                   emptyIsNull(((IString)((IConstructor)v).get(3)).getValue()),
                   initialValue));
      }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private static void removeFields(ClassNode cn, List<String> names) {
    for (Iterator<FieldNode> it = cn.fields.iterator(); it.hasNext() ;) {
      FieldNode next = it.next();
      if (names.contains(next.name)) {
        it.remove();
      }
    }
  }
View Full Code Here

    private String descriptor(Class<? extends Annotation> type) {
        return Type.getType(type).getDescriptor();
    }

    private FieldNode fieldNode() {
        return new FieldNode(0,
                             "field",
                             Type.getType(Object.class).getDescriptor(),
                             null,
                             null);
    }
View Full Code Here

        String name = makeUnique(fieldNames, suggestedName);

        // No signature and no initial value

        FieldNode fieldNode = new FieldNode(ACC_PRIVATE, name, PlasticInternalUtils.toDescriptor(className), null, null);

        classNode.fields.add(fieldNode);

        fieldNames.add(name);
View Full Code Here

            instanceContextFieldName = makeUnique(fieldNames, "instanceContext");

            // TODO: Once we support inheritance, we could use a protected field and only initialize
            // it once, in the first base class where it is needed.

            FieldNode node = new FieldNode(ACC_PRIVATE | ACC_FINAL, instanceContextFieldName, INSTANCE_CONTEXT_DESC,
                    null, null);

            classNode.fields.add(node);

            // Extend the constructor to store the context in a field.
View Full Code Here

TOP

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

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.