Skip to content
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

Improve Blob type #934

Open
DanielKamkha opened this issue Jun 1, 2021 · 0 comments
Open

Improve Blob type #934

DanielKamkha opened this issue Jun 1, 2021 · 0 comments

Comments

@DanielKamkha
Copy link
Contributor

Currently Blob IDL type is represented in C++ as std::shared_ptr<std::vector<uint8_t>>, making it nullable in C++ even if the IDL declaration is not marked as such.

An alternative way to represent Blob in C++ needs to be developed.

DanielKamkha added a commit that referenced this issue Jun 1, 2021
Updated JNI conversion function for non-nullable Blobs to avoid returning `null` when the C++ function returns a null
shared pointer.

Having a null shared pointer coming from C++ when the type is specified as non-nullable in the IDL is a violation of
contract. The correct fix for this issue would be to change `Blob` representation from `shared_ptr<vector>` to something
that cannot be `null`. However, this would be a breaking change, so it has to be done later (#934). For now it's just
the small JNI workaround.

Resolves: #929
Signed-off-by: Daniel Kamkha <[email protected]>
DanielKamkha added a commit that referenced this issue Jun 1, 2021
Updated JNI conversion function for non-nullable Blobs to avoid returning `null` when the C++ function returns a null
shared pointer.

Having a null shared pointer coming from C++ when the type is specified as non-nullable in the IDL is a violation of
contract. The correct fix for this issue would be to change `Blob` representation from `shared_ptr<vector>` to something
that cannot be `null`. However, this would be a breaking change, so it has to be done later (#934). For now it's just
the small JNI workaround.

Resolves: #929
Signed-off-by: Daniel Kamkha <[email protected]>
DanielKamkha added a commit that referenced this issue Jun 1, 2021
Updated JNI conversion function for non-nullable Blobs to avoid returning `null` when the C++ function returns a null
shared pointer.

Having a null shared pointer coming from C++ when the type is specified as non-nullable in the IDL is a violation of
contract. The correct fix for this issue would be to change `Blob` representation from `shared_ptr<vector>` to something
that cannot be `null`. However, this would be a breaking change, so it has to be done later (#934). For now it's just
the small JNI workaround.

Resolves: #929
Signed-off-by: Daniel Kamkha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant