com.android.dx.rop.annotation.Annotations.combine()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(14.3k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中com.android.dx.rop.annotation.Annotations.combine()方法的一些代码示例,展示了Annotations.combine()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotations.combine()方法的具体详情如下:
包路径:com.android.dx.rop.annotation.Annotations
类名称:Annotations
方法名:combine

Annotations.combine介绍

[英]Constructs an immutable instance which is the combination of the given instance with the given additional annotation. The latter's type must not already appear in the former.
[中]构造一个不可变实例,该实例是给定实例与给定附加注释的组合。后者的类型不能已经出现在前者中。

代码示例

代码示例来源:origin: nikita36078/J2ME-Loader

/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
  Annotations result = getAnnotations0(attribs);
  Annotation signature = getSignature(attribs);
  Annotation sourceDebugExtension = getSourceDebugExtension(attribs);
  if (signature != null) {
    result = Annotations.combine(result, signature);
  }
  if (sourceDebugExtension != null) {
    result = Annotations.combine(result, sourceDebugExtension);
  }
  return result;
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
  Annotations result = getAnnotations0(attribs);
  Annotation signature = getSignature(attribs);
  Annotation sourceDebugExtension = getSourceDebugExtension(attribs);
  if (signature != null) {
    result = Annotations.combine(result, signature);
  }
  if (sourceDebugExtension != null) {
    result = Annotations.combine(result, sourceDebugExtension);
  }
  return result;
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 * 
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
  Annotations result = getAnnotations0(attribs);
  Annotation signature = getSignature(attribs);
  if (signature != null) {
    result = Annotations.combine(result, signature);
  }
  return result;
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
  Annotations result = getAnnotations0(attribs);
  Annotation signature = getSignature(attribs);
  if (signature != null) {
    result = Annotations.combine(result, signature);
  }
  return result;
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
  Annotations result = getAnnotations0(attribs);
  Annotation signature = getSignature(attribs);
  if (signature != null) {
    result = Annotations.combine(result, signature);
  }
  return result;
}

代码示例来源:origin: com.android/dx

/**
 * Gets the annotations out of a given {@link AttributeList}. This
 * combines both visible and invisible annotations into a single
 * result set and also adds in a system annotation for the
 * {@code Signature} attribute if present.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getAnnotations(AttributeList attribs) {
  Annotations result = getAnnotations0(attribs);
  Annotation signature = getSignature(attribs);
  if (signature != null) {
    result = Annotations.combine(result, signature);
  }
  return result;
}

代码示例来源:origin: nikita36078/J2ME-Loader

/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
  Annotations result = getAnnotations(method.getAttributes());
  TypeList exceptions = getExceptions(method);
  if (exceptions.size() != 0) {
    Annotation throwsAnnotation =
      AnnotationUtils.makeThrows(exceptions);
    result = Annotations.combine(result, throwsAnnotation);
  }
  return result;
}

代码示例来源:origin: com.google.android.tools/dx

/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
  Annotations result = getAnnotations(method.getAttributes());
  TypeList exceptions = getExceptions(method);
  if (exceptions.size() != 0) {
    Annotation throwsAnnotation =
      AnnotationUtils.makeThrows(exceptions);
    result = Annotations.combine(result, throwsAnnotation);
  }
  return result;
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 * 
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
  Annotations result = getAnnotations(method.getAttributes());
  TypeList exceptions = getExceptions(method);
  if (exceptions.size() != 0) {
    Annotation throwsAnnotation = 
      AnnotationUtils.makeThrows(exceptions);
    result = Annotations.combine(result, throwsAnnotation);
  }
  return result;
}

代码示例来源:origin: com.android/dx

/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
  Annotations result = getAnnotations(method.getAttributes());
  TypeList exceptions = getExceptions(method);
  if (exceptions.size() != 0) {
    Annotation throwsAnnotation =
      AnnotationUtils.makeThrows(exceptions);
    result = Annotations.combine(result, throwsAnnotation);
  }
  return result;
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
  Annotations result = getAnnotations(method.getAttributes());
  TypeList exceptions = getExceptions(method);
  if (exceptions.size() != 0) {
    Annotation throwsAnnotation =
      AnnotationUtils.makeThrows(exceptions);
    result = Annotations.combine(result, throwsAnnotation);
  }
  return result;
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Gets the annotations out of a given method, similar to {@link
 * #getAnnotations}, also including an annotation for the translation
 * of the method-specific attribute {@code Exceptions}.
 *
 * @param method {@code non-null;} the method in question
 * @return {@code non-null;} the set of annotations, which may be empty
 */
public static Annotations getMethodAnnotations(Method method) {
  Annotations result = getAnnotations(method.getAttributes());
  TypeList exceptions = getExceptions(method);
  if (exceptions.size() != 0) {
    Annotation throwsAnnotation =
      AnnotationUtils.makeThrows(exceptions);
    result = Annotations.combine(result, throwsAnnotation);
  }
  return result;
}

代码示例来源:origin: nikita36078/J2ME-Loader

/**
 * Constructs an immutable instance which is the combination of
 * the two given instances. The two instances must each have the
 * same number of elements, and each pair of elements must contain
 * disjoint sets of types.
 *
 * @param list1 {@code non-null;} an instance
 * @param list2 {@code non-null;} the other instance
 * @return {@code non-null;} the combination
 */
public static AnnotationsList combine(AnnotationsList list1,
    AnnotationsList list2) {
  int size = list1.size();
  if (size != list2.size()) {
    throw new IllegalArgumentException("list1.size() != list2.size()");
  }
  AnnotationsList result = new AnnotationsList(size);
  for (int i = 0; i < size; i++) {
    Annotations a1 = list1.get(i);
    Annotations a2 = list2.get(i);
    result.set(i, Annotations.combine(a1, a2));
  }
  result.setImmutable();
  return result;
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Constructs an immutable instance which is the combination of
 * the two given instances. The two instances must each have the
 * same number of elements, and each pair of elements must contain
 * disjoint sets of types.
 *
 * @param list1 {@code non-null;} an instance
 * @param list2 {@code non-null;} the other instance
 * @return {@code non-null;} the combination
 */
public static AnnotationsList combine(AnnotationsList list1,
    AnnotationsList list2) {
  int size = list1.size();
  if (size != list2.size()) {
    throw new IllegalArgumentException("list1.size() != list2.size()");
  }
  AnnotationsList result = new AnnotationsList(size);
  for (int i = 0; i < size; i++) {
    Annotations a1 = list1.get(i);
    Annotations a2 = list2.get(i);
    result.set(i, Annotations.combine(a1, a2));
  }
  result.setImmutable();
  return result;
}

代码示例来源:origin: gdpancheng/LoonAndroid3

/**
 * Constructs an immutable instance which is the combination of
 * the two given instances. The two instances must each have the
 * same number of elements, and each pair of elements must contain
 * disjoint sets of types.
 *
 * @param list1 {@code non-null;} an instance
 * @param list2 {@code non-null;} the other instance
 * @return {@code non-null;} the combination
 */
public static AnnotationsList combine(AnnotationsList list1,
    AnnotationsList list2) {
  int size = list1.size();
  if (size != list2.size()) {
    throw new IllegalArgumentException("list1.size() != list2.size()");
  }
  AnnotationsList result = new AnnotationsList(size);
  for (int i = 0; i < size; i++) {
    Annotations a1 = list1.get(i);
    Annotations a2 = list2.get(i);
    result.set(i, Annotations.combine(a1, a2));
  }
  result.setImmutable();
  return result;
}

代码示例来源:origin: com.android/dx

/**
 * Constructs an immutable instance which is the combination of
 * the two given instances. The two instances must each have the
 * same number of elements, and each pair of elements must contain
 * disjoint sets of types.
 *
 * @param list1 {@code non-null;} an instance
 * @param list2 {@code non-null;} the other instance
 * @return {@code non-null;} the combination
 */
public static AnnotationsList combine(AnnotationsList list1,
    AnnotationsList list2) {
  int size = list1.size();
  if (size != list2.size()) {
    throw new IllegalArgumentException("list1.size() != list2.size()");
  }
  AnnotationsList result = new AnnotationsList(size);
  for (int i = 0; i < size; i++) {
    Annotations a1 = list1.get(i);
    Annotations a2 = list2.get(i);
    result.set(i, Annotations.combine(a1, a2));
  }
  result.setImmutable();
  return result;
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Constructs an immutable instance which is the combination of
 * the two given instances. The two instances must each have the
 * same number of elements, and each pair of elements must contain
 * disjoint sets of types.
 *
 * @param list1 {@code non-null;} an instance
 * @param list2 {@code non-null;} the other instance
 * @return {@code non-null;} the combination
 */
public static AnnotationsList combine(AnnotationsList list1,
    AnnotationsList list2) {
  int size = list1.size();
  if (size != list2.size()) {
    throw new IllegalArgumentException("list1.size() != list2.size()");
  }
  AnnotationsList result = new AnnotationsList(size);
  for (int i = 0; i < size; i++) {
    Annotations a1 = list1.get(i);
    Annotations a2 = list2.get(i);
    result.set(i, Annotations.combine(a1, a2));
  }
  result.setImmutable();
  return result;
}

代码示例来源:origin: com.android.tools.build/builder

/**
 * Helper method for {@link #getAnnotations} which just gets the
 * existing annotations, per se.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
private static Annotations getAnnotations0(AttributeList attribs) {
  AttRuntimeVisibleAnnotations visible =
    (AttRuntimeVisibleAnnotations)
    attribs.findFirst(AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
  AttRuntimeInvisibleAnnotations invisible =
    (AttRuntimeInvisibleAnnotations)
    attribs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);
  if (visible == null) {
    if (invisible == null) {
      return Annotations.EMPTY;
    }
    return invisible.getAnnotations();
  }
  if (invisible == null) {
    return visible.getAnnotations();
  }
  // Both are non-null, so combine them.
  return Annotations.combine(visible.getAnnotations(),
      invisible.getAnnotations());
}

代码示例来源:origin: com.android/dx

/**
 * Helper method for {@link #getAnnotations} which just gets the
 * existing annotations, per se.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
private static Annotations getAnnotations0(AttributeList attribs) {
  AttRuntimeVisibleAnnotations visible =
    (AttRuntimeVisibleAnnotations)
    attribs.findFirst(AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
  AttRuntimeInvisibleAnnotations invisible =
    (AttRuntimeInvisibleAnnotations)
    attribs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);
  if (visible == null) {
    if (invisible == null) {
      return Annotations.EMPTY;
    }
    return invisible.getAnnotations();
  }
  if (invisible == null) {
    return visible.getAnnotations();
  }
  // Both are non-null, so combine them.
  return Annotations.combine(visible.getAnnotations(),
      invisible.getAnnotations());
}

代码示例来源:origin: com.jakewharton.android.repackaged/dalvik-dx

/**
 * Helper method for {@link #getAnnotations} which just gets the
 * existing annotations, per se.
 *
 * @param attribs {@code non-null;} the attributes list to search in
 * @return {@code non-null;} the set of annotations, which may be empty
 */
private static Annotations getAnnotations0(AttributeList attribs) {
  AttRuntimeVisibleAnnotations visible =
    (AttRuntimeVisibleAnnotations)
    attribs.findFirst(AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
  AttRuntimeInvisibleAnnotations invisible =
    (AttRuntimeInvisibleAnnotations)
    attribs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);
  if (visible == null) {
    if (invisible == null) {
      return Annotations.EMPTY;
    }
    return invisible.getAnnotations();
  }
  if (invisible == null) {
    return visible.getAnnotations();
  }
  // Both are non-null, so combine them.
  return Annotations.combine(visible.getAnnotations(),
      invisible.getAnnotations());
}

相关文章