com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations Java Examples

The following examples show how to use com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations. 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: AttributeTranslator.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the parameter annotations out of a given method. This
 * combines both visible and invisible annotations into a single
 * result set.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the list of annotation sets, which may be
 * empty
 */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible =
        (AttRuntimeVisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible =
        (AttRuntimeInvisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);

    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }

    if (invisible == null) {
        return visible.getParameterAnnotations();
    }

    // Both are non-null, so combine them.

    return AnnotationsList.combine(visible.getParameterAnnotations(),
            invisible.getParameterAnnotations());
}
 
Example #2
Source File: StdAttributeFactory.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code RuntimeVisibleParameterAnnotations} attribute.
 */
private Attribute runtimeVisibleParameterAnnotations(DirectClassFile cf,
        int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }

    AnnotationParser ap =
        new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list =
        ap.parseParameterAttribute(AnnotationVisibility.RUNTIME);

    return new AttRuntimeVisibleParameterAnnotations(list, length);
}
 
Example #3
Source File: AttributeTranslator.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the parameter annotations out of a given method. This
 * combines both visible and invisible annotations into a single
 * result set.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the list of annotation sets, which may be
 * empty
 */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible =
        (AttRuntimeVisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible =
        (AttRuntimeInvisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);

    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }

    if (invisible == null) {
        return visible.getParameterAnnotations();
    }

    // Both are non-null, so combine them.

    return AnnotationsList.combine(visible.getParameterAnnotations(),
            invisible.getParameterAnnotations());
}
 
Example #4
Source File: StdAttributeFactory.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code RuntimeVisibleParameterAnnotations} attribute.
 */
private Attribute runtimeVisibleParameterAnnotations(DirectClassFile cf,
        int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }

    AnnotationParser ap =
        new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list =
        ap.parseParameterAttribute(AnnotationVisibility.RUNTIME);

    return new AttRuntimeVisibleParameterAnnotations(list, length);
}
 
Example #5
Source File: AttributeTranslator.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the parameter annotations out of a given method. This
 * combines both visible and invisible annotations into a single
 * result set.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the list of annotation sets, which may be
 * empty
 */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible =
        (AttRuntimeVisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible =
        (AttRuntimeInvisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);

    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }

    if (invisible == null) {
        return visible.getParameterAnnotations();
    }

    // Both are non-null, so combine them.

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

    AnnotationParser ap =
        new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list =
        ap.parseParameterAttribute(AnnotationVisibility.RUNTIME);

    return new AttRuntimeVisibleParameterAnnotations(list, length);
}
 
Example #7
Source File: AttributeTranslator.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the parameter annotations out of a given method. This
 * combines both visible and invisible annotations into a single
 * result set.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the list of annotation sets, which may be
 * empty
 */
public static AnnotationsList getParameterAnnotations(Method method) {
    AttributeList attribs = method.getAttributes();
    AttRuntimeVisibleParameterAnnotations visible =
        (AttRuntimeVisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeVisibleParameterAnnotations.ATTRIBUTE_NAME);
    AttRuntimeInvisibleParameterAnnotations invisible =
        (AttRuntimeInvisibleParameterAnnotations)
        attribs.findFirst(
                AttRuntimeInvisibleParameterAnnotations.ATTRIBUTE_NAME);

    if (visible == null) {
        if (invisible == null) {
            return AnnotationsList.EMPTY;
        }
        return invisible.getParameterAnnotations();
    }

    if (invisible == null) {
        return visible.getParameterAnnotations();
    }

    // Both are non-null, so combine them.

    return AnnotationsList.combine(visible.getParameterAnnotations(),
            invisible.getParameterAnnotations());
}
 
Example #8
Source File: StdAttributeFactory.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a {@code RuntimeVisibleParameterAnnotations} attribute.
 */
private Attribute runtimeVisibleParameterAnnotations(DirectClassFile cf,
        int offset, int length, ParseObserver observer) {
    if (length < 2) {
        throwSeverelyTruncated();
    }

    AnnotationParser ap =
        new AnnotationParser(cf, offset, length, observer);
    AnnotationsList list =
        ap.parseParameterAttribute(AnnotationVisibility.RUNTIME);

    return new AttRuntimeVisibleParameterAnnotations(list, length);
}