public String toString() { try { return getConstant().toString(); } catch (RuntimeException e) { // This is called most often from the debugger, so we want to return something meaningful even // if the code is buggy, the database is corrupt, or we don't have a read lock. return super.toString(); } } }
public void setParent(NdConstantArray result) { PARENT_ARRAY.put(getNd(), this.address, result); }
public String toString() { try { StringBuilder result = new StringBuilder(); NdTypeSignature localType = getType(); if (localType != null) { result.append(localType.toString()); result.append(" "); //$NON-NLS-1$ } IString name = getName(); if (name != null) { result.append(name.toString()); } NdConstant constant = getConstant(); if (constant != null) { result.append(" = "); //$NON-NLS-1$ result.append(constant.toString()); } return result.toString(); } catch (RuntimeException e) { // This is called most often from the debugger, so we want to return something meaningful even // if the code is buggy, the database is corrupt, or we don't have a read lock. return super.toString(); } }
/** * Adds the given field to the given type */ private void addField(NdType type, IBinaryField nextField) throws CoreException { NdVariable variable = type.createVariable(); variable.setName(nextField.getName()); if (nextField.getGenericSignature() != null) { variable.setVariableFlag(NdVariable.FLG_GENERIC_SIGNATURE_PRESENT); } attachAnnotations(variable, nextField.getAnnotations()); variable.setConstant(NdConstant.create(getNd(), nextField.getConstant())); variable.setModifiers(nextField.getModifiers()); SignatureWrapper nextTypeSignature = GenericSignatures.getGenericSignatureFor(nextField); IBinaryTypeAnnotation[] typeAnnotations = nextField.getTypeAnnotations(); if (typeAnnotations != null) { variable.allocateTypeAnnotations(typeAnnotations.length); for (IBinaryTypeAnnotation next : typeAnnotations) { NdTypeAnnotation annotation = variable.createTypeAnnotation(); initTypeAnnotation(annotation, next); } } variable.setType(createTypeSignature(nextTypeSignature, nextField.getTypeName())); variable.setTagBits(nextField.getTagBits()); }
/** * Adds the given field to the given type */ private void addField(NdType type, IBinaryField nextField) throws CoreException { NdVariable variable = type.createVariable(); variable.setName(nextField.getName()); if (nextField.getGenericSignature() != null) { variable.setVariableFlag(NdVariable.FLG_GENERIC_SIGNATURE_PRESENT); } attachAnnotations(variable, nextField.getAnnotations()); variable.setConstant(NdConstant.create(getNd(), nextField.getConstant())); variable.setModifiers(nextField.getModifiers()); SignatureWrapper nextTypeSignature = GenericSignatures.getGenericSignatureFor(nextField); IBinaryTypeAnnotation[] typeAnnotations = nextField.getTypeAnnotations(); if (typeAnnotations != null) { variable.allocateTypeAnnotations(typeAnnotations.length); for (IBinaryTypeAnnotation next : typeAnnotations) { NdTypeAnnotation annotation = variable.createTypeAnnotation(); initTypeAnnotation(annotation, next); } } variable.setType(createTypeSignature(nextTypeSignature, nextField.getTypeName())); variable.setTagBits(nextField.getTagBits()); }
@Override public String toString() { try { return getConstant().toString(); } catch (RuntimeException e) { // This is called most often from the debugger, so we want to return something meaningful even // if the code is buggy, the database is corrupt, or we don't have a read lock. return super.toString(); } } }
public void setParent(NdConstantArray result) { PARENT_ARRAY.put(getNd(), this.address, result); }
@Override public String toString() { try { StringBuilder result = new StringBuilder(); NdTypeSignature localType = getType(); if (localType != null) { result.append(localType.toString()); result.append(" "); //$NON-NLS-1$ } IString name = getName(); if (name != null) { result.append(name.toString()); } NdConstant constant = getConstant(); if (constant != null) { result.append(" = "); //$NON-NLS-1$ result.append(constant.toString()); } return result.toString(); } catch (RuntimeException e) { // This is called most often from the debugger, so we want to return something meaningful even // if the code is buggy, the database is corrupt, or we don't have a read lock. return super.toString(); } }
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(); }
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()); }