public int compare(AnnotationItem annotationItem, AnnotationItem annotationItem2) { int annotationItemIndex = annotationItem.getEncodedAnnotation().annotationType.getIndex(); int annotationItemIndex2 = annotationItem2.getEncodedAnnotation().annotationType.getIndex(); if (annotationItemIndex < annotationItemIndex2) { return -1; } else if (annotationItemIndex == annotationItemIndex2) { return 0; } return 1; } });
/** {@inheritDoc} */ public int placeValue(int offset) { return offset + EncodedValueUtils.getRequiredBytesForUnsignedIntegralValue(value.getIndex()) + 1; }
/** * @return the size of this <code>EncodedTypeAddrPair</code> */ private int getSize() { return Leb128Utils.unsignedLeb128Size(exceptionType.getIndex()) + Leb128Utils.unsignedLeb128Size(handlerAddress); }
/** * Writes the <code>EncodedTypeAddrPair</code> to the given <code>AnnotatedOutput</code> object * @param out the <code>AnnotatedOutput</code> object to write to */ private void writeTo(AnnotatedOutput out) { if (out.annotates()) { out.annotate("exception_type: " + exceptionType.getTypeDescriptor()); out.writeUnsignedLeb128(exceptionType.getIndex()); out.annotate("handler_addr: 0x" + Integer.toHexString(handlerAddress)); out.writeUnsignedLeb128(handlerAddress); } else { out.writeUnsignedLeb128(exceptionType.getIndex()); out.writeUnsignedLeb128(handlerAddress); } }
/** {@inheritDoc} */ protected void writeItem(AnnotatedOutput out) { //yes, the code to write the item is duplicated. This eliminates the need to iterate over the list twice if (out.annotates()) { out.annotate(4, "size: 0x" + Integer.toHexString(typeList.length) + " (" + typeList.length +")"); for (TypeIdItem typeIdItem: typeList) { out.annotate(2, "type_id_item: " + typeIdItem.getTypeDescriptor()); } } out.writeInt(typeList.length); for (TypeIdItem typeIdItem: typeList) { int typeIndex = typeIdItem.getIndex(); if (typeIndex > 0xffff) { throw new RuntimeException(String.format("Error writing type_list entry. The type index of " + "type %s is too large", typeIdItem.getTypeDescriptor())); } out.writeShort(typeIndex); } }
/** {@inheritDoc} */ public int placeValue(int offset) { offset = offset + Leb128Utils.unsignedLeb128Size(annotationType.getIndex()); offset = offset + Leb128Utils.unsignedLeb128Size(names.length); for (int i=0; i<names.length; i++) { offset = offset + Leb128Utils.unsignedLeb128Size(names[i].getIndex()); offset = values[i].placeValue(offset); } return offset; }
/** {@inheritDoc} */ protected void writeItem(AnnotatedOutput out) { if (out.annotates()) { out.annotate(2, "class_type: " + classType.getTypeDescriptor()); out.annotate(2, "field_type: " + fieldType.getTypeDescriptor()); out.annotate(4, "field_name: " + fieldName.getStringValue()); } int classIndex = classType.getIndex(); if (classIndex > 0xffff) { throw new RuntimeException(String.format("Error writing field_id_item for %s. The type index of " + "defining class %s is too large", getFieldString(), classType.getTypeDescriptor())); } out.writeShort(classIndex); int typeIndex = fieldType.getIndex(); if (typeIndex > 0xffff) { throw new RuntimeException(String.format("Error writing field_id_item for %s. The type index of field " + "type %s is too large", getFieldString(), fieldType.getTypeDescriptor())); } out.writeShort(typeIndex); out.writeInt(fieldName.getIndex()); }
/** {@inheritDoc} */ protected void writeItem(AnnotatedOutput out) { if (out.annotates()) { out.annotate(2, "class_type: " + classType.getTypeDescriptor()); out.annotate(2, "method_prototype: " + methodPrototype.getPrototypeString()); out.annotate(4, "method_name: " + methodName.getStringValue()); } int classIndex = classType.getIndex(); if (classIndex > 0xffff) { throw new RuntimeException(String.format("Error writing method_id_item for %s. The type index of " + "defining class %s is too large", getMethodString(), classType.getTypeDescriptor())); } out.writeShort(classIndex); int prototypeIndex = methodPrototype.getIndex(); if (prototypeIndex > 0xffff) { throw new RuntimeException(String.format("Error writing method_id_item for %0. The prototype index of " + "method prototype %s is too large", getMethodString(), methodPrototype.getPrototypeString())); } out.writeShort(prototypeIndex); out.writeInt(methodName.getIndex()); }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { byte[] bytes = EncodedValueUtils.encodeUnsignedIntegralValue(value.getIndex()); if (out.annotates()) { out.annotate(1, "value_type=" + ValueType.VALUE_TYPE.name() + ",value_arg=" + (bytes.length - 1)); out.annotate(bytes.length, "value: " + value.getTypeDescriptor()); } out.writeByte(ValueType.VALUE_TYPE.value | ((bytes.length - 1) << 5)); out.write(bytes); }
/** {@inheritDoc} */ protected void writeItem(AnnotatedOutput out) { if (out.annotates()) { out.annotate(4, "class_type: " + classType.getTypeDescriptor()); out.annotate(4, "access_flags: " + AccessFlags.formatAccessFlagsForClass(accessFlags)); out.annotate(4, "superclass_type: " + (superType==null?"":superType.getTypeDescriptor())); out.annotate(4, "interfaces: " + (implementedInterfaces==null?"":implementedInterfaces.getTypeListString(" "))); out.annotate(4, "source_file: " + (sourceFile==null?"":sourceFile.getStringValue())); out.annotate(4, "annotations_off: " + (annotations==null?"":"0x"+Integer.toHexString(annotations.getOffset()))); out.annotate(4, "class_data_off:" + (classData==null?"":"0x"+Integer.toHexString(classData.getOffset()))); out.annotate(4, "static_values_off: " + (staticFieldInitializers==null?"":"0x"+Integer.toHexString(staticFieldInitializers.getOffset()))); } out.writeInt(classType.getIndex()); out.writeInt(accessFlags); out.writeInt(superType==null?-1:superType.getIndex()); out.writeInt(implementedInterfaces==null?0:implementedInterfaces.getOffset()); out.writeInt(sourceFile==null?-1:sourceFile.getIndex()); out.writeInt(annotations==null?0:annotations.getOffset()); out.writeInt(classData==null?0:classData.getOffset()); out.writeInt(staticFieldInitializers==null?0:staticFieldInitializers.getOffset()); }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { out.annotate("annotation_type: " + annotationType.getTypeDescriptor()); out.writeUnsignedLeb128(annotationType.getIndex()); out.annotate("element_count: 0x" + Integer.toHexString(names.length) + " (" + names.length + ")"); out.writeUnsignedLeb128(names.length); for (int i=0; i<names.length; i++) { out.annotate(0, "[" + i + "] annotation_element"); out.indent(); out.annotate("element_name: " + names[i].getStringValue()); out.writeUnsignedLeb128(names[i].getIndex()); out.annotate(0, "element_value:"); out.indent(); values[i].writeValue(out); out.deindent(); out.deindent(); } }
/** {@inheritDoc} */ protected void writeItem(AnnotatedOutput out) { if (out.annotates()) { out.annotate(4, "shorty_descriptor: " + shortyDescriptor.getStringValue()); out.annotate(4, "return_type: " + returnType.getTypeDescriptor()); if (parameters == null) { out.annotate(4, "parameters:"); } else { out.annotate(4, "parameters: " + parameters.getTypeListString("")); } } out.writeInt(shortyDescriptor.getIndex()); out.writeInt(returnType.getIndex()); out.writeInt(parameters == null?0:parameters.getOffset()); }
public int compare(AnnotationItem annotationItem, AnnotationItem annotationItem2) { int annotationItemIndex = annotationItem.getEncodedAnnotation().annotationType.getIndex(); int annotationItemIndex2 = annotationItem2.getEncodedAnnotation().annotationType.getIndex(); if (annotationItemIndex < annotationItemIndex2) { return -1; } else if (annotationItemIndex == annotationItemIndex2) { return 0; } return 1; } });
/** {@inheritDoc} */ public int placeValue(int offset) { return offset + EncodedValueUtils.getRequiredBytesForUnsignedIntegralValue(value.getIndex()) + 1; }
/** * @return the size of this <code>EncodedTypeAddrPair</code> */ private int getSize() { return Leb128Utils.unsignedLeb128Size(exceptionType.getIndex()) + Leb128Utils.unsignedLeb128Size(handlerAddress); }
/** * Writes the <code>EncodedTypeAddrPair</code> to the given <code>AnnotatedOutput</code> object * @param out the <code>AnnotatedOutput</code> object to write to */ private void writeTo(AnnotatedOutput out) { if (out.annotates()) { out.annotate("exception_type: " + exceptionType.getTypeDescriptor()); out.writeUnsignedLeb128(exceptionType.getIndex()); out.annotate("handler_addr: 0x" + Integer.toHexString(handlerAddress)); out.writeUnsignedLeb128(handlerAddress); } else { out.writeUnsignedLeb128(exceptionType.getIndex()); out.writeUnsignedLeb128(handlerAddress); } }
/** {@inheritDoc} */ public int placeValue(int offset) { offset = offset + Leb128Utils.unsignedLeb128Size(annotationType.getIndex()); offset = offset + Leb128Utils.unsignedLeb128Size(names.length); for (int i=0; i<names.length; i++) { offset = offset + Leb128Utils.unsignedLeb128Size(names[i].getIndex()); offset = values[i].placeValue(offset); } return offset; }
/** {@inheritDoc} */ public void writeValue(AnnotatedOutput out) { byte[] bytes = EncodedValueUtils.encodeUnsignedIntegralValue(value.getIndex()); if (out.annotates()) { out.annotate(1, "value_type=" + ValueType.VALUE_TYPE.name() + ",value_arg=" + (bytes.length - 1)); out.annotate(bytes.length, "value: " + value.getTypeDescriptor()); } out.writeByte(ValueType.VALUE_TYPE.value | ((bytes.length - 1) << 5)); out.write(bytes); }
/** {@inheritDoc} */ protected void writeItem(AnnotatedOutput out) { if (out.annotates()) { out.annotate(4, "shorty_descriptor: " + shortyDescriptor.getStringValue()); out.annotate(4, "return_type: " + returnType.getTypeDescriptor()); if (parameters == null) { out.annotate(4, "parameters:"); } else { out.annotate(4, "parameters: " + parameters.getTypeListString("")); } } out.writeInt(shortyDescriptor.getIndex()); out.writeInt(returnType.getIndex()); out.writeInt(parameters == null?0:parameters.getOffset()); }