-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java: introduce proper types and minimise reliance on ByteBuffer/byte[] #555
Conversation
bindings/java/java/src/main/java/org/ethereum/evmc/HostContext.java
Outdated
Show resolved
Hide resolved
bindings/java/java/src/main/java/org/ethereum/evmc/types/Message.java
Outdated
Show resolved
Hide resolved
I really like this idea. Would remove all guessing. Feels like you have some coding issues. Do you intend for implementors to create Address, Bytes32 Uint256 objects? If so, they'll need public constructors. |
@atoulme thanks! This is still work in progress, hence the draft mode, but I think this would be the safest way to handle things. Only issue is |
673139f
to
a05204d
Compare
d1dd3b6
to
eefa487
Compare
a09190b
to
6f210ca
Compare
public Message() {} | ||
|
||
public ByteBuffer getByteBuffer() { | ||
// This is big endian by default, which is what we want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ByteBuffer is set to big-endian by default, but we want to set it to native endian (helper to set: https://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html#order(java.nio.ByteOrder)).
We can use ByteOrder
for that: https://docs.oracle.com/javase/6/docs/api/java/nio/ByteOrder.html#nativeOrder()
Need to add Result class, and also pass Result/Message in HostContext.call. |
edeccd9
to
8209665
Compare
This currently contains the desired API from the Java perspective, yet to actually implement all of this. I'm leaning towards now that the C part would need to just receive an instance of Result/Message and manually read/write the fields and compose the C struct, as opposed to trying to construct the C struct from within Java. |
1342988
to
ee5bad7
Compare
…ble in Java. Map log topics to Bytes32 objects.
With #706 Java support was dropped -- closing this. |
Part of #548.