private void attachAnnotations(NdMethod method, IBinaryAnnotation[] annotations) { if (annotations != null) { method.allocateAnnotations(annotations.length); for (IBinaryAnnotation next : annotations) { NdAnnotation annotation = method.createAnnotation(); initAnnotation(annotation, next); } } }
public void allocateAnnotations(int length) { if (length > 0) { createAnnotationData().allocateAnnotations(length); } }
/** * Returns the unique 0-based position of the method within the class it was * declared in. */ public int getDeclarationPosition() { return DECLARATION_POSITION.get(getNd(), getAddress()); }
public void setTagBits(long bits) { if (bits != 0) { createAnnotationData().setTagBits(bits); } else { NdMethodAnnotationData annotationData = getAnnotationData(); if (annotationData != null) { annotationData.setTagBits(bits); } } }
method.allocateTypeAnnotations(typeAnnotations.length); for (IBinaryTypeAnnotation typeAnnotation : typeAnnotations) { NdTypeAnnotation annotation = method.createTypeAnnotation(); int estimatedParameterCount = Math.max(Math.max(Math.max(numArgumentsInGenericSignature, namedParameterCount), annotatedParametersCount), parameterFieldDescriptors.size()); method.allocateParameters(estimatedParameterCount); NdMethodParameter parameter = method.createNewParameter(); parameter.setType(createTypeSignature(nextFieldSignature, nextFieldDescriptor)); method.setReturnType(createTypeSignature(signature, nextFieldDescriptor)); method.allocateExceptions(exceptionTypes.length); int throwsIdx = 0; if (hasExceptionsInSignature) { while (hasAnotherException(signature)) { signature.start++; method.createException(createTypeSignature(signature, JavaNames.binaryNameToFieldDescriptor(exceptionTypes[throwsIdx]))); throwsIdx++; char[] fieldDescriptor = JavaNames.binaryNameToFieldDescriptor(exceptionTypes[throwsIdx]); SignatureWrapper convertedWrapper = new SignatureWrapper(fieldDescriptor); method.createException(createTypeSignature(convertedWrapper, JavaNames.binaryNameToFieldDescriptor(exceptionTypes[throwsIdx]))); method.setDefaultValue(createConstantFromMixedType(defaultValue));
/** * Returns the list of methods, in declaration order. */ public List<NdMethod> getMethodsInDeclarationOrder() { List<NdMethod> unsorted = getMethods(); NdMethod[] sorted = new NdMethod[unsorted.size()]; for (NdMethod next : unsorted) { int pos = next.getDeclarationPosition(); if (pos < 0 || pos >= sorted.length) { throw getNd().describeProblem() .addProblemAddress(NdMethod.DECLARATION_POSITION, next.getAddress()) .build("Method " + next.getMethodName().getString() + " reports invalid position of " + pos); //$NON-NLS-1$//$NON-NLS-2$ } NdMethod oldMethodAtThisPosition = sorted[pos]; if (oldMethodAtThisPosition != null) { throw getNd().describeProblem() .addProblemAddress(NdMethod.DECLARATION_POSITION, next.getAddress()) .addProblemAddress(NdMethod.DECLARATION_POSITION, oldMethodAtThisPosition.getAddress()) .build("Method " + oldMethodAtThisPosition.getMethodName().getString() //$NON-NLS-1$ + " and method " + next.getMethodName().getString() + " both claim to be at position " //$NON-NLS-1$//$NON-NLS-2$ + pos); } sorted[pos] = next; } return Arrays.asList(sorted); }
method.allocateTypeAnnotations(typeAnnotations.length); for (IBinaryTypeAnnotation typeAnnotation : typeAnnotations) { NdTypeAnnotation annotation = method.createTypeAnnotation(); int estimatedParameterCount = Math.max(Math.max(Math.max(numArgumentsInGenericSignature, namedParameterCount), annotatedParametersCount), parameterFieldDescriptors.size()); method.allocateParameters(estimatedParameterCount); NdMethodParameter parameter = method.createNewParameter(); parameter.setType(createTypeSignature(nextFieldSignature, nextFieldDescriptor)); method.setReturnType(createTypeSignature(signature, nextFieldDescriptor)); method.allocateExceptions(exceptionTypes.length); int throwsIdx = 0; if (hasExceptionsInSignature) { while (hasAnotherException(signature)) { signature.start++; method.createException(createTypeSignature(signature, JavaNames.binaryNameToFieldDescriptor(exceptionTypes[throwsIdx]))); throwsIdx++; char[] fieldDescriptor = JavaNames.binaryNameToFieldDescriptor(exceptionTypes[throwsIdx]); SignatureWrapper convertedWrapper = new SignatureWrapper(fieldDescriptor); method.createException(createTypeSignature(convertedWrapper, JavaNames.binaryNameToFieldDescriptor(exceptionTypes[throwsIdx]))); method.setDefaultValue(createConstantFromMixedType(defaultValue));
/** * Returns the list of methods, in declaration order. */ public List<NdMethod> getMethodsInDeclarationOrder() { List<NdMethod> unsorted = getMethods(); NdMethod[] sorted = new NdMethod[unsorted.size()]; for (NdMethod next : unsorted) { int pos = next.getDeclarationPosition(); if (pos < 0 || pos >= sorted.length) { throw getNd().describeProblem() .addProblemAddress(NdMethod.DECLARATION_POSITION, next.getAddress()) .build("Method " + next.getMethodName().getString() + " reports invalid position of " + pos); //$NON-NLS-1$//$NON-NLS-2$ } NdMethod oldMethodAtThisPosition = sorted[pos]; if (oldMethodAtThisPosition != null) { throw getNd().describeProblem() .addProblemAddress(NdMethod.DECLARATION_POSITION, next.getAddress()) .addProblemAddress(NdMethod.DECLARATION_POSITION, oldMethodAtThisPosition.getAddress()) .build("Method " + oldMethodAtThisPosition.getMethodName().getString() //$NON-NLS-1$ + " and method " + next.getMethodName().getString() + " both claim to be at position " //$NON-NLS-1$//$NON-NLS-2$ + pos); } sorted[pos] = next; } return Arrays.asList(sorted); }
public void setTagBits(long bits) { if (bits != 0) { createAnnotationData().setTagBits(bits); } else { NdMethodAnnotationData annotationData = getAnnotationData(); if (annotationData != null) { annotationData.setTagBits(bits); } } }
/** * Returns the unique 0-based position of the method within the class it was * declared in. */ public int getDeclarationPosition() { return DECLARATION_POSITION.get(getNd(), getAddress()); }
private void attachAnnotations(NdMethod method, IBinaryAnnotation[] annotations) { if (annotations != null) { method.allocateAnnotations(annotations.length); for (IBinaryAnnotation next : annotations) { NdAnnotation annotation = method.createAnnotation(); initAnnotation(annotation, next); } } }
public void allocateTypeAnnotations(int length) { if (length > 0) { createAnnotationData().allocateTypeAnnotations(length); } }
private NdMethodAnnotationData getAnnotationData() { return ANNOTATION_DATA.get(getNd(), getAddress()); }
public void allocateTypeAnnotations(int length) { if (length > 0) { createAnnotationData().allocateTypeAnnotations(length); } }
public void setDeclarationPosition(int position) { DECLARATION_POSITION.put(getNd(), getAddress(), position); }
public void allocateAnnotations(int length) { if (length > 0) { createAnnotationData().allocateAnnotations(length); } }
public NdMethodParameter createNewParameter() { return PARAMETERS.append(getNd(), getAddress()); }
public NdTypeAnnotation createTypeAnnotation() { return createAnnotationData().createTypeAnnotation(); }
public void setDeclarationPosition(int position) { DECLARATION_POSITION.put(getNd(), getAddress(), position); }
public NdTypeAnnotation createTypeAnnotation() { return createAnnotationData().createTypeAnnotation(); }