Code Monkey home page Code Monkey logo

Comments (5)

fpoli avatar fpoli commented on May 28, 2024 2

Have you tried the following?

call_method(callback_object, "onStarted", "()V", &[]).unwrap()

The fourth argument is a (read only) reference to the array of method parameters. It should be empty in your case.

from jni-rs.

dmitry-timofeev avatar dmitry-timofeev commented on May 28, 2024 1

Probably InvalidArgList error shall be expanded with information about expected signature and actual number of passed parameters and their types, similarly to FieldNotFound:

https://github.com/prevoty/jni-rs/blob/8592176cd21c9fa70a3788140243096a4c753924/src/wrapper/errors.rs#L27

from jni-rs.

zeekruz avatar zeekruz commented on May 28, 2024

Yes. It definitelly works. Thanks! However I think it would be nice if parser skips the args in case of void signature.

from jni-rs.

dmitry-timofeev avatar dmitry-timofeev commented on May 28, 2024

I don't think that's a better behaviour because it hides a programming error (= a user is expected to pass as many arguments as the Java method accepts). But if there is an error, I'd expect a meaningful error describing what is wrong. It seems the library already handles this case: https://github.com/prevoty/jni-rs/blob/aac22fddf6b2c3a578b4d27385d9dfc10f984a4b/src/wrapper/jnienv.rs#L833

Did you get a descriptive error message?

from jni-rs.

zeekruz avatar zeekruz commented on May 28, 2024

Did you get a descriptive error message?
-- No.

I don't think that's a better behaviour because it hides a programming error
-- Agree.

Probably InvalidArgList error shall be expanded with information about expected signature
-- This is the best solution!

from jni-rs.

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.