private int getTargetIndex(DexFile file) { Constant ref = methodHandle.getRef(); if (methodHandle.isAccessor()) { FieldIdsSection fieldIds = file.getFieldIds(); return fieldIds.indexOf((CstFieldRef) ref); } else if (methodHandle.isInvocation()) { if (ref instanceof CstInterfaceMethodRef) { ref = ((CstInterfaceMethodRef)ref).toMethodRef(); } MethodIdsSection methodIds = file.getMethodIds(); return methodIds.indexOf((CstBaseMethodRef) ref); } else { throw new IllegalStateException("Unhandled invocation type"); } } }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ public void writeTo(DexFile file, AnnotatedOutput out) { int fieldIdx = file.getFieldIds().indexOf(field); int annotationsOff = annotations.getAbsoluteOffset(); if (out.annotates()) { out.annotate(0, " " + field.toHuman()); out.annotate(4, " field_idx: " + Hex.u4(fieldIdx)); out.annotate(4, " annotations_off: " + Hex.u4(annotationsOff)); } out.writeInt(fieldIdx); out.writeInt(annotationsOff); }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128Utils.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128Utils.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128Utils.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128Utils.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128Utils.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128Utils.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUleb128(diff); out.writeUleb128(accessFlags); return fieldIdx; } }
/** {@inheritDoc} */ @Override public int encode(DexFile file, AnnotatedOutput out, int lastIndex, int dumpSeq) { int fieldIdx = file.getFieldIds().indexOf(field); int diff = fieldIdx - lastIndex; int accessFlags = getAccessFlags(); if (out.annotates()) { out.annotate(0, String.format(" [%x] %s", dumpSeq, field.toHuman())); out.annotate(Leb128Utils.unsignedLeb128Size(diff), " field_idx: " + Hex.u4(fieldIdx)); out.annotate(Leb128Utils.unsignedLeb128Size(accessFlags), " access_flags: " + AccessFlags.fieldString(accessFlags)); } out.writeUnsignedLeb128(diff); out.writeUnsignedLeb128(accessFlags); return fieldIdx; } }