Code Monkey home page Code Monkey logo

Comments (10)

Jazzpirate avatar Jazzpirate commented on May 28, 2024 1

(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.

Jazzpirate avatar Jazzpirate commented on May 28, 2024

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.

giovanniberti avatar giovanniberti commented on May 28, 2024

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.

Jazzpirate avatar Jazzpirate commented on May 28, 2024

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.

uvlad7 avatar uvlad7 commented on May 28, 2024

When converting the corresponding Vec, it throws

This is definitely related to signature parsing in jni-rs

from robusta.

uvlad7 avatar uvlad7 commented on May 28, 2024

@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.

uvlad7 avatar uvlad7 commented on May 28, 2024

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.

Jazzpirate avatar Jazzpirate commented on May 28, 2024

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.

uvlad7 avatar uvlad7 commented on May 28, 2024

But may be you can remember if it's possible that you had a java exception thrown before you call MyStruct::message

from robusta.

Jazzpirate avatar Jazzpirate commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.