use of com.taobao.android.dx.rop.type.TypeList in project atlas by alibaba.
the class ClassDefsSection method orderItems0.
/**
* Helper for {@link #orderItems}, which recursively assigns indices
* to classes.
*
* @param type {@code null-ok;} type ref to assign, if any
* @param idx {@code >= 0;} the next index to assign
* @param maxDepth maximum recursion depth; if negative, this will
* throw an exception indicating class definition circularity
* @return {@code >= 0;} the next index to assign
*/
private int orderItems0(Type type, int idx, int maxDepth) {
ClassDefItem c = classDefs.get(type);
if ((c == null) || (c.hasIndex())) {
return idx;
}
if (maxDepth < 0) {
throw new RuntimeException("class circularity with " + type);
}
maxDepth--;
CstType superclassCst = c.getSuperclass();
if (superclassCst != null) {
Type superclass = superclassCst.getClassType();
idx = orderItems0(superclass, idx, maxDepth);
}
TypeList interfaces = c.getInterfaces();
int sz = interfaces.size();
for (int i = 0; i < sz; i++) {
idx = orderItems0(interfaces.getType(i), idx, maxDepth);
}
c.setIndex(idx);
orderedDefs.add(c);
return idx + 1;
}
use of com.taobao.android.dx.rop.type.TypeList in project atlas by alibaba.
the class TypeListItem method compareTo0.
/** {@inheritDoc} */
@Override
protected int compareTo0(OffsettedItem other) {
TypeList thisList = this.list;
TypeList otherList = ((TypeListItem) other).list;
return StdTypeList.compareContents(thisList, otherList);
}
Aggregations