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

Exporting a method with a different name than its declaration #408

Open
RevolvingMadness opened this issue Jul 10, 2024 · 2 comments
Open

Comments

@RevolvingMadness
Copy link

Let's say I have a Java class:

class Foo {
    public void bar() {
        System.out.println("bar");
    }
}

I want to access that bar method in python but with a different name. I swear a while ago I could do:

@HostAccess.Export(name = "barMethod")
public void bar() {
    System.out.println("bar");
}

But now the name field doesn't exist?

So then in Python it would be called with barMethod instead of bar.

@chumer
Copy link
Member

chumer commented Jul 15, 2024

That is currently not possible. Can you elaborate a bit on why you would want to do that instead of declaring a method with the new name?

@RevolvingMadness
Copy link
Author

I have a typing library in python that allows IntelliSense to function and I want to use snake_case because that is what you are supposed to use with methods. In Java you're supposed to use camelCase for method names. So the declaration in Java would be barMethod the method in Python would be bar_method. I can just declare the methods in java as bar_method or the methods in Python as barMethod but I was just wondering if this was possible.

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