Comments (10)
(also: I noticed that java booleans seem to be the opposite from the ones in rust: Passing the java value true
to a rust function prints false
and vice versa)
from robusta.
Also, I'm getting a similar error when calling a java function that takes an Integer array as input. When converting the corresponding Vec<i32>
, it throws:
panicked at 'called Result::unwrap() on an Err value: "unexpected parseInput: java/lang/Integer"'
in <i32 as robusta_jni::convert::JavaValue>::autobox
...
from robusta.
Unfortunately I can't check the code right now, I'll get back to you later this week. From the stack trace it seems that it's the string conversion that fails from Rust as you suggested.
(also: I noticed that java booleans seem to be the opposite from the ones in rust: Passing the java value true to a rust function prints false and vice versa)
🤦 Right here. To get to 1.0 I'm going to need an extensive test suite, that's for sure.
Could you provide a minimal example? Or try switching to a different call_type
?
from robusta.
Hi, I'm really sorry I can't be more informative. The string bug I tried to narrow down to something simpler, but in all my toy examples it worked - only in the actual setting where I needed it to work did it not, and I have no idea what was different (the strings were definitely equal on an as_bytes()-level). So all I can say is that it's not a specific string that caused the problem, and in the setting where it happened, it seemed to happen with every string.
safe/unsafe call types I also tried, didn't make a difference.
I switched to the vanilla jni implementation for now, because the parts where I need jni are rather small and self contained anyway,
from robusta.
When converting the corresponding Vec, it throws
This is definitely related to signature parsing in jni-rs
from robusta.
@Jazzpirate I know it's been a while since you posted this, but can you provide a full traceback of the failed string conversion? Or a link to the whole project, if it's possible.
from robusta.
BTW, can't a pending exception be the case?
At the point the issue was created, robusta was v0.2, and it used jni-rs v0.17.0.
from robusta.
Hi, I appreciate you looking into this, but I unfortunately can't be of much help (anymore). I never pushed the code anywhere since I couldn't get it to work, and I switched to jni-rs directly soon after...
from robusta.
But may be you can remember if it's possible that you had a java exception thrown before you call MyStruct::message
from robusta.
Hmm, I'm fairly certain I didn't - the idea is that I wrote a TeX-to-HTML converter in rust, which I want to use from java and use functions such as the one sketched above to pass output messages back. So all the java code did was basically something like compile("foo.tex",mystruct)
, the rust converter would get going, and occasionally call mystruct.message("(/.../article.sty")
or whatever. So there was little to throw errors on the java side in the first place, and little on the rust side to even get to the point where message
would be called if anything failed before, if that makes sense...
from robusta.
Related Issues (20)
- Support for Option<T>? HOT 8
- Support for primitive arrays in combination with Signature HOT 1
- Invalid Return Signature on Call Java Void function from Rust HOT 2
- [Features request] Mark the type of Error in rust
- Error::description() deprecated, should use Display trait HOT 9
- Illegal hardware instruction java - when calling Rust code from Java HOT 1
- Is arm64 architecture (M1Max MacBook) supported? HOT 1
- Throw an exception specific to the returned error instance
- `pub` keyword in "jni" functions causing weird compiler error about unrelated code. HOT 2
- No way to return an error with arbitrary message HOT 2
- [Features request] Rust JNI vs Java benchmark example
- Dependency version update HOT 2
- Windows support HOT 1
- TryFromJavaValue is not safe
- Any way to make IDE aware of `#[bridge]` struct? HOT 1
- Generics support HOT 1
- Issue with mapping Java class fields of type `byte[]` to a `Field` with type `Box<[u8]>` HOT 1
- Overloaded methods support
- Catch panics
- Java inheritance HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robusta.