Search in sources :

Example 11 with TypeList

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;
}
Also used : CstType(com.taobao.android.dx.rop.cst.CstType) Type(com.taobao.android.dx.rop.type.Type) CstType(com.taobao.android.dx.rop.cst.CstType) TypeList(com.taobao.android.dx.rop.type.TypeList)

Example 12 with TypeList

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);
}
Also used : TypeList(com.taobao.android.dx.rop.type.TypeList) StdTypeList(com.taobao.android.dx.rop.type.StdTypeList)

Aggregations

TypeList (com.taobao.android.dx.rop.type.TypeList)12 CstType (com.taobao.android.dx.rop.cst.CstType)5 StdTypeList (com.taobao.android.dx.rop.type.StdTypeList)5 BasicBlock (com.taobao.android.dx.rop.code.BasicBlock)3 Type (com.taobao.android.dx.rop.type.Type)3 Annotations (com.taobao.android.dx.rop.annotation.Annotations)2 BasicBlockList (com.taobao.android.dx.rop.code.BasicBlockList)2 IntList (com.taobao.android.dx.util.IntList)2 AttExceptions (com.taobao.android.dx.cf.attrib.AttExceptions)1 AttRuntimeInvisibleAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleAnnotations)1 AttRuntimeInvisibleParameterAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)1 AttRuntimeVisibleAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeVisibleAnnotations)1 AttRuntimeVisibleParameterAnnotations (com.taobao.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations)1 ConcreteMethod (com.taobao.android.dx.cf.code.ConcreteMethod)1 DirectClassFile (com.taobao.android.dx.cf.direct.DirectClassFile)1 Method (com.taobao.android.dx.cf.iface.Method)1 MethodList (com.taobao.android.dx.cf.iface.MethodList)1 DalvCode (com.taobao.android.dx.dex.code.DalvCode)1 EncodedMethod (com.taobao.android.dx.dex.file.EncodedMethod)1 Annotation (com.taobao.android.dx.rop.annotation.Annotation)1