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

working with types in java namespace #192

Open
jmayclin opened this issue Jan 7, 2025 · 1 comment
Open

working with types in java namespace #192

jmayclin opened this issue Jan 7, 2025 · 1 comment

Comments

@jmayclin
Copy link

jmayclin commented Jan 7, 2025

I want to expose the following method, but I'm uncertain whether this is possible.

public javax.net.ssl.SSLEngineResult wrap(
    java.nio.ByteBuffer, 
    java.nio.ByteBuffer
) throws javax.net.ssl.SSLException;

The duchess::java module does not expose any of the nio types. I can write my own bindings for java.nio.ByteBuffer, but I can't figure out how to refer to that in my javax package.

duchess::java_package! {
    package javax.net.ssl;
    class SSLEngine {
        public javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer, java.nio.ByteBuffer) throws javax.net.ssl.SSLException;
        public abstract java.lang.String[] getEnabledCipherSuites();
    }
}

This results in the following error

   --> bench/src/coffee/java_def.rs:227:5
    |
227 |     class SSLEngine {
    |     ^^^^^ could not find `nio` in `java`
    |
help: consider importing this module
    |
187 |     package javax.net.use crate::coffee::java_def::java::nio;
    |                       +++++++++++++++++++++++++++++++++++++++

While maybe I could bring my own java package into scope, I still need access to the duchess::java package for java.lang.String[] and other similar types.

@rcoh
Copy link
Contributor

rcoh commented Jan 8, 2025

Yes, we need a general solution here for some sort of merging of packages by duchess. Maybe this is more practical now that we have build.rs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants