com.android.dx.cf.code.LineNumberList Java Examples

The following examples show how to use com.android.dx.cf.code.LineNumberList. 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: AttLineNumberTable.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param lineNumbers {@code non-null;} list of line number entries
 */
public AttLineNumberTable(LineNumberList lineNumbers) {
    super(ATTRIBUTE_NAME);

    try {
        if (lineNumbers.isMutable()) {
            throw new MutabilityException("lineNumbers.isMutable()");
        }
    } catch (NullPointerException ex) {
        // Translate the exception.
        throw new NullPointerException("lineNumbers == null");
    }

    this.lineNumbers = lineNumbers;
}
 
Example #2
Source File: StdAttributeFactory.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code LineNumberTable} attribute.
 */
private Attribute lineNumberTable(DirectClassFile cf, int offset,
        int length, ParseObserver observer) {
    if (length < 2) {
        return throwSeverelyTruncated();
    }

    ByteArray bytes = cf.getBytes();
    int count = bytes.getUnsignedShort(offset); // line_number_table_length

    if (observer != null) {
        observer.parsed(bytes, offset, 2,
                        "line_number_table_length: " + Hex.u2(count));
    }

    offset += 2;
    length -= 2;

    if (length != (count * 4)) {
        throwBadLength((count * 4) + 2);
    }

    LineNumberList list = new LineNumberList(count);

    for (int i = 0; i < count; i++) {
        int startPc = bytes.getUnsignedShort(offset);
        int lineNumber = bytes.getUnsignedShort(offset + 2);
        list.set(i, startPc, lineNumber);
        if (observer != null) {
            observer.parsed(bytes, offset, 4,
                            Hex.u2(startPc) + " " + lineNumber);
        }
        offset += 4;
    }

    list.setImmutable();
    return new AttLineNumberTable(list);
}
 
Example #3
Source File: AttLineNumberTable.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param lineNumbers {@code non-null;} list of line number entries
 */
public AttLineNumberTable(LineNumberList lineNumbers) {
    super(ATTRIBUTE_NAME);

    try {
        if (lineNumbers.isMutable()) {
            throw new MutabilityException("lineNumbers.isMutable()");
        }
    } catch (NullPointerException ex) {
        // Translate the exception.
        throw new NullPointerException("lineNumbers == null");
    }

    this.lineNumbers = lineNumbers;
}
 
Example #4
Source File: StdAttributeFactory.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code LineNumberTable} attribute.
 */
private Attribute lineNumberTable(DirectClassFile cf, int offset,
        int length, ParseObserver observer) {
    if (length < 2) {
        return throwSeverelyTruncated();
    }

    ByteArray bytes = cf.getBytes();
    int count = bytes.getUnsignedShort(offset); // line_number_table_length

    if (observer != null) {
        observer.parsed(bytes, offset, 2,
                        "line_number_table_length: " + Hex.u2(count));
    }

    offset += 2;
    length -= 2;

    if (length != (count * 4)) {
        throwBadLength((count * 4) + 2);
    }

    LineNumberList list = new LineNumberList(count);

    for (int i = 0; i < count; i++) {
        int startPc = bytes.getUnsignedShort(offset);
        int lineNumber = bytes.getUnsignedShort(offset + 2);
        list.set(i, startPc, lineNumber);
        if (observer != null) {
            observer.parsed(bytes, offset, 4,
                            Hex.u2(startPc) + " " + lineNumber);
        }
        offset += 4;
    }

    list.setImmutable();
    return new AttLineNumberTable(list);
}
 
Example #5
Source File: AttLineNumberTable.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param lineNumbers {@code non-null;} list of line number entries
 */
public AttLineNumberTable(LineNumberList lineNumbers) {
    super(ATTRIBUTE_NAME);

    try {
        if (lineNumbers.isMutable()) {
            throw new MutabilityException("lineNumbers.isMutable()");
        }
    } catch (NullPointerException ex) {
        // Translate the exception.
        throw new NullPointerException("lineNumbers == null");
    }

    this.lineNumbers = lineNumbers;
}
 
Example #6
Source File: StdAttributeFactory.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code LineNumberTable} attribute.
 */
private Attribute lineNumberTable(DirectClassFile cf, int offset,
        int length, ParseObserver observer) {
    if (length < 2) {
        return throwSeverelyTruncated();
    }

    ByteArray bytes = cf.getBytes();
    int count = bytes.getUnsignedShort(offset); // line_number_table_length

    if (observer != null) {
        observer.parsed(bytes, offset, 2,
                        "line_number_table_length: " + Hex.u2(count));
    }

    offset += 2;
    length -= 2;

    if (length != (count * 4)) {
        throwBadLength((count * 4) + 2);
    }

    LineNumberList list = new LineNumberList(count);

    for (int i = 0; i < count; i++) {
        int startPc = bytes.getUnsignedShort(offset);
        int lineNumber = bytes.getUnsignedShort(offset + 2);
        list.set(i, startPc, lineNumber);
        if (observer != null) {
            observer.parsed(bytes, offset, 4,
                            Hex.u2(startPc) + " " + lineNumber);
        }
        offset += 4;
    }

    list.setImmutable();
    return new AttLineNumberTable(list);
}
 
Example #7
Source File: AttLineNumberTable.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance.
 *
 * @param lineNumbers {@code non-null;} list of line number entries
 */
public AttLineNumberTable(LineNumberList lineNumbers) {
    super(ATTRIBUTE_NAME);

    try {
        if (lineNumbers.isMutable()) {
            throw new MutabilityException("lineNumbers.isMutable()");
        }
    } catch (NullPointerException ex) {
        // Translate the exception.
        throw new NullPointerException("lineNumbers == null");
    }

    this.lineNumbers = lineNumbers;
}
 
Example #8
Source File: StdAttributeFactory.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code LineNumberTable} attribute.
 */
private Attribute lineNumberTable(DirectClassFile cf, int offset,
        int length, ParseObserver observer) {
    if (length < 2) {
        return throwSeverelyTruncated();
    }

    ByteArray bytes = cf.getBytes();
    int count = bytes.getUnsignedShort(offset); // line_number_table_length

    if (observer != null) {
        observer.parsed(bytes, offset, 2,
                        "line_number_table_length: " + Hex.u2(count));
    }

    offset += 2;
    length -= 2;

    if (length != (count * 4)) {
        throwBadLength((count * 4) + 2);
    }

    LineNumberList list = new LineNumberList(count);

    for (int i = 0; i < count; i++) {
        int startPc = bytes.getUnsignedShort(offset);
        int lineNumber = bytes.getUnsignedShort(offset + 2);
        list.set(i, startPc, lineNumber);
        if (observer != null) {
            observer.parsed(bytes, offset, 4,
                            Hex.u2(startPc) + " " + lineNumber);
        }
        offset += 4;
    }

    list.setImmutable();
    return new AttLineNumberTable(list);
}
 
Example #9
Source File: AttLineNumberTable.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the list of "line number" entries associated with this instance.
 *
 * @return {@code non-null;} the list
 */
public LineNumberList getLineNumbers() {
    return lineNumbers;
}
 
Example #10
Source File: AttLineNumberTable.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the list of "line number" entries associated with this instance.
 *
 * @return {@code non-null;} the list
 */
public LineNumberList getLineNumbers() {
    return lineNumbers;
}
 
Example #11
Source File: AttLineNumberTable.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the list of "line number" entries associated with this instance.
 *
 * @return {@code non-null;} the list
 */
public LineNumberList getLineNumbers() {
    return lineNumbers;
}
 
Example #12
Source File: AttLineNumberTable.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the list of "line number" entries associated with this instance.
 *
 * @return {@code non-null;} the list
 */
public LineNumberList getLineNumbers() {
    return lineNumbers;
}