public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull EncodedArrayItemIterator staticInitialValueIterator, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. startOffset = reader.getOffset(); int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); initialValueOffset = staticInitialValueIterator.getReaderOffset(); this.initialValue = staticInitialValueIterator.getNextOrNull(); }
public DexBackedField(@Nonnull DexReader reader, @Nonnull DexBackedClassDef classDef, int previousFieldIndex, @Nonnull EncodedArrayItemIterator staticInitialValueIterator, @Nonnull AnnotationsDirectory.AnnotationIterator annotationIterator) { this.dexFile = reader.dexBuf; this.classDef = classDef; // large values may be used for the index delta, which cause the cumulative index to overflow upon // addition, effectively allowing out of order entries. startOffset = reader.getOffset(); int fieldIndexDiff = reader.readLargeUleb128(); this.fieldIndex = fieldIndexDiff + previousFieldIndex; this.accessFlags = reader.readSmallUleb128(); this.annotationSetOffset = annotationIterator.seekTo(fieldIndex); initialValueOffset = staticInitialValueIterator.getReaderOffset(); this.initialValue = staticInitialValueIterator.getNextOrNull(); }
@Nonnull @Override public List<? extends EncodedValue> getExtraArguments() { List<EncodedValue> values = Lists.newArrayList(); EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } if (iter.getItemCount() == 3) { return values; } iter.skipNext(); iter.skipNext(); iter.skipNext(); EncodedValue item = iter.getNextOrNull(); while (item != null) { values.add(item); item = iter.getNextOrNull(); } return values; }
@Nonnull @Override public List<? extends EncodedValue> getExtraArguments() { List<EncodedValue> values = Lists.newArrayList(); EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } if (iter.getItemCount() == 3) { return values; } iter.skipNext(); iter.skipNext(); iter.skipNext(); EncodedValue item = iter.getNextOrNull(); while (item != null) { values.add(item); item = iter.getNextOrNull(); } return values; }
@Nonnull @Override public MethodHandleReference getMethodHandle() { EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } EncodedValue encodedValue = getCallSiteIterator().getNextOrNull(); assert encodedValue != null; if (encodedValue.getValueType() != ValueType.METHOD_HANDLE) { throw new ExceptionWithContext( "Invalid encoded value type (%d) for the first item in call site %d", encodedValue.getValueType(), callSiteIndex); } return ((MethodHandleEncodedValue) encodedValue).getValue(); }
@Nonnull @Override public MethodHandleReference getMethodHandle() { EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } EncodedValue encodedValue = getCallSiteIterator().getNextOrNull(); assert encodedValue != null; if (encodedValue.getValueType() != ValueType.METHOD_HANDLE) { throw new ExceptionWithContext( "Invalid encoded value type (%d) for the first item in call site %d", encodedValue.getValueType(), callSiteIndex); } return ((MethodHandleEncodedValue) encodedValue).getValue(); }
@Nonnull @Override public String getMethodName() { EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } iter.skipNext(); EncodedValue encodedValue = iter.getNextOrNull(); assert encodedValue != null; if (encodedValue.getValueType() != ValueType.STRING) { throw new ExceptionWithContext( "Invalid encoded value type (%d) for the second item in call site %d", encodedValue.getValueType(), callSiteIndex); } return ((StringEncodedValue) encodedValue).getValue(); }
@Nonnull @Override public String getMethodName() { EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } iter.skipNext(); EncodedValue encodedValue = iter.getNextOrNull(); assert encodedValue != null; if (encodedValue.getValueType() != ValueType.STRING) { throw new ExceptionWithContext( "Invalid encoded value type (%d) for the second item in call site %d", encodedValue.getValueType(), callSiteIndex); } return ((StringEncodedValue) encodedValue).getValue(); }
@Nonnull @Override public MethodProtoReference getMethodProto() { EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } iter.skipNext(); iter.skipNext(); EncodedValue encodedValue = iter.getNextOrNull(); assert encodedValue != null; if (encodedValue.getValueType() != ValueType.METHOD_TYPE) { throw new ExceptionWithContext( "Invalid encoded value type (%d) for the second item in call site %d", encodedValue.getValueType(), callSiteIndex); } return ((MethodTypeEncodedValue) encodedValue).getValue(); }
@Nonnull @Override public MethodProtoReference getMethodProto() { EncodedArrayItemIterator iter = getCallSiteIterator(); if (iter.getItemCount() < 3) { throw new ExceptionWithContext("Invalid call site item: must contain at least 3 entries."); } iter.skipNext(); iter.skipNext(); EncodedValue encodedValue = iter.getNextOrNull(); assert encodedValue != null; if (encodedValue.getValueType() != ValueType.METHOD_TYPE) { throw new ExceptionWithContext( "Invalid encoded value type (%d) for the second item in call site %d", encodedValue.getValueType(), callSiteIndex); } return ((MethodTypeEncodedValue) encodedValue).getValue(); }