Skip to content

Commit

Permalink
update type witnesses
Browse files Browse the repository at this point in the history
  • Loading branch information
esaulpaugh committed Sep 9, 2024
1 parent 44e90a1 commit e631dae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/esaulpaugh/headlong/abi/TupleType.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private static int measureObject(ABIType<Object> type, Object value) {
@Override
public int byteLengthPacked(Tuple value) {
final Object[] elements = value != null ? value.elements : new Object[size()];
return countBytes(i -> this.<ABIType<Object>>get(i).byteLengthPacked(elements[i]));
return countBytes(i -> this.<ABIType<? super Object>>get(i).byteLengthPacked(elements[i]));
}

private int countBytes(IntUnaryOperator counter) {
Expand Down Expand Up @@ -177,15 +177,15 @@ void encodeTail(Tuple value, ByteBuffer dest) {
encodeDynamic(value.elements, dest);
} else {
for (int i = 0; i < value.elements.length; i++) {
this.<ABIType<Object>>get(i).encodeTail(value.elements[i], dest);
this.<ABIType<? super Object>>get(i).encodeTail(value.elements[i], dest);
}
}
}

@Override
void encodePackedUnchecked(Tuple value, ByteBuffer dest) {
for (int i = 0; i < value.elements.length; i++) {
this.<ABIType<Object>>get(i).encodePackedUnchecked(value.elements[i], dest);
this.<ABIType<? super Object>>get(i).encodePackedUnchecked(value.elements[i], dest);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/esaulpaugh/headlong/abi/DecodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ public void testDecodeIndexedDynamicType() throws Throwable {
byte[][] topics = {
FastHex.decode("d78fe195906f002940f4b32985f1daa40764f8481c05447b6751db32e70d744b"),
FastHex.decode("392791df626408017a264f53fde61065d5a93a32b60171df9d8a46afdf82992d"),
TypeFactory.<IntType>create("int8").encode(12).array()
TypeFactory.<ABIType<? super Integer>>create("int8").encode(12).array()
};
Tuple result = event.decodeArgs(topics, Strings.EMPTY_BYTE_ARRAY);
assertEquals("392791df626408017a264f53fde61065d5a93a32b60171df9d8a46afdf82992d", Strings.encode((byte[]) result.get(0)));
Expand Down

0 comments on commit e631dae

Please sign in to comment.