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.IConstantPool; 15 import org.eclipse.jdt.core.util.IParameterAnnotation; 16 import org.eclipse.jdt.core.util.IRuntimeVisibleParameterAnnotationsAttribute; 17 18 21 public class RuntimeVisibleParameterAnnotationsAttribute 22 extends ClassFileAttribute 23 implements IRuntimeVisibleParameterAnnotationsAttribute { 24 25 private static final IParameterAnnotation[] NO_ENTRIES = new IParameterAnnotation[0]; 26 private int parametersNumber; 27 private IParameterAnnotation[] parameterAnnotations; 28 29 36 public RuntimeVisibleParameterAnnotationsAttribute( 37 byte[] classFileBytes, 38 IConstantPool constantPool, 39 int offset) 40 throws ClassFormatException { 41 super(classFileBytes, constantPool, offset); 42 final int length = u1At(classFileBytes, 6, offset); 43 this.parametersNumber = length; 44 if (length != 0) { 45 int readOffset = 7; 46 this.parameterAnnotations = new IParameterAnnotation[length]; 47 for (int i = 0; i < length; i++) { 48 ParameterAnnotation parameterAnnotation = new ParameterAnnotation(classFileBytes, constantPool, offset + readOffset); 49 this.parameterAnnotations[i] = parameterAnnotation; 50 readOffset += parameterAnnotation.sizeInBytes(); 51 } 52 } else { 53 this.parameterAnnotations = NO_ENTRIES; 54 } 55 } 56 59 public IParameterAnnotation[] getParameterAnnotations() { 60 return this.parameterAnnotations; 61 } 62 65 public int getParametersNumber() { 66 return this.parametersNumber; 67 } 68 } 69 | Popular Tags |