giovanniberti/robusta

Overloaded methods support

Opened this issue · 0 comments

  • For "jni" methods - use long method name format. This will also make it more error-proof, protecting against inconsistent types in java and rust declarations, now it's possible to write something like
        pub extern "jni" fn getBool(self, v: bool) -> bool {
            v
        }
    public native Boolean getBool(Boolean x);

and it won't fail on System.loadLibrary call

  • For "java" methods - allow to override corresponding java method name to be able to write something like
        #[java_name(getPassword)]
        pub extern "java" fn getPasswordString(
            &self,
            env: &JNIEnv,
        ) -> JniResult<String> {}

        #[java_name(getPassword)]
        pub extern "java" fn getPasswordBytes(
            &self,
            env: &JNIEnv,
        ) -> JniResult<Box<[i8]>> {}
    public String getPassword() {
        return password;
    }
    public byte[] getPassword() {
        return password.getBytes();
    }