/** * Return annotations entries from "RuntimeVisibleAnnotations" attribute on * the class, if there is any. * * @return An array of entries or {@code null} */ public AnnotationEntry[] getAnnotationEntries() { if (runtimeVisibleAnnotations != null) { return runtimeVisibleAnnotations.getAnnotationEntries(); } return null; }
/** * @param annotation_type the subclass type of the annotation * @param name_index Index pointing to the name <em>Code</em> * @param length Content length in bytes * @param annotation_table the actual annotations * @param constant_pool Array of constants */ public Annotations(byte annotation_type, int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) { super(annotation_type, name_index, length, constant_pool); setAnnotationTable(annotation_table); }
if (attribute instanceof Annotations) { Annotations annotations = (Annotations) attribute; if (annotations.isRuntimeVisible()) { AnnotationEntry[] entries = annotations.getAnnotationEntries(); List<AnnotationEntry> newEntries = new ArrayList<AnnotationEntry>(); for (AnnotationEntry entry : entries) { annotations.setAnnotationTable(newEntries);
@Override public final void dump(DataOutputStream dos) throws IOException { super.dump(dos); writeAnnotations(dos); } }
"RuntimeVisibleAnnotations attribute is not allowed more than once in a class file"); runtimeVisibleAnnotations = new Annotations(dataInputStream, constant_pool); } else {
@Override public final void dump(DataOutputStream dos) throws IOException { super.dump(dos); writeAnnotations(dos); } }
public AnnotationEntry[] getAnnotationEntries() { if (annotationsOutOfDate) { // Find attributes that contain annotation data List<AnnotationEntry> accumulatedAnnotations = new ArrayList<>(); for (int i = 0; i < attributes.length; i++) { Attribute attribute = attributes[i]; if (attribute instanceof Annotations) { Annotations runtimeAnnotations = (Annotations)attribute; for(int j = 0; j < runtimeAnnotations.getAnnotationEntries().length; j++) accumulatedAnnotations.add(runtimeAnnotations.getAnnotationEntries()[j]); } } annotations = accumulatedAnnotations.toArray(new AnnotationEntry[accumulatedAnnotations.size()]); annotationsOutOfDate = false; } return annotations; }
/** * @param annotation_type the subclass type of the annotation * @param name_index Index pointing to the name <em>Code</em> * @param length Content length in bytes * @param annotation_table the actual annotations * @param constant_pool Array of constants */ public Annotations(byte annotation_type, int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) { super(annotation_type, name_index, length, constant_pool); setAnnotationTable(annotation_table); }
@Override public final void dump(DataOutputStream dos) throws IOException { super.dump(dos); writeAnnotations(dos); } }
public AnnotationEntry[] getAnnotationEntries() { if (annotationsOutOfDate) { // Find attributes that contain annotation data Attribute[] attrs = getAttributes(); List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>(); for (int i = 0; i < attrs.length; i++) { Attribute attribute = attrs[i]; if (attribute instanceof Annotations) { Annotations runtimeAnnotations = (Annotations)attribute; for(int j = 0; j < runtimeAnnotations.getAnnotationEntries().length; j++) accumulatedAnnotations.add(runtimeAnnotations.getAnnotationEntries()[j]); } } annotations = accumulatedAnnotations.toArray(new AnnotationEntry[accumulatedAnnotations.size()]); annotationsOutOfDate = false; } return annotations; }
/** * @param annotation_type the subclass type of the annotation * @param name_index Index pointing to the name <em>Code</em> * @param length Content length in bytes * @param annotation_table the actual annotations * @param constant_pool Array of constants */ public Annotations(byte annotation_type, int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) { super(annotation_type, name_index, length, constant_pool); setAnnotationTable(annotation_table); }
@Override public final void dump(DataOutputStream dos) throws IOException { super.dump(dos); writeAnnotations(dos); } }
public AnnotationEntry[] getAnnotationEntries() { if (annotationsOutOfDate) { // Find attributes that contain annotation data Attribute[] attrs = getAttributes(); List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>(); for (int i = 0; i < attrs.length; i++) { Attribute attribute = attrs[i]; if (attribute instanceof Annotations) { Annotations runtimeAnnotations = (Annotations)attribute; for(int j = 0; j < runtimeAnnotations.getAnnotationEntries().length; j++) accumulatedAnnotations.add(runtimeAnnotations.getAnnotationEntries()[j]); } } annotations = accumulatedAnnotations.toArray(new AnnotationEntry[accumulatedAnnotations.size()]); annotationsOutOfDate = false; } return annotations; }
/** * @param name_index Index pointing to the name <em>Code</em> * @param length Content length in bytes * @param annotation_table the actual annotations * @param constant_pool Array of constants */ public Annotations(int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) { super(name_index, length, constant_pool); setAnnotationTable(annotation_table); }
public AnnotationEntry[] getAnnotationEntries() { if (annotationsOutOfDate) { // Find attributes that contain annotation data Attribute[] attrs = getAttributes(); List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>(); for (int i = 0; i < attrs.length; i++) { Attribute attribute = attrs[i]; if (attribute instanceof Annotations) { Annotations runtimeAnnotations = (Annotations)attribute; for(int j = 0; j < runtimeAnnotations.getAnnotationEntries().length; j++) accumulatedAnnotations.add(runtimeAnnotations.getAnnotationEntries()[j]); } } annotations = accumulatedAnnotations.toArray(new AnnotationEntry[accumulatedAnnotations.size()]); annotationsOutOfDate = false; } return annotations; }