Java Code Examples for com.android.dx.rop.type.Type#intern()

The following examples show how to use com.android.dx.rop.type.Type#intern() . 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: AnnotationParser.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a single annotation.
 *
 * @param visibility {@code non-null;} visibility of the parsed annotation
 * @return {@code non-null;} the parsed annotation
 */
private Annotation parseAnnotation(AnnotationVisibility visibility)
        throws IOException {
    requireLength(4);

    int typeIndex = input.readUnsignedShort();
    int numElements = input.readUnsignedShort();
    CstString typeString = (CstString) pool.get(typeIndex);
    CstType type = new CstType(Type.intern(typeString.getString()));

    if (observer != null) {
        parsed(2, "type: " + type.toHuman());
        parsed(2, "num_elements: " + numElements);
    }

    Annotation annotation = new Annotation(type, visibility);

    for (int i = 0; i < numElements; i++) {
        if (observer != null) {
            parsed(0, "elements[" + i + "]:");
            changeIndent(1);
        }

        NameValuePair element = parseElement();
        annotation.add(element);

        if (observer != null) {
            changeIndent(-1);
        }
    }

    annotation.setImmutable();
    return annotation;
}
 
Example 2
Source File: AnnotationParser.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a single annotation.
 *
 * @param visibility {@code non-null;} visibility of the parsed annotation
 * @return {@code non-null;} the parsed annotation
 */
private Annotation parseAnnotation(AnnotationVisibility visibility)
        throws IOException {
    requireLength(4);

    int typeIndex = input.readUnsignedShort();
    int numElements = input.readUnsignedShort();
    CstString typeString = (CstString) pool.get(typeIndex);
    CstType type = new CstType(Type.intern(typeString.getString()));

    if (observer != null) {
        parsed(2, "type: " + type.toHuman());
        parsed(2, "num_elements: " + numElements);
    }

    Annotation annotation = new Annotation(type, visibility);

    for (int i = 0; i < numElements; i++) {
        if (observer != null) {
            parsed(0, "elements[" + i + "]:");
            changeIndent(1);
        }

        NameValuePair element = parseElement();
        annotation.add(element);

        if (observer != null) {
            changeIndent(-1);
        }
    }

    annotation.setImmutable();
    return annotation;
}
 
Example 3
Source File: AnnotationParser.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a single annotation.
 *
 * @param visibility {@code non-null;} visibility of the parsed annotation
 * @return {@code non-null;} the parsed annotation
 */
private Annotation parseAnnotation(AnnotationVisibility visibility)
        throws IOException {
    requireLength(4);

    int typeIndex = input.readUnsignedShort();
    int numElements = input.readUnsignedShort();
    CstString typeString = (CstString) pool.get(typeIndex);
    CstType type = new CstType(Type.intern(typeString.getString()));

    if (observer != null) {
        parsed(2, "type: " + type.toHuman());
        parsed(2, "num_elements: " + numElements);
    }

    Annotation annotation = new Annotation(type, visibility);

    for (int i = 0; i < numElements; i++) {
        if (observer != null) {
            parsed(0, "elements[" + i + "]:");
            changeIndent(1);
        }

        NameValuePair element = parseElement();
        annotation.add(element);

        if (observer != null) {
            changeIndent(-1);
        }
    }

    annotation.setImmutable();
    return annotation;
}
 
Example 4
Source File: AnnotationParser.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a single annotation.
 *
 * @param visibility {@code non-null;} visibility of the parsed annotation
 * @return {@code non-null;} the parsed annotation
 */
private Annotation parseAnnotation(AnnotationVisibility visibility)
        throws IOException {
    requireLength(4);

    int typeIndex = input.readUnsignedShort();
    int numElements = input.readUnsignedShort();
    CstString typeString = (CstString) pool.get(typeIndex);
    CstType type = new CstType(Type.intern(typeString.getString()));

    if (observer != null) {
        parsed(2, "type: " + type.toHuman());
        parsed(2, "num_elements: " + numElements);
    }

    Annotation annotation = new Annotation(type, visibility);

    for (int i = 0; i < numElements; i++) {
        if (observer != null) {
            parsed(0, "elements[" + i + "]:");
            changeIndent(1);
        }

        NameValuePair element = parseElement();
        annotation.add(element);

        if (observer != null) {
            changeIndent(-1);
        }
    }

    annotation.setImmutable();
    return annotation;
}
 
Example 5
Source File: LocalVariableList.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the variable's type descriptor. This is a convenient shorthand
 * for {@code Type.intern(getDescriptor().getString())}.
 *
 * @return {@code non-null;} the variable's type
 */
public Type getType() {
    return Type.intern(descriptor.getString());
}
 
Example 6
Source File: CstNat.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the field type corresponding to this instance's descriptor.
 * This method is only valid to call if the descriptor in fact describes
 * a field (and not a method).
 *
 * @return {@code non-null;} the field type
 */
public Type getFieldType() {
    return Type.intern(descriptor.getString());
}
 
Example 7
Source File: LocalVariableList.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the variable's type descriptor. This is a convenient shorthand
 * for {@code Type.intern(getDescriptor().getString())}.
 *
 * @return {@code non-null;} the variable's type
 */
public Type getType() {
    return Type.intern(descriptor.getString());
}
 
Example 8
Source File: CstNat.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the field type corresponding to this instance's descriptor.
 * This method is only valid to call if the descriptor in fact describes
 * a field (and not a method).
 *
 * @return {@code non-null;} the field type
 */
public Type getFieldType() {
    return Type.intern(descriptor.getString());
}
 
Example 9
Source File: LocalVariableList.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the variable's type descriptor. This is a convenient shorthand
 * for {@code Type.intern(getDescriptor().getString())}.
 *
 * @return {@code non-null;} the variable's type
 */
public Type getType() {
    return Type.intern(descriptor.getString());
}
 
Example 10
Source File: CstNat.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the field type corresponding to this instance's descriptor.
 * This method is only valid to call if the descriptor in fact describes
 * a field (and not a method).
 *
 * @return {@code non-null;} the field type
 */
public Type getFieldType() {
    return Type.intern(descriptor.getString());
}
 
Example 11
Source File: LocalVariableList.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the variable's type descriptor. This is a convenient shorthand
 * for {@code Type.intern(getDescriptor().getString())}.
 *
 * @return {@code non-null;} the variable's type
 */
public Type getType() {
    return Type.intern(descriptor.getString());
}
 
Example 12
Source File: CstNat.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the field type corresponding to this instance's descriptor.
 * This method is only valid to call if the descriptor in fact describes
 * a field (and not a method).
 *
 * @return {@code non-null;} the field type
 */
public Type getFieldType() {
    return Type.intern(descriptor.getString());
}