Search in sources :

Example 6 with StdTypeList

use of com.android.dx.rop.type.StdTypeList in project buck by facebook.

the class ProtoIdItem method makeShortForm.

/**
     * Creates the short-form of the given prototype.
     *
     * @param prototype {@code non-null;} the prototype
     * @return {@code non-null;} the short form
     */
private static CstString makeShortForm(Prototype prototype) {
    StdTypeList parameters = prototype.getParameterTypes();
    int size = parameters.size();
    StringBuilder sb = new StringBuilder(size + 1);
    sb.append(shortFormCharFor(prototype.getReturnType()));
    for (int i = 0; i < size; i++) {
        sb.append(shortFormCharFor(parameters.getType(i)));
    }
    return new CstString(sb.toString());
}
Also used : StdTypeList(com.android.dx.rop.type.StdTypeList) CstString(com.android.dx.rop.cst.CstString)

Example 7 with StdTypeList

use of com.android.dx.rop.type.StdTypeList in project RocooFix by dodola.

the class ClassReferenceListBuilder method addDependencies.

private void addDependencies(ConstantPool pool) {
    for (Constant constant : pool.getEntries()) {
        if (constant instanceof CstType) {
            checkDescriptor(((CstType) constant).getClassType());
        } else if (constant instanceof CstFieldRef) {
            checkDescriptor(((CstFieldRef) constant).getType());
        } else if (constant instanceof CstMethodRef) {
            Prototype proto = ((CstMethodRef) constant).getPrototype();
            checkDescriptor(proto.getReturnType());
            StdTypeList args = proto.getParameterTypes();
            for (int i = 0; i < args.size(); i++) {
                checkDescriptor(args.get(i));
            }
        }
    }
}
Also used : Prototype(com.android.dx.rop.type.Prototype) StdTypeList(com.android.dx.rop.type.StdTypeList) Constant(com.android.dx.rop.cst.Constant) CstType(com.android.dx.rop.cst.CstType) CstFieldRef(com.android.dx.rop.cst.CstFieldRef) CstMethodRef(com.android.dx.rop.cst.CstMethodRef)

Example 8 with StdTypeList

use of com.android.dx.rop.type.StdTypeList in project RocooFix by dodola.

the class ClassReferenceListBuilder method checkPrototype.

private void checkPrototype(Prototype proto) {
    checkDescriptor(proto.getReturnType().getDescriptor());
    StdTypeList args = proto.getParameterTypes();
    for (int i = 0; i < args.size(); i++) {
        checkDescriptor(args.get(i).getDescriptor());
    }
}
Also used : StdTypeList(com.android.dx.rop.type.StdTypeList)

Example 9 with StdTypeList

use of com.android.dx.rop.type.StdTypeList in project J2ME-Loader by nikita36078.

the class BaseMachine method popArgs.

/**
 * {@inheritDoc}
 */
public void popArgs(Frame frame, Prototype prototype) {
    StdTypeList types = prototype.getParameterTypes();
    int size = types.size();
    // Use the above method to do the actual popping...
    popArgs(frame, size);
    for (int i = 0; i < size; i++) {
        if (!Merger.isPossiblyAssignableFrom(types.getType(i), args[i])) {
            throw new SimException("at stack depth " + (size - 1 - i) + ", expected type " + types.getType(i).toHuman() + " but found " + args[i].getType().toHuman());
        }
    }
}
Also used : StdTypeList(com.android.dx.rop.type.StdTypeList)

Example 10 with StdTypeList

use of com.android.dx.rop.type.StdTypeList in project J2ME-Loader by nikita36078.

the class ByteCatchList method toRopCatchList.

/**
 * Returns a rop-style catches list equivalent to this one.
 *
 * @return {@code non-null;} the converted instance
 */
public TypeList toRopCatchList() {
    int sz = size();
    if (sz == 0) {
        return StdTypeList.EMPTY;
    }
    StdTypeList result = new StdTypeList(sz);
    for (int i = 0; i < sz; i++) {
        result.set(i, get(i).getExceptionClass().getClassType());
    }
    result.setImmutable();
    return result;
}
Also used : StdTypeList(com.android.dx.rop.type.StdTypeList)

Aggregations

StdTypeList (com.android.dx.rop.type.StdTypeList)21 CstType (com.android.dx.rop.cst.CstType)10 Type (com.android.dx.rop.type.Type)10 CstString (com.android.dx.rop.cst.CstString)4 Prototype (com.android.dx.rop.type.Prototype)4 ByteArrayByteInput (com.android.dex.util.ByteArrayByteInput)2 ByteInput (com.android.dex.util.ByteInput)2 AttInnerClasses (com.android.dx.cf.attrib.AttInnerClasses)2 AttRuntimeInvisibleAnnotations (com.android.dx.cf.attrib.AttRuntimeInvisibleAnnotations)2 AttRuntimeInvisibleParameterAnnotations (com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations)2 AttRuntimeVisibleAnnotations (com.android.dx.cf.attrib.AttRuntimeVisibleAnnotations)2 AttRuntimeVisibleParameterAnnotations (com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations)2 InnerClassList (com.android.dx.cf.attrib.InnerClassList)2 LocalList (com.android.dx.dex.code.LocalList)2 PositionList (com.android.dx.dex.code.PositionList)2 Annotations (com.android.dx.rop.annotation.Annotations)2 BasicBlock (com.android.dx.rop.code.BasicBlock)2 Insn (com.android.dx.rop.code.Insn)2 InsnList (com.android.dx.rop.code.InsnList)2 PlainCstInsn (com.android.dx.rop.code.PlainCstInsn)2