Java Code Examples for com.android.dx.rop.cst.CstType#getClassType()

The following examples show how to use com.android.dx.rop.cst.CstType#getClassType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeIdsSection.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Interns an element into this instance.
 *
 * @param type {@code non-null;} the type to intern
 * @return {@code non-null;} the interned reference
 */
public synchronized TypeIdItem intern(CstType type) {
    if (type == null) {
        throw new NullPointerException("type == null");
    }

    throwIfPrepared();

    Type typePerSe = type.getClassType();
    TypeIdItem result = typeIds.get(typePerSe);

    if (result == null) {
        result = new TypeIdItem(type);
        typeIds.put(typePerSe, result);
    }

    return result;
}
 
Example 2
Source File: TypeIdsSection.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Interns an element into this instance.
 *
 * @param type {@code non-null;} the type to intern
 * @return {@code non-null;} the interned reference
 */
public synchronized TypeIdItem intern(CstType type) {
    if (type == null) {
        throw new NullPointerException("type == null");
    }

    throwIfPrepared();

    Type typePerSe = type.getClassType();
    TypeIdItem result = typeIds.get(typePerSe);

    if (result == null) {
        result = new TypeIdItem(type);
        typeIds.put(typePerSe, result);
    }

    return result;
}
 
Example 3
Source File: TypeIdsSection.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Interns an element into this instance.
 *
 * @param type {@code non-null;} the type to intern
 * @return {@code non-null;} the interned reference
 */
public synchronized TypeIdItem intern(CstType type) {
    if (type == null) {
        throw new NullPointerException("type == null");
    }

    throwIfPrepared();

    Type typePerSe = type.getClassType();
    TypeIdItem result = typeIds.get(typePerSe);

    if (result == null) {
        result = new TypeIdItem(type);
        typeIds.put(typePerSe, result);
    }

    return result;
}
 
Example 4
Source File: TypeIdsSection.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Interns an element into this instance.
 *
 * @param type {@code non-null;} the type to intern
 * @return {@code non-null;} the interned reference
 */
public synchronized TypeIdItem intern(CstType type) {
    if (type == null) {
        throw new NullPointerException("type == null");
    }

    throwIfPrepared();

    Type typePerSe = type.getClassType();
    TypeIdItem result = typeIds.get(typePerSe);

    if (result == null) {
        result = new TypeIdItem(type);
        typeIds.put(typePerSe, result);
    }

    return result;
}
 
Example 5
Source File: ClassDefsSection.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: ClassDefsSection.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 7
Source File: ClassDefsSection.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 8
Source File: ClassDefsSection.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}