Java Code Examples for com.android.dx.util.IntList#throwIfMutable()

The following examples show how to use com.android.dx.util.IntList#throwIfMutable() . 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: Frame.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param locals {@code non-null;} the locals array to use
 * @param stack {@code non-null;} the execution stack to use
 * @param subroutines {@code non-null;} list of subroutine start labels for
 * subroutines this frame is nested in
 */
private Frame(LocalsArray locals,
        ExecutionStack stack, IntList subroutines) {
    if (locals == null) {
        throw new NullPointerException("locals == null");
    }

    if (stack == null) {
        throw new NullPointerException("stack == null");
    }

    subroutines.throwIfMutable();

    this.locals = locals;
    this.stack = stack;
    this.subroutines = subroutines;
}
 
Example 2
Source File: Ropper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Adds or replaces a block in the output result. Do not delete
 * any successors.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlockNoDelete(BasicBlock block,
        IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        result.remove(idx);
        resultSubroutines.remove(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 3
Source File: Frame.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param locals {@code non-null;} the locals array to use
 * @param stack {@code non-null;} the execution stack to use
 * @param subroutines {@code non-null;} list of subroutine start labels for
 * subroutines this frame is nested in
 */
private Frame(LocalsArray locals,
        ExecutionStack stack, IntList subroutines) {
    if (locals == null) {
        throw new NullPointerException("locals == null");
    }

    if (stack == null) {
        throw new NullPointerException("stack == null");
    }

    subroutines.throwIfMutable();

    this.locals = locals;
    this.stack = stack;
    this.subroutines = subroutines;
}
 
Example 4
Source File: Ropper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Adds or replaces a block in the output result. Do not delete
 * any successors.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlockNoDelete(BasicBlock block,
        IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        result.remove(idx);
        resultSubroutines.remove(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 5
Source File: Frame.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param locals {@code non-null;} the locals array to use
 * @param stack {@code non-null;} the execution stack to use
 * @param subroutines {@code non-null;} list of subroutine start labels for
 * subroutines this frame is nested in
 */
private Frame(LocalsArray locals,
        ExecutionStack stack, IntList subroutines) {
    if (locals == null) {
        throw new NullPointerException("locals == null");
    }

    if (stack == null) {
        throw new NullPointerException("stack == null");
    }

    subroutines.throwIfMutable();

    this.locals = locals;
    this.stack = stack;
    this.subroutines = subroutines;
}
 
Example 6
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Adds or replaces a block in the output result. Do not delete
 * any successors.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlockNoDelete(BasicBlock block,
        IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        result.remove(idx);
        resultSubroutines.remove(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 7
Source File: Frame.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param locals {@code non-null;} the locals array to use
 * @param stack {@code non-null;} the execution stack to use
 * @param subroutines {@code non-null;} list of subroutine start labels for
 * subroutines this frame is nested in
 */
private Frame(LocalsArray locals,
        ExecutionStack stack, IntList subroutines) {
    if (locals == null) {
        throw new NullPointerException("locals == null");
    }

    if (stack == null) {
        throw new NullPointerException("stack == null");
    }

    subroutines.throwIfMutable();

    this.locals = locals;
    this.stack = stack;
    this.subroutines = subroutines;
}
 
Example 8
Source File: Ropper.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Adds or replaces a block in the output result. Do not delete
 * any successors.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlockNoDelete(BasicBlock block,
        IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        result.remove(idx);
        resultSubroutines.remove(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 9
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a block to the output result.
 *
 * @param block {@code non-null;} the block to add
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 */
private void addBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
}
 
Example 10
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Adds or replace a block in the output result. If this is a
 * replacement, then any extra blocks that got added with the
 * original get removed as a result of calling this method.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        /*
         * We are replacing a pre-existing block, so find any
         * blocks that got added as part of the original and
         * remove those too. Such blocks are (possibly indirect)
         * successors of this block which are out of the range of
         * normally-translated blocks.
         */
        removeBlockAndSpecialSuccessors(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 11
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a block to the output result.
 *
 * @param block {@code non-null;} the block to add
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 */
private void addBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
}
 
Example 12
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Adds or replace a block in the output result. If this is a
 * replacement, then any extra blocks that got added with the
 * original get removed as a result of calling this method.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        /*
         * We are replacing a pre-existing block, so find any
         * blocks that got added as part of the original and
         * remove those too. Such blocks are (possibly indirect)
         * successors of this block which are out of the range of
         * normally-translated blocks.
         */
        removeBlockAndSpecialSuccessors(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 13
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a block to the output result.
 *
 * @param block {@code non-null;} the block to add
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 */
private void addBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
}
 
Example 14
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Adds or replace a block in the output result. If this is a
 * replacement, then any extra blocks that got added with the
 * original get removed as a result of calling this method.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        /*
         * We are replacing a pre-existing block, so find any
         * blocks that got added as part of the original and
         * remove those too. Such blocks are (possibly indirect)
         * successors of this block which are out of the range of
         * normally-translated blocks.
         */
        removeBlockAndSpecialSuccessors(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
Example 15
Source File: Ropper.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a block to the output result.
 *
 * @param block {@code non-null;} the block to add
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 */
private void addBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
}
 
Example 16
Source File: Ropper.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Adds or replace a block in the output result. If this is a
 * replacement, then any extra blocks that got added with the
 * original get removed as a result of calling this method.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlock(BasicBlock block, IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        /*
         * We are replacing a pre-existing block, so find any
         * blocks that got added as part of the original and
         * remove those too. Such blocks are (possibly indirect)
         * successors of this block which are out of the range of
         * normally-translated blocks.
         */
        removeBlockAndSpecialSuccessors(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}