1 11 package org.eclipse.jdt.internal.core.util; 12 13 import org.eclipse.jdt.core.util.ClassFormatException; 14 import org.eclipse.jdt.core.util.IAnnotation; 15 import org.eclipse.jdt.core.util.IConstantPool; 16 import org.eclipse.jdt.core.util.IRuntimeInvisibleAnnotationsAttribute; 17 18 21 public class RuntimeInvisibleAnnotationsAttribute 22 extends ClassFileAttribute 23 implements IRuntimeInvisibleAnnotationsAttribute { 24 25 private static final IAnnotation[] NO_ENTRIES = new IAnnotation[0]; 26 private int annotationsNumber; 27 private IAnnotation[] annotations; 28 29 36 public RuntimeInvisibleAnnotationsAttribute( 37 byte[] classFileBytes, 38 IConstantPool constantPool, 39 int offset) 40 throws ClassFormatException { 41 super(classFileBytes, constantPool, offset); 42 final int length = u2At(classFileBytes, 6, offset); 43 this.annotationsNumber = length; 44 if (length != 0) { 45 int readOffset = 8; 46 this.annotations = new IAnnotation[length]; 47 for (int i = 0; i < length; i++) { 48 Annotation annotation = new Annotation(classFileBytes, constantPool, offset + readOffset); 49 this.annotations[i] = annotation; 50 readOffset += annotation.sizeInBytes(); 51 } 52 } else { 53 this.annotations = NO_ENTRIES; 54 } 55 } 56 57 60 public IAnnotation[] getAnnotations() { 61 return this.annotations; 62 } 63 66 public int getAnnotationsNumber() { 67 return this.annotationsNumber; 68 } 69 } 70 | Popular Tags |