Java Code Examples for com.android.dx.rop.type.StdTypeList#EMPTY

The following examples show how to use com.android.dx.rop.type.StdTypeList#EMPTY . 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: ByteCatchList.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: ByteCatchList.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: DexMaker.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
EncodedMethod toEncodedMethod(DexOptions dexOptions) {
    if (code != null) {
        RopMethod ropMethod = new RopMethod(code.toBasicBlocks(), 0);
        LocalVariableInfo locals = null;
        DalvCode dalvCode = RopTranslator.translate(
                ropMethod, PositionList.NONE, locals, code.paramSize(), dexOptions);
        return new EncodedMethod(method.constant, flags, dalvCode, StdTypeList.EMPTY);
    } else return new EncodedMethod(method.constant, flags, null, StdTypeList.EMPTY);

}
 
Example 4
Source File: ClassDefItem.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the list of interfaces implemented.
 *
 * @return {@code non-null;} the interfaces list
 */
public TypeList getInterfaces() {
    if (interfaces == null) {
        return StdTypeList.EMPTY;
    }

    return interfaces.getList();
}
 
Example 5
Source File: FillArrayDataInsn.java    From Box with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 6
Source File: PlainCstInsn.java    From Box with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 7
Source File: PlainCstInsn.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 8
Source File: SwitchInsn.java    From Box with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 9
Source File: SwitchInsn.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 10
Source File: FillArrayDataInsn.java    From Box with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 11
Source File: SwitchInsn.java    From buck with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public TypeList getCatches() {
    return StdTypeList.EMPTY;
}
 
Example 12
Source File: DirectClassFile.java    From J2ME-Loader with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs and returns an instance of {@link TypeList} whose
 * data comes from the bytes of this instance, interpreted as a
 * list of constant pool indices for classes, which are in turn
 * translated to type constants. Instance construction will fail
 * if any of the (alleged) indices turn out not to refer to
 * constant pool entries of type {@code Class}.
 *
 * @param offset offset into {@link #bytes} for the start of the
 * data
 * @param size number of elements in the list (not number of bytes)
 * @return {@code non-null;} an appropriately-constructed class list
 */
public TypeList makeTypeList(int offset, int size) {
    if (size == 0) {
        return StdTypeList.EMPTY;
    }

    if (pool == null) {
        throw new IllegalStateException("pool not yet initialized");
    }

    return new DcfTypeList(bytes, offset, size, pool, observer);
}
 
Example 13
Source File: DirectClassFile.java    From buck with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs and returns an instance of {@link TypeList} whose
 * data comes from the bytes of this instance, interpreted as a
 * list of constant pool indices for classes, which are in turn
 * translated to type constants. Instance construction will fail
 * if any of the (alleged) indices turn out not to refer to
 * constant pool entries of type {@code Class}.
 *
 * @param offset offset into {@link #bytes} for the start of the
 * data
 * @param size number of elements in the list (not number of bytes)
 * @return {@code non-null;} an appropriately-constructed class list
 */
public TypeList makeTypeList(int offset, int size) {
    if (size == 0) {
        return StdTypeList.EMPTY;
    }

    if (pool == null) {
        throw new IllegalStateException("pool not yet initialized");
    }

    return new DcfTypeList(bytes, offset, size, pool, observer);
}
 
Example 14
Source File: Rops.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the appropriate {@code move-result-pseudo} rop for the
 * given type. The result may be a shared instance.
 *
 * @param type {@code non-null;} type of the parameter
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMoveResultPseudo(TypeBearer type) {
    return new Rop(RegOps.MOVE_RESULT_PSEUDO, type.getType(),
                   StdTypeList.EMPTY, (String) null);
}
 
Example 15
Source File: Rop.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a non-branching no-exception instance. The
 * {@code branchingness} is always {@code BRANCH_NONE},
 * and it is never a call-like op (see {@link #isCallLike}).
 *
 * @param opcode the opcode; one of the constants in {@link RegOps}
 * @param result {@code non-null;} result type of this operation; {@link
 * Type#VOID} for no-result operations
 * @param sources {@code non-null;} types of all the sources of this operation
 * @param nickname {@code null-ok;} optional nickname (used for debugging)
 */
public Rop(int opcode, Type result, TypeList sources, String nickname) {
    this(opcode, result, sources, StdTypeList.EMPTY, Rop.BRANCH_NONE,
         false, nickname);
}
 
Example 16
Source File: Rop.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a no-exception instance. The constructed instance is never a
 * call-like op (see {@link #isCallLike}).
 *
 * @param opcode the opcode; one of the constants in {@link RegOps}
 * @param result {@code non-null;} result type of this operation; {@link
 * Type#VOID} for no-result operations
 * @param sources {@code non-null;} types of all the sources of this operation
 * @param branchingness the branchingness of this op; one of the
 * {@code BRANCH_*} constants
 * @param nickname {@code null-ok;} optional nickname (used for debugging)
 */
public Rop(int opcode, Type result, TypeList sources, int branchingness,
           String nickname) {
    this(opcode, result, sources, StdTypeList.EMPTY, branchingness, false,
         nickname);
}
 
Example 17
Source File: Rop.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a non-branching no-exception instance. The
 * {@code branchingness} is always {@code BRANCH_NONE},
 * and it is never a call-like op (see {@link #isCallLike}).
 *
 * @param opcode the opcode; one of the constants in {@link RegOps}
 * @param result {@code non-null;} result type of this operation; {@link
 * Type#VOID} for no-result operations
 * @param sources {@code non-null;} types of all the sources of this operation
 * @param nickname {@code null-ok;} optional nickname (used for debugging)
 */
public Rop(int opcode, Type result, TypeList sources, String nickname) {
    this(opcode, result, sources, StdTypeList.EMPTY, Rop.BRANCH_NONE,
         false, nickname);
}
 
Example 18
Source File: Rop.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a non-branching no-exception instance. The
 * {@code branchingness} is always {@code BRANCH_NONE},
 * and it is never a call-like op (see {@link #isCallLike}).
 *
 * @param opcode the opcode; one of the constants in {@link RegOps}
 * @param result {@code non-null;} result type of this operation; {@link
 * Type#VOID} for no-result operations
 * @param sources {@code non-null;} types of all the sources of this operation
 * @param nickname {@code null-ok;} optional nickname (used for debugging)
 */
public Rop(int opcode, Type result, TypeList sources, String nickname) {
    this(opcode, result, sources, StdTypeList.EMPTY, Rop.BRANCH_NONE,
         false, nickname);
}
 
Example 19
Source File: Rops.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the appropriate {@code move-exception} rop for the
 * given type. The result may be a shared instance.
 *
 * @param type {@code non-null;} type of the exception
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMoveException(TypeBearer type) {
    return new Rop(RegOps.MOVE_EXCEPTION, type.getType(),
                   StdTypeList.EMPTY, (String) null);
}
 
Example 20
Source File: Rops.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the appropriate {@code move-result} rop for the
 * given type. The result may be a shared instance.
 *
 * @param type {@code non-null;} type of the parameter
 * @return {@code non-null;} an appropriate instance
 */
public static Rop opMoveResult(TypeBearer type) {
    return new Rop(RegOps.MOVE_RESULT, type.getType(),
                   StdTypeList.EMPTY, (String) null);
}