Java Code Examples for com.android.dx.rop.cst.CstMethodRef#getPrototype()

The following examples show how to use com.android.dx.rop.cst.CstMethodRef#getPrototype() . 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: DebugInfoDecoder.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param encoded encoded debug info
 * @param codesize size of code block in code units
 * @param regSize register size, in register units, of the register space
 * used by this method
 * @param isStatic true if method is static
 * @param ref method descriptor of method this debug info is for
 * @param file dex file this debug info will be stored in
 */
DebugInfoDecoder(byte[] encoded, int codesize, int regSize,
        boolean isStatic, CstMethodRef ref, DexFile file) {
    if (encoded == null) {
        throw new NullPointerException("encoded == null");
    }

    this.encoded = encoded;
    this.isStatic = isStatic;
    this.desc = ref.getPrototype();
    this.file = file;
    this.regSize = regSize;

    positions = new ArrayList<PositionEntry>();
    locals = new ArrayList<LocalEntry>();
    this.codesize = codesize;
    lastEntryForReg = new LocalEntry[regSize];

    int idx = -1;

    try {
        idx = file.getStringIds().indexOf(new CstString("this"));
    } catch (IllegalArgumentException ex) {
        /*
         * Silently tolerate not finding "this". It just means that
         * no method has local variable info that looks like
         * a standard instance method.
         */
    }

    thisStringIdx = idx;
}
 
Example 2
Source File: DebugInfoEncoder.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param positions {@code null-ok;} positions (line numbers) to encode
 * @param locals {@code null-ok;} local variables to encode
 * @param file {@code null-ok;} may only be {@code null} if simply using
 * this class to do a debug print
 * @param codeSize
 * @param regSize
 * @param isStatic
 * @param ref
 */
public DebugInfoEncoder(PositionList positions, LocalList locals,
        DexFile file, int codeSize, int regSize,
        boolean isStatic, CstMethodRef ref) {
    this.positions = positions;
    this.locals = locals;
    this.file = file;
    this.desc = ref.getPrototype();
    this.isStatic = isStatic;
    this.codeSize = codeSize;
    this.regSize = regSize;

    output = new ByteArrayAnnotatedOutput();
    lastEntryForReg = new LocalList.Entry[regSize];
}
 
Example 3
Source File: DebugInfoDecoder.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param encoded encoded debug info
 * @param codesize size of code block in code units
 * @param regSize register size, in register units, of the register space
 * used by this method
 * @param isStatic true if method is static
 * @param ref method descriptor of method this debug info is for
 * @param file dex file this debug info will be stored in
 */
DebugInfoDecoder(byte[] encoded, int codesize, int regSize,
        boolean isStatic, CstMethodRef ref, DexFile file) {
    if (encoded == null) {
        throw new NullPointerException("encoded == null");
    }

    this.encoded = encoded;
    this.isStatic = isStatic;
    this.desc = ref.getPrototype();
    this.file = file;
    this.regSize = regSize;

    positions = new ArrayList<PositionEntry>();
    locals = new ArrayList<LocalEntry>();
    this.codesize = codesize;
    lastEntryForReg = new LocalEntry[regSize];

    int idx = -1;

    try {
        idx = file.getStringIds().indexOf(new CstString("this"));
    } catch (IllegalArgumentException ex) {
        /*
         * Silently tolerate not finding "this". It just means that
         * no method has local variable info that looks like
         * a standard instance method.
         */
    }

    thisStringIdx = idx;
}
 
Example 4
Source File: DebugInfoEncoder.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param positions {@code null-ok;} positions (line numbers) to encode
 * @param locals {@code null-ok;} local variables to encode
 * @param file {@code null-ok;} may only be {@code null} if simply using
 * this class to do a debug print
 * @param codeSize
 * @param regSize
 * @param isStatic
 * @param ref
 */
public DebugInfoEncoder(PositionList positions, LocalList locals,
        DexFile file, int codeSize, int regSize,
        boolean isStatic, CstMethodRef ref) {
    this.positions = positions;
    this.locals = locals;
    this.file = file;
    this.desc = ref.getPrototype();
    this.isStatic = isStatic;
    this.codeSize = codeSize;
    this.regSize = regSize;

    output = new ByteArrayAnnotatedOutput();
    lastEntryForReg = new LocalList.Entry[regSize];
}
 
Example 5
Source File: DebugInfoDecoder.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param encoded encoded debug info
 * @param codesize size of code block in code units
 * @param regSize register size, in register units, of the register space
 * used by this method
 * @param isStatic true if method is static
 * @param ref method descriptor of method this debug info is for
 * @param file dex file this debug info will be stored in
 */
DebugInfoDecoder(byte[] encoded, int codesize, int regSize,
        boolean isStatic, CstMethodRef ref, DexFile file) {
    if (encoded == null) {
        throw new NullPointerException("encoded == null");
    }

    this.encoded = encoded;
    this.isStatic = isStatic;
    this.desc = ref.getPrototype();
    this.file = file;
    this.regSize = regSize;

    positions = new ArrayList<PositionEntry>();
    locals = new ArrayList<LocalEntry>();
    this.codesize = codesize;
    lastEntryForReg = new LocalEntry[regSize];

    int idx = -1;

    try {
        idx = file.getStringIds().indexOf(new CstString("this"));
    } catch (IllegalArgumentException ex) {
        /*
         * Silently tolerate not finding "this". It just means that
         * no method has local variable info that looks like
         * a standard instance method.
         */
    }

    thisStringIdx = idx;
}
 
Example 6
Source File: DebugInfoEncoder.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param positions {@code null-ok;} positions (line numbers) to encode
 * @param locals {@code null-ok;} local variables to encode
 * @param file {@code null-ok;} may only be {@code null} if simply using
 * this class to do a debug print
 * @param codeSize
 * @param regSize
 * @param isStatic
 * @param ref
 */
public DebugInfoEncoder(PositionList positions, LocalList locals,
        DexFile file, int codeSize, int regSize,
        boolean isStatic, CstMethodRef ref) {
    this.positions = positions;
    this.locals = locals;
    this.file = file;
    this.desc = ref.getPrototype();
    this.isStatic = isStatic;
    this.codeSize = codeSize;
    this.regSize = regSize;

    output = new ByteArrayAnnotatedOutput();
    lastEntryForReg = new LocalList.Entry[regSize];
}
 
Example 7
Source File: DebugInfoDecoder.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param encoded encoded debug info
 * @param codesize size of code block in code units
 * @param regSize register size, in register units, of the register space
 * used by this method
 * @param isStatic true if method is static
 * @param ref method descriptor of method this debug info is for
 * @param file dex file this debug info will be stored in
 */
DebugInfoDecoder(byte[] encoded, int codesize, int regSize,
        boolean isStatic, CstMethodRef ref, DexFile file) {
    if (encoded == null) {
        throw new NullPointerException("encoded == null");
    }

    this.encoded = encoded;
    this.isStatic = isStatic;
    this.desc = ref.getPrototype();
    this.file = file;
    this.regSize = regSize;

    positions = new ArrayList<PositionEntry>();
    locals = new ArrayList<LocalEntry>();
    this.codesize = codesize;
    lastEntryForReg = new LocalEntry[regSize];

    int idx = -1;

    try {
        idx = file.getStringIds().indexOf(new CstString("this"));
    } catch (IllegalArgumentException ex) {
        /*
         * Silently tolerate not finding "this". It just means that
         * no method has local variable info that looks like
         * a standard instance method.
         */
    }

    thisStringIdx = idx;
}
 
Example 8
Source File: DebugInfoEncoder.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance.
 *
 * @param positions {@code null-ok;} positions (line numbers) to encode
 * @param locals {@code null-ok;} local variables to encode
 * @param file {@code null-ok;} may only be {@code null} if simply using
 * this class to do a debug print
 * @param codeSize
 * @param regSize
 * @param isStatic
 * @param ref
 */
public DebugInfoEncoder(PositionList positions, LocalList locals,
        DexFile file, int codeSize, int regSize,
        boolean isStatic, CstMethodRef ref) {
    this.positions = positions;
    this.locals = locals;
    this.file = file;
    this.desc = ref.getPrototype();
    this.isStatic = isStatic;
    this.codeSize = codeSize;
    this.regSize = regSize;

    output = new ByteArrayAnnotatedOutput();
    lastEntryForReg = new LocalList.Entry[regSize];
}
 
Example 9
Source File: InvokePolymorphicInsn.java    From Box with Apache License 2.0 4 votes vote down vote up
private static CstProtoRef makeCallSiteProto(final CstMethodRef callSiteMethod) {
    return new CstProtoRef(callSiteMethod.getPrototype(true));
}
 
Example 10
Source File: InvokePolymorphicInsn.java    From Box with Apache License 2.0 4 votes vote down vote up
private static CstProtoRef makeCallSiteProto(final CstMethodRef callSiteMethod) {
    return new CstProtoRef(callSiteMethod.getPrototype(true));
}
 
Example 11
Source File: InvokePolymorphicInsn.java    From J2ME-Loader with Apache License 2.0 4 votes vote down vote up
private static CstProtoRef makeCallSiteProto(final CstMethodRef callSiteMethod) {
    return new CstProtoRef(callSiteMethod.getPrototype(true));
}