/**
   * Return a List of SA Fields for all the java fields in this class, including all inherited
   * fields. This includes hidden fields. Thus the returned list can contain fields with the same
   * name. Return an empty list if there are no fields. Only designed for use in a debugging system.
   */
  public List getAllFields() {
    // Contains a Field for each field in this class, including immediate
    // fields and inherited fields.
    List allFields = getImmediateFields();

    // transitiveInterfaces contains all interfaces implemented
    // by this class and its superclass chain with no duplicates.

    ObjArray interfaces = getTransitiveInterfaces();
    int n = (int) interfaces.getLength();
    for (int i = 0; i < n; i++) {
      InstanceKlass intf1 = (InstanceKlass) interfaces.getObjAt(i);
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(intf1.isInterface(), "just checking type");
      }
      allFields.addAll(intf1.getImmediateFields());
    }

    // Get all fields in the superclass, recursively.  But, don't
    // include fields in interfaces implemented by superclasses;
    // we already have all those.
    if (!isInterface()) {
      InstanceKlass supr;
      if ((supr = (InstanceKlass) getSuper()) != null) {
        allFields.addAll(supr.getImmediateFields());
      }
    }

    return allFields;
  }
  /**
   * Return a List of SA Fields for the fields declared in this class. Inherited fields are not
   * included. Return an empty list if there are no fields declared in this class. Only designed for
   * use in a debugging system.
   */
  public List getImmediateFields() {
    // A list of Fields for each field declared in this class/interface,
    // not including inherited fields.
    TypeArray fields = getFields();

    int length = (int) fields.getLength();
    List immediateFields = new ArrayList(length / NEXT_OFFSET);
    for (int index = 0; index < length; index += NEXT_OFFSET) {
      immediateFields.add(getFieldByIndex(index));
    }

    return immediateFields;
  }
  /**
   * Return a List containing an SA InstanceKlass for each interface named in this class's
   * 'implements' clause.
   */
  public List getDirectImplementedInterfaces() {
    // Contains an InstanceKlass for each interface in this classes
    // 'implements' clause.

    ObjArray interfaces = getLocalInterfaces();
    int length = (int) interfaces.getLength();
    List directImplementedInterfaces = new ArrayList(length);

    for (int index = 0; index < length; index++) {
      directImplementedInterfaces.add(interfaces.getObjAt(index));
    }

    return directImplementedInterfaces;
  }
Exemple #4
0
 public void run(PrintStream out, Debugger dbg) {
   CDebugger cdbg = dbg.getCDebugger();
   if (cdbg != null) {
     List l = cdbg.getLoadObjectList();
     for (Iterator itr = l.iterator(); itr.hasNext(); ) {
       LoadObject lo = (LoadObject) itr.next();
       out.print(lo.getBase() + "\t");
       out.print(lo.getSize() / 1024 + "K\t");
       out.println(lo.getName());
     }
   } else {
     if (getDebugeeType() == DEBUGEE_REMOTE) {
       out.println("remote configuration is not yet implemented");
     } else {
       out.println("not yet implemented (debugger does not support CDebugger)!");
     }
   }
 }
 public SimpleTreeNode getChild(int index) {
   LivenessPathElement lpe = (LivenessPathElement) children.get(index);
   IndexableFieldIdentifier ifid = new IndexableFieldIdentifier(index);
   Oop oop = lpe.getObj();
   if (oop != null) {
     return new OopTreeNodeAdapter(oop, ifid, getTreeTableMode());
   } else {
     NamedFieldIdentifier nfi = (NamedFieldIdentifier) lpe.getField();
     return new RootTreeNodeAdapter(nfi.getName(), ifid, getTreeTableMode());
   }
 }
 public int getChildCount() {
   return children != null ? children.size() : 0;
 }