Logo Search packages:      
Sourcecode: japitools version File versions  Download package

static void net::wuffies::japi::Japize::getFieldsAndCalls ( ClassWrapper  outer,
ClassType  ctype,
Map  fieldMap,
Map  callMap 
) [inline, static, private]

Load all the fields and calls for a particular class, taking inheritance into account. fieldMap and callMap will be maps from string to BoundField and BoundCall respectively. You can ignore the strings and just sort the values afterwards.

Definition at line 958 of file Japize.java.

References net::wuffies::japi::ClassType::bind(), and net::wuffies::japi::ClassType::getWrapper().

Referenced by japizeClass().

                                                                                                        {
    ClassWrapper c = (ctype == null) ? outer : ctype.getWrapper();

    ClassType[] ifaces = c.getInterfaces();
    for (int i = 0; i < ifaces.length; i++) {
      ClassType iface = ifaces[i];
      if (ctype != null) iface = (ClassType) iface.bind(ctype);
      getFieldsAndCalls(outer, iface, fieldMap, callMap);
    }
    ClassType sup = c.getSuperclass();
    if (sup != null) {
      if (ctype != null) sup = (ClassType) sup.bind(ctype);
      getFieldsAndCalls(outer, sup, fieldMap, callMap);
    }
    FieldWrapper[] fields = c.getFields();
    for (int i = 0; i < fields.length; i++) {
      fieldMap.put(fields[i].getName(), new BoundField(fields[i]));
    }
    CallWrapper[] calls = c.getCalls();
    for (int i = 0; i < calls.length; i++) {
      BoundCall call = new BoundCall(calls[i], outer);
      if (ctype == null || call.isInheritable()) {

        // JDK15: handle bridge methods (the ACC_VOLATILE bit corresponds to the ACC_BRIDGE bit)
        // These get immediately bind14()d because they are only visible in the 1.4 view of the universe
        if (Modifier.isVolatile(calls[i].getModifiers())) call = call.bind14();

        callMap.put(call.getNonGenericSig(), call);
      }
    }
    if (ctype != null) {
      for (Iterator i = fieldMap.entrySet().iterator(); i.hasNext(); ) {
        Map.Entry ent = (Map.Entry) i.next();
        ent.setValue(((BoundField) ent.getValue()).bind(ctype));
      }
      for (Iterator i = new ArrayList(callMap.entrySet()).iterator(); i.hasNext(); ) {
        Map.Entry ent = (Map.Entry) i.next();
        String nonGenSig = (String) ent.getKey();
        BoundCall call = (BoundCall) ent.getValue();
        if (!call.getNonGenericSig().equals(nonGenSig)) throw new RuntimeException("unmatched sigs: " + nonGenSig + ", " + call.getNonGenericSig());
        BoundCall boundCall = call.bind(ctype);
        if (boundCall.getExclude14() && !call.getExclude14()) {
          callMap.put(nonGenSig, call.bind14());
        }
        callMap.put(boundCall.getNonGenericSig(), boundCall);
      }
    }
  }


Generated by  Doxygen 1.6.0   Back to index