/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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()); }
/** * 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()); }
/** * 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()); }