private char[][] getExceptionTypeNames(NdMethod ndMethod) { List<NdMethodException> exceptions = ndMethod.getExceptions(); // Although the JavaDoc for IBinaryMethod says that the exception list will be null if empty, // the implementation in MethodInfo returns an empty array rather than null. We copy the // same behavior here in case something is relying on it. Uncomment the following if the "null" // version is deemed correct. // if (exceptions.isEmpty()) { // return null; // } char[][] result = new char[exceptions.size()][]; for (int idx = 0; idx < exceptions.size(); idx++) { NdMethodException next = exceptions.get(idx); result[idx] = next.getExceptionType().getRawType().getBinaryName(); } return result; }
private char[][] getExceptionTypeNames(NdMethod ndMethod) { List<NdMethodException> exceptions = ndMethod.getExceptions(); // Although the JavaDoc for IBinaryMethod says that the exception list will be null if empty, // the implementation in MethodInfo returns an empty array rather than null. We copy the // same behavior here in case something is relying on it. Uncomment the following if the "null" // version is deemed correct. // if (exceptions.isEmpty()) { // return null; // } char[][] result = new char[exceptions.size()][]; for (int idx = 0; idx < exceptions.size(); idx++) { NdMethodException next = exceptions.get(idx); result[idx] = next.getExceptionType().getRawType().getBinaryName(); } return result; }
@Override public char[][] getInterfaceNames() { try (IReader rl = this.typeRef.lock()) { NdType type = this.typeRef.get(); if (type != null) { List<NdTypeInterface> interfaces = type.getInterfaces(); if (interfaces.isEmpty()) { return null; } char[][] result = new char[interfaces.size()][]; for (int idx = 0; idx < interfaces.size(); idx++) { NdTypeSignature nextInterface = interfaces.get(idx).getInterface(); result[idx] = nextInterface.getRawType().getBinaryName(); } return result; } else { return null; } } }
@Override public char[][] getInterfaceNames() { try (IReader rl = this.typeRef.lock()) { NdType type = this.typeRef.get(); if (type != null) { List<NdTypeInterface> interfaces = type.getInterfaces(); if (interfaces.isEmpty()) { return null; } char[][] result = new char[interfaces.size()][]; for (int idx = 0; idx < interfaces.size(); idx++) { NdTypeSignature nextInterface = interfaces.get(idx).getInterface(); result[idx] = nextInterface.getRawType().getBinaryName(); } return result; } else { return null; } } }
private static Object unpackValue(NdConstant value) { if (value == null) { return null; } if (value instanceof NdConstantAnnotation) { NdConstantAnnotation annotation = (NdConstantAnnotation) value; return createBinaryAnnotation(annotation.getValue()); } if (value instanceof NdConstantArray) { NdConstantArray array = (NdConstantArray) value; List<NdConstant> arrayContents = array.getValue(); Object[] result = new Object[arrayContents.size()]; for (int idx = 0; idx < arrayContents.size(); idx++) { result[idx] = unpackValue(arrayContents.get(idx)); } return result; } if (value instanceof NdConstantEnum) { NdConstantEnum ndConstantEnum = (NdConstantEnum) value; NdTypeSignature signature = ndConstantEnum.getType(); return new EnumConstantSignature(signature.getRawType().getBinaryName(), ndConstantEnum.getValue()); } if (value instanceof NdConstantClass) { NdConstantClass constant = (NdConstantClass) value; return new ClassSignature(constant.getValue().getRawType().getBinaryName()); } return value.getConstant(); }
private static Object unpackValue(NdConstant value) { if (value == null) { return null; } if (value instanceof NdConstantAnnotation) { NdConstantAnnotation annotation = (NdConstantAnnotation) value; return createBinaryAnnotation(annotation.getValue()); } if (value instanceof NdConstantArray) { NdConstantArray array = (NdConstantArray) value; List<NdConstant> arrayContents = array.getValue(); Object[] result = new Object[arrayContents.size()]; for (int idx = 0; idx < arrayContents.size(); idx++) { result[idx] = unpackValue(arrayContents.get(idx)); } return result; } if (value instanceof NdConstantEnum) { NdConstantEnum ndConstantEnum = (NdConstantEnum) value; NdTypeSignature signature = ndConstantEnum.getType(); return new EnumConstantSignature(signature.getRawType().getBinaryName(), ndConstantEnum.getValue()); } if (value instanceof NdConstantClass) { NdConstantClass constant = (NdConstantClass) value; return new ClassSignature(constant.getValue().getRawType().getBinaryName()); } return value.getConstant(); }
private static HierarchyBinaryType createBinaryTypeFrom(NdType type) { char[] enclosingTypeName = null; NdTypeSignature enclosingType = type.getDeclaringType(); if (enclosingType != null) { enclosingTypeName = enclosingType.getRawType().getBinaryName(); } char[][] typeParameters = type.getTypeParameterSignatures(); NdTypeId typeId = type.getTypeId(); HierarchyBinaryType result = new HierarchyBinaryType(type.getModifiers(), typeId.getBinaryName(), type.getSourceName(), enclosingTypeName, typeParameters.length == 0 ? null : typeParameters); NdTypeSignature superClass = type.getSuperclass(); if (superClass != null) { result.recordSuperclass(superClass.getRawType().getBinaryName()); } for (NdTypeInterface interf : type.getInterfaces()) { result.recordInterface(interf.getInterface().getRawType().getBinaryName()); } return result; }
private static HierarchyBinaryType createBinaryTypeFrom(NdType type) { char[] enclosingTypeName = null; NdTypeSignature enclosingType = type.getDeclaringType(); if (enclosingType != null) { enclosingTypeName = enclosingType.getRawType().getBinaryName(); } char[][] typeParameters = type.getTypeParameterSignatures(); NdTypeId typeId = type.getTypeId(); HierarchyBinaryType result = new HierarchyBinaryType(type.getModifiers(), typeId.getBinaryName(), type.getSourceName(), enclosingTypeName, typeParameters.length == 0 ? null : typeParameters); NdTypeSignature superClass = type.getSuperclass(); if (superClass != null) { result.recordSuperclass(superClass.getRawType().getBinaryName()); } for (NdTypeInterface interf : type.getInterfaces()) { result.recordInterface(interf.getInterface().getRawType().getBinaryName()); } return result; }
public static IBinaryAnnotation createBinaryAnnotation(NdAnnotation ndAnnotation) { List<NdAnnotationValuePair> elementValuePairs = ndAnnotation.getElementValuePairs(); final IBinaryElementValuePair[] resultingPair = new IBinaryElementValuePair[elementValuePairs.size()]; for (int idx = 0; idx < elementValuePairs.size(); idx++) { NdAnnotationValuePair next = elementValuePairs.get(idx); resultingPair[idx] = new ElementValuePairInfo(next.getName().getChars(), unpackValue(next.getValue())); } final char[] binaryName = JavaNames.fieldDescriptorToBinaryName( ndAnnotation.getType().getRawType().getFieldDescriptor().getChars()); return new IBinaryAnnotation() { @Override public char[] getTypeName() { return binaryName; } @Override public IBinaryElementValuePair[] getElementValuePairs() { return resultingPair; } @Override public String toString() { return BinaryTypeFormatter.annotationToString(this); } }; }
public static IBinaryAnnotation createBinaryAnnotation(NdAnnotation ndAnnotation) { List<NdAnnotationValuePair> elementValuePairs = ndAnnotation.getElementValuePairs(); final IBinaryElementValuePair[] resultingPair = new IBinaryElementValuePair[elementValuePairs.size()]; for (int idx = 0; idx < elementValuePairs.size(); idx++) { NdAnnotationValuePair next = elementValuePairs.get(idx); resultingPair[idx] = new ElementValuePairInfo(next.getName().getChars(), unpackValue(next.getValue())); } final char[] binaryName = JavaNames.fieldDescriptorToBinaryName( ndAnnotation.getType().getRawType().getFieldDescriptor().getChars()); return new IBinaryAnnotation() { @Override public char[] getTypeName() { return binaryName; } @Override public IBinaryElementValuePair[] getElementValuePairs() { return resultingPair; } @Override public String toString() { return BinaryTypeFormatter.annotationToString(this); } }; }
public static IBinaryField createBinaryField(NdVariable ndVariable) { char[] name = ndVariable.getName().getChars(); Constant constant = null; NdConstant ndConstant = ndVariable.getConstant(); if (ndConstant != null) { constant = ndConstant.getConstant(); } if (constant == null) { constant = Constant.NotAConstant; } NdTypeSignature type = ndVariable.getType(); IBinaryTypeAnnotation[] typeAnnotationArray = createBinaryTypeAnnotations(ndVariable.getTypeAnnotations()); IBinaryAnnotation[] annotations = toAnnotationArray(ndVariable.getAnnotations()); CharArrayBuffer signature = new CharArrayBuffer(); if (ndVariable.hasVariableFlag(NdVariable.FLG_GENERIC_SIGNATURE_PRESENT)) { type.getSignature(signature); } long tagBits = ndVariable.getTagBits(); return new IndexBinaryField(annotations, constant, signature.getContents(), ndVariable.getModifiers(), name, tagBits, typeAnnotationArray, type.getRawType().getFieldDescriptor().getChars()); }
public static IBinaryField createBinaryField(NdVariable ndVariable) { char[] name = ndVariable.getName().getChars(); Constant constant = null; NdConstant ndConstant = ndVariable.getConstant(); if (ndConstant != null) { constant = ndConstant.getConstant(); } if (constant == null) { constant = Constant.NotAConstant; } NdTypeSignature type = ndVariable.getType(); IBinaryTypeAnnotation[] typeAnnotationArray = createBinaryTypeAnnotations(ndVariable.getTypeAnnotations()); IBinaryAnnotation[] annotations = toAnnotationArray(ndVariable.getAnnotations()); CharArrayBuffer signature = new CharArrayBuffer(); if (ndVariable.hasVariableFlag(NdVariable.FLG_GENERIC_SIGNATURE_PRESENT)) { type.getSignature(signature); } long tagBits = ndVariable.getTagBits(); return new IndexBinaryField(annotations, constant, signature.getContents(), ndVariable.getModifiers(), name, tagBits, typeAnnotationArray, type.getRawType().getFieldDescriptor().getChars()); }
elementType.getRawType().getFieldDescriptor().getChars()); NdTypeId rawType = createTypeIdFromFieldDescriptor(computedFieldDescriptor);
elementType.getRawType().getFieldDescriptor().getChars()); NdTypeId rawType = createTypeIdFromFieldDescriptor(computedFieldDescriptor);
this.superclassName = superclass.getRawType().getBinaryName(); } else { this.superclassName = null;
this.superclassName = superclass.getRawType().getBinaryName(); } else { this.superclassName = null;